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/2015/dev_r5803_NOC_WAD/NEMOGCM/SETTE – NEMO

source: branches/2015/dev_r5803_NOC_WAD/NEMOGCM/SETTE/sette_rpt.sh @ 9119

Last change on this file since 9119 was 6141, checked in by acc, 9 years ago

Branch 2015/dev_r5803_NOC_WAD. Merge in dev_merge_2015 changes up to 6136. Conflicts all resolved

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