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