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.
gen_report.sh in NEMO/trunk/tests/CPL_OASIS/EXPREF – NEMO

source: NEMO/trunk/tests/CPL_OASIS/EXPREF/gen_report.sh @ 13207

Last change on this file since 13207 was 12663, checked in by clevy, 4 years ago

Add CPL_OASIS test case, see #2379

  • Property svn:executable set to *
File size: 3.6 KB
Line 
1#!/bin/bash
2#set -vx
3# ncmax $var_nm $fl_nm : What is maximum of variable?
4function ncmax { ncap2 -O -C -v -s "foo=${1}.max();print(foo)" ${2} ~/foo.nc | cut -f 3- -d ' ' ; }
5# ncmin $var_nm $fl_nm : What is minimum of variable?
6function ncmin { ncap2 -O -C -v -s "foo=${1}.min();print(foo)" ${2} ~/foo.nc | cut -f 3- -d ' ' ; }
7# ncmdn $var_nm $fl_nm : What is median of variable?
8function ncmdn { ncap2 -O -C -v -s "foo=gsl_stats_median_from_sorted_data(${1}.sort());print(foo)" ${2} ~/foo.nc | cut -f 3- -d ' ' ; }
9
10##
11## simple report generator for the test case
12##
13
14##
15## Variables which may need to be adapted to your experiment:
16##
17#  RUNDIR = directory where the test case is executed: contains all outputs
18RUNDIR=/gpfswork/rech/omr/romr001/OUT/CPLTESTCASE/2020-03-31120816
19#  NB_NEMO_IT = expected total number of NEMO iterations
20NB_NEMO_IT=160
21#  NB_OASIS_OUTFILES = number of debug.root.0* OASIS output files
22NB_OASIS_OUTFILES=2
23##
24## END of variables to be checked - Nothing need to be changed below
25##
26# check if directory is here
27  if [ ! -d $RUNDIR ]; then
28    printf "%-27s %s %s\n" $RUNDIR  "directory does not exist. Check RUNDIR variable in script. Stop" 
29    return
30  fi
31
32cd $RUNDIR
33
34echo " "
35echo "Check results of test case in directory: " `pwd`
36echo " "
37##
38## Check if OASIS execution has been successful
39##
40echo "      OASIS successful (true if OASIS outputs in debug.root.0? includes SUCCESSFUL RUN)  : "
41count=0
42for file in debug.root.0*
43do
44  echo $file ; grep "SUCCESSFUL RUN" $file
45  count=`expr $count + 1`
46done
47echo "OASIS success checked on $count files"
48[ $count = $NB_OASIS_OUTFILES ] && echo true || echo false
49##
50## Check if NEMO execution has been sucessful
51##
52echo " "
53echo "      NEMO execution is successful if the run.stat file contains one line for each of NB_NEMO_IT iterations, indicating they have indeed been computed"
54 if [ ! -f ./run.stat ]; then
55   echo " the run.stat file does not exist: NEMO did not end its first time step"
56   echo " NEMO UNSUCESSFUL. Stop"
57   return
58 fi
59echo "From run.stat NEMO output file, NEMO has executed the 160 time steps:"
60nemo_iterations=`wc -l ./run.stat | awk {'print $1'} `; [ $nemo_iterations = $NB_NEMO_IT ] && echo true || echo false
61
62##
63## Check mean value of sst field seen by toyatm
64##
65 if [ ! -f ./ATSSTSST_toyatm_01.nc ]; then
66   echo " the ATSSTSST_toyatm_01.nc file does not exist: the test is not successful"
67   echo " Test case UNSUCESSFUL. Stop"
68   return
69 fi
70echo " "
71echo "Examining ATSSTSST variable sea surface temperature as seen by toyatm, unit is degree Kelvin (min. should be around 271., max. around 302., median around 280.)" 
72ASSTmin=`ncmin ATSSTSST ATSSTSST_toyatm_01.nc`
73ASSTmax=`ncmax ATSSTSST ATSSTSST_toyatm_01.nc` 
74ASSTmed=`ncmdn  ATSSTSST ATSSTSST_toyatm_01.nc`
75echo "Minimum value of ATSSTSST variable in ATSSTSST_toyatm_01.nc file = " $ASSTmin
76echo "Maximum value of ATSSTSST variable in ATSSTSST_toyatm_01.nc file = " $ASSTmax
77echo "Median value of ATSSTSST variable in ATSSTSST_toyatm_01.nc file = "  $ASSTmed
78MINMAX=0
79if [ ${ASSTmin%%.*} -lt 270 -o ${ASSTmax%%.*} -gt 310 ]; then
80echo " Min. or max. values of ATSSTSST do not look reasonable. Check the test again "
81MINMAX=1
82fi
83##
84## Summary
85##
86echo " " 
87if [ $count = $NB_OASIS_OUTFILES ] && [ $nemo_iterations = $NB_NEMO_IT ] && [ $MINMAX = 0 ] 
88then
89  echo " The run looks very succesful!"
90  echo " Have a look to the ASTSSTSST.nc file (using ncview for example): sea surface temperatures as seen by the toyatm and compare it to the reference file (CPL/ref_ATSSTSST_last_time_step.jpg) "
91  echo " Units are in degrees Kelvin and it will confirm the test is successful"
92  echo " "
93else
94  echo "The test case is unsuccessful. Check all inputs and outputs"
95fi
Note: See TracBrowser for help on using the repository browser.