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.
Changeset 8468 for trunk/NEMOGCM/SETTE/sette_rpt.sh – NEMO

Ignore:
Timestamp:
2017-08-28T16:32:29+02:00 (7 years ago)
Author:
flavoni
Message:

#1936: add in sette_rpt.sh difference of SAS restart_ice files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/NEMOGCM/SETTE/sette_rpt.sh

    r7715 r8468  
    11#!/bin/bash -f 
     2#set -vx 
    23# 
    34# simple SETTE report generator. 
     
    1011######################### Start of function definitions ################################# 
    1112## 
     13 
     14function restfile() { 
     15# Rebuild ice restart for SAS CONFIG, and restartability checks. Expects LONG and SHORT run directories. 
     16# For Stand Alone Surface configuration ocean is not running, just run ice model; so no outputs ocean files. 
     17# Compares LONG rebuild restart ice file with equivalent entry from the SHORT rebuild restart ice file. 
     18# 
     19  vdir=$1 
     20  nam=$2 
     21  pass=$3 
     22# 
     23  if [ -d $vdir/$nam ]; then 
     24    dorv=`ls -1rt $vdir/$nam/$mach/ | tail -1l ` 
     25    dorv=`echo $dorv | sed -e 's:.*/::'` 
     26    rep1=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -2l | head -1 ` 
     27    rep2=`ls -1rt $vdir/$nam/$mach/$dorv/ | tail -1l` 
     28    cd ${SAS_RESTART_DIR}/LONG 
     29    #SF add here compilation of rebuild_tools to rebuild restart files, and add comparison of restart files 
     30    cd ${TOOLS_DIR} 
     31    ./maketools -n REBUILD_NEMO -m ${mach} > /dev/null 2>&1 
     32    cd ${TOOLS_DIR}/REBUILD_NEMO 
     33    #SF echo "REBUILD LONG restart SAS files, without standard output" 
     34    ./rebuild_nemo -t 4 ../../CONFIG/SAS_LONG/LONG/SAS_00000100_restart_ice  $NPROC > /dev/null 2>&1 
     35    #SF echo "REBUILD SHORT restart SAS files, without standard output" 
     36    ./rebuild_nemo -t 4 ../../CONFIG/SAS_LONG/SHORT/SAS_00000100_restart_ice $NPROC >&- 
     37    cd ${SAS_RESTART_DIR}/LONG 
     38    #SF echo "COPY rebuild restart files" 
     39    cp SAS_00000100_restart_ice.nc $vdir/$nam/$mach/$dorv/LONG/. 
     40    cp ../SHORT/SAS_00000100_restart_ice.nc $vdir/$nam/$mach/$dorv/SHORT/. 
     41 
     42    f1o=$vdir/$nam/$mach/$dorv/LONG/SAS_00000100_restart_ice.nc 
     43    f2o=$vdir/$nam/$mach/$dorv/SHORT/SAS_00000100_restart_ice.nc 
     44    if  [ ! -f $f1o ] &&  [ ! -f $f2o ] ; then 
     45      printf "%-20s %s\n" $nam " REBUILD SAS restart ice DOES NOT exists; incomplete test"; 
     46      return; 
     47    fi 
     48    # 
     49    done_oce=0 
     50    # 
     51    if  [  -f $f1o ] && [  -f $f2o ]; then 
     52      cmp -s $f1o $f2o  
     53      #SF  cmp SAS_00000100_restart_ice.nc  ../SHORT/SAS_00000100_restart_ice.nc  > diff_restart.txt 
     54      if [ $? == 0 ]; then 
     55        if [ $pass == 0 ]; then 
     56          printf "%-20s %s %s\n" $nam  " SAS restart files are IDENTICAL :  passed : " $dorv 
     57        fi 
     58      else 
     59        printf "%-20s %s %s\n" $nam  " SAS restart files are DIFFERENT : FAILED : " $dorv  
     60        # 
     61   # Offer view of differences on the second pass 
     62   # 
     63        if [ $pass == 1 ]; then 
     64          echo "BE CAREFUL:  NEED cdo to see differences!!!!! IF it is not the case you need to do difference of netcdf file by hand" 
     65          echo "<return> to view restart_ice.nc differences" 
     66          read y 
     67          cdo -diffv $f1o $f2o 
     68          done_oce=1 
     69          #echo "<return> to continue" 
     70          #read y 
     71        fi 
     72      fi 
     73    fi 
     74# 
     75fi 
     76} 
     77 
    1278function resttest() {  
    1379# 
     
    199265  mach=`grep "COMPILER=" ./sette.sh | sed -e 's/COMPILER=//'` 
    200266  NEMO_VALID=`grep "NEMO_VALIDATION_DIR=" ./param.cfg | sed -e 's/NEMO_VALIDATION_DIR=//'` 
     267# Directory to run the tests 
     268 SETTE_DIR=$(cd $(dirname "$0"); pwd) 
     269 MAIN_DIR=$(dirname $SETTE_DIR) 
     270 CONFIG_DIR0=${MAIN_DIR}/CONFIG 
     271 TOOLS_DIR=${MAIN_DIR}/TOOLS 
     272 COMPIL_DIR=${TOOLS_DIR}/COMPILE 
     273 NPROC=32 
     274 
     275  SAS_RESTART_DIR=${CONFIG_DIR0}/SAS_LONG 
    201276# 
    202277  if [ ! -d $NEMO_VALID ]; then 
     
    205280  fi 
    206281# 
     282 
    207283# The script also needs the date or revision tag. Currently this is taken from the latest sub-directory found in each directory 
    208284 
     
    212288 if [ $pass == 1 ]; then echo "---------------2nd pass------------------";fi 
    213289# 
     290 
     291# Rebuild and restartability test for SAS 
     292# 
     293 for restart_file in WSAS_LONG 
     294 do 
     295 #  restfile $SAS_RESTART_DIR LONG $pass 
     296   restfile $NEMO_VALID $restart_file $pass 
     297 done 
     298# 
    214299# Restartability test 
    215300# 
    216  for restart_test in WGYREPIS_LONG WORCA2LIM3PIS_LONG WORCA2OFFPIS_LONG WAMM12_LONG WSAS_LONG WISOMIP_LONG WORCA2AGUL_LONG 
     301 for restart_test in WGYREPIS_LONG WORCA2LIM3PIS_LONG WORCA2OFFPIS_LONG WAMM12_LONG WISOMIP_LONG WORCA2AGUL_LONG 
    217302 do 
    218303   resttest $NEMO_VALID $restart_test $pass 
Note: See TracChangeset for help on using the changeset viewer.