New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
sette_rpt.sh in branches/NERC/dev_r5549_BDY_ZEROGRAD/NEMOGCM/SETTE – NEMO

source: branches/NERC/dev_r5549_BDY_ZEROGRAD/NEMOGCM/SETTE/sette_rpt.sh @ 6808

Last change on this file since 6808 was 6808, checked in by jamesharle, 8 years ago

merge with trunk@6232 for consistency with SSB code

  • Property svn:executable set to *
File size: 6.9 KB
Line 
1#!/bin/bash -f
2#
3# simple SETTE report generator.
4#
5# This version should be run in the SETTE directory.
6# The machine name will be picked up from the sette.sh script but the location of the
7# validation directory needs to be set here (currently assumed to reside in the ../CONFIG directory)
8#
9#########################################################################################
10######################### Start of function definitions #################################
11##
12function resttest() { 
13#
14# Restartability checks. Expects LONG and SHORT run directories
15# Compares end of LONG stat files with equivalent entries from the SHORT stat files.
16#
17  vdir=$1
18  nam=$2
19  pass=$3
20#
21  if [ -d $vdir/$nam ]; then
22    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l `
23    dorv=`echo $dorv | sed -e 's:.*/::'`
24    f1o=$vdir/$nam/$mach/$dorv/LONG/ocean.output
25    f1s=$vdir/$nam/$mach/$dorv/LONG/solver.stat
26    f1t=$vdir/$nam/$mach/$dorv/LONG/tracer.stat
27    f2o=$vdir/$nam/$mach/$dorv/SHORT/ocean.output
28    f2s=$vdir/$nam/$mach/$dorv/SHORT/solver.stat
29    f2t=$vdir/$nam/$mach/$dorv/SHORT/tracer.stat
30
31    if  [ ! -f $f1s ] &&  [ ! -f $f1t ] ; then
32      printf "%-20s %s\n" $nam " incomplete test";
33      return;
34    fi
35    if  [ ! -f $f2s ] &&  [ ! -f $f2t ] ; then
36      printf "%-20s %s\n" $nam " incomplete test";
37      return;
38    fi
39#
40    done_oce=0
41
42    if  [  -f $f1s ] && [  -f $f2s ]; then
43      nl=(`wc -l $f2s`)
44      tail -${nl[0]} $f1s > f1.tmp$$
45      cmp -s f1.tmp$$ $f2s
46      if [ $? == 0 ]; then
47        if [ $pass == 0 ]; then
48          printf "%-20s %s %s\n" $nam  " solver.stat restartability  passed : " $dorv
49        fi
50      else
51        printf "%-20s %s %s\n" $nam  " solver.stat restartability  FAILED : " $dorv 
52#
53# Offer view of differences on the second pass
54#
55        if [ $pass == 1 ]; then
56          echo "<return> to view solver.stat differences"
57          read y
58          sdiff f1.tmp$$ $f2s
59          echo "<return> to view ocean.output differences"
60          read y
61          sdiff $f1o $f2o | grep "|"
62          done_oce=1
63          echo "<return> to continue"
64          read y
65        fi
66      fi
67    fi
68#
69# Check tracer.stat files (if they exist)
70#
71    if  [  -f $f1t ] && [  -f $f2t ]; then
72      nl=(`wc -l $f2t`)
73      tail -${nl[0]} $f1t > f1.tmp$$
74      cmp -s f1.tmp$$ $f2t
75      if [ $? == 0 ]; then
76        if [ $pass == 0 ]; then
77          printf "%-20s %s %s\n" $nam  " tracer.stat restartability  passed : " $dorv
78        fi
79      else
80        printf "%-20s %s %s\n" $nam  " tracer.stat restartability  FAILED : " $dorv 
81#
82# Offer view of differences on the second pass
83#
84        if [ $pass == 1 ]; then
85          echo "<return> to view tracer.stat differences"
86          read y
87          sdiff f1.tmp$$ $f2t
88#
89# Only offer ocean.output view if it has not been viewed previously
90#
91          if [ $done_oce == 0 ]; then
92            echo "<return> to view ocean.output differences"
93            read y
94            sdiff $f1o $f2o | grep "|"
95          fi
96          echo "<return> to continue"
97          read y
98        fi
99      fi
100    fi
101    rm f1.tmp$$
102  fi
103}
104
105function reprotest(){
106#
107# Reproducibility checks. Expects REPRO_N_M and REPRO_I_J run directories
108# Compares end of stat files from each
109#
110  vdir=$1
111  nam=$2
112  pass=$3
113#
114  if [ -d $vdir/$nam ]; then
115    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l `
116    dorv=`echo $dorv | sed -e 's:.*/::'`
117    rep1=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -2l | head -1 `
118    rep2=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -1l`
119    f1o=$vdir/$nam/$mach/$dorv/$rep1/ocean.output
120    f1s=$vdir/$nam/$mach/$dorv/$rep1/solver.stat
121    f1t=$vdir/$nam/$mach/$dorv/$rep1/tracer.stat
122    f2o=$vdir/$nam/$mach/$dorv/$rep2/ocean.output
123    f2s=$vdir/$nam/$mach/$dorv/$rep2/solver.stat
124    f2t=$vdir/$nam/$mach/$dorv/$rep2/tracer.stat
125
126    if  [ ! -f $f1s ] && [ ! -f $f1t ] ; then
127      printf "%-20s %s\n" $nam " incomplete test";
128      return;
129    fi
130    if  [ ! -f $f2s ] && [ ! -f $f2t ] ; then
131      printf "%-20s %s\n" $nam " incomplete test";
132      return;
133    fi
134#
135    done_oce=0
136
137    if  [ -f $f1s ] && [ -f $f2s ] ; then
138      cmp -s $f1s $f2s
139      if [ $? == 0 ]; then
140        if [ $pass == 0 ]; then
141          printf "%-20s %s %s\n" $nam  " solver.stat reproducibility passed : " $dorv
142        fi
143      else
144        printf "%-20s %s %s\n" $nam  " solver.stat reproducibility FAILED : " $dorv 
145#
146# Offer view of differences on the second pass
147#
148        if [ $pass == 1 ]; then
149          echo "<return> to view solver.stat differences"
150          read y
151          sdiff f1.tmp$$ $f2s
152          echo "<return> to view ocean.output differences"
153          read y
154          sdiff $f1o $f2o | grep "|"
155          done_oce=1
156          echo "<return> to continue"
157          read y
158        fi
159      fi
160    fi
161#
162# Check tracer.stat files (if they exist)
163#
164    if  [ -f $f1t ] && [ -f $f2t ] ; then
165      cmp -s $f1t $f2t
166      if [ $? == 0 ]; then
167        if [ $pass == 0 ]; then           printf "%-20s %s %s\n" $nam  " tracer.stat reproducibility passed : " $dorv
168        fi
169      else
170        printf "%-20s %s %s\n" $nam  " tracer.stat reproducibility  FAILED : " $dorv
171#
172# Offer view of differences on the second pass
173#
174        if [ $pass == 1 ]; then
175          echo "<return> to view tracer.stat differences"
176          read y
177          sdiff $f1t $f2t
178#
179# Only offer ocean.output view if it has not been viewed previously
180#
181          if [ $done_oce == 0 ]; then
182            echo "<return> to view ocean.output differences"
183            read y
184            sdiff $f1o $f2o | grep "|"
185          fi
186          echo "<return> to continue"
187          read y
188        fi
189      fi
190    fi
191  fi
192}
193########################### END of function definitions #################################
194##                                                                                     ##
195##    Main script                                                                      ##
196##                                                                                     ##
197#########################################################################################
198#
199  mach=`grep "COMPILER=" ./sette.sh | sed -e 's/COMPILER=//'`
200  NEMO_VALID=`grep "NEMO_VALIDATION_DIR=" ./param.cfg | sed -e 's/NEMO_VALIDATION_DIR=//'`
201#
202  if [ ! -d $NEMO_VALID ]; then
203    echo "$NEMO_VALID validation directory not found"
204    exit
205  fi
206#
207# The script also needs the date or revision tag. Currently this is taken from the latest sub-directory found in each directory
208
209for pass in  0 1
210do
211#
212 if [ $pass == 1 ]; then echo "---------------2nd pass------------------";fi
213#
214# Restartability test
215#
216 for restart_test in WGYRE_LONG WISOMIP_LONG WORCA2LIMPIS_LONG WORCA2OFFPIS_LONG WAMM12_LONG WORCA2LIM3_LONG WSAS_LONG WORCA2AGUL_LONG
217 do
218   resttest $NEMO_VALID $restart_test $pass
219 done
220#
221# Reproducibility tests
222#
223 for repro_test in WGYRE_4 WISOMIP_4 WORCA2LIMPIS_16 WORCA2OFFPIS_16 WAMM12_32 WORCA2LIM3_16 WORCA2_LIM_OBS WSAS_32 WORCA2AGUL_1_2 WORCA2AGUL_16 WORCA2AGUL_2_2_NAG
224 do
225   reprotest $NEMO_VALID $repro_test $pass
226 done
227#
228done
229exit
Note: See TracBrowser for help on using the repository browser.