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 5383 for branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh – NEMO

Ignore:
Timestamp:
2015-06-09T11:13:36+02:00 (9 years ago)
Author:
nicolasmartin
Message:

dev_r5092_CNRS_SETTE Add rebuild tool for comparing among other improvments & bugs

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh

    r5355 r5383  
    11#!/bin/bash 
    22 
    3 function mesg_make { 
     3 
     4diff_nc() { 
     5    stat=100; file1=$1; file2=$2 
     6 
     7    cdo diffv $file1 $file2 > out_tmp 
     8    ( [ $? -ne 0 ] && stat=100 ) || stat=$( grep -m 1 'records differ' out_tmp | awk -Fof '{print $1}' ) 
     9    [ -f out_tmp ] && rm out_tmp 
     10 
     11    return $stat 
     12}  
     13 
     14diff_restart() { 
     15    last_time_step=$( cat ${REFE_DIR}/time.step ) 
     16    result_final=0 
     17 
     18    echo 'Last time step: '${last_time_step} 
     19 
     20    for file in restart restart_ice restart_trc; do 
     21   printf ${TEST_DIR}'/*'${last_time_step}'_'${file}'.nc: ' 
     22 
     23   if [ $( find ${TEST_DIR} -name *${last_time_step}_$file.nc ) ]; then 
     24       ${NEMO_RBDN} -t $NPROC ${TEST_CONF} $(( ${last_time_step} + 1 )) 
     25       result=$( diff_nc ${TEST_DIR}/*${last_time_step}_$file.nc ${REFE_DIR}/*${last_time_step}_$file.nc ) 
     26       printf "cdo diffv $result\n" 
     27       (( result_final = result_final + result )) 
     28   else 
     29       printf "no restart files found for comparison\n" 
     30   fi 
     31 
     32    done 
     33 
     34    return ${result_final} 
     35} 
     36 
     37get_rel() { 
     38    for rel in $CDO $COMPILER $MPI $NETCDF; do 
     39                                arch_rel=$( echo $LOADEDMODULES | sed "s#.*$rel/\([^:]*\).*#\1#" ) 
     40   [ -z "${arch_rel}" ] && arch_rel=$( echo $PATH          | sed "s#.*$rel/\([^/]*\).*#\1#" ) 
     41#    [ $( echo $rel | grep $COMPILER ) ] && arch_rel=$( $rel --version | grep -m1 -o ' [0-9.]* ' >/dev/null ) 
     42   echo $rel ${arch_rel} >> model.log 
     43    done 
     44} 
     45 
     46get_rev() { 
     47    rev=0 
     48 
     49    for dir in ${DIR_XIOS}  ${NEMO_ARCH} ${NEMO_CONF} ${NEMO_ENGI} ${NEMO_EIOI} \ 
     50          ${NEMO_EFCM} ${NEMO_TRUS} ${NEMO_TCMP} ${NEMO_TRBD}               ; do 
     51   # For time being, just get revision number from XIOS 
     52   [ $dir == ${DIR_XIOS} ] && echo 'XIOS '$( svn info $dir | awk '(NR == 9) {print $NF}' ) >> model.log && continue 
     53   ${SVN_CMD} $dir 
     54   rev_loc=$( svn info $dir | awk '(NR == 9) {print $NF}' ) 
     55   (( ${rev_loc} >= $rev )) && rev=${rev_loc} 
     56    done 
     57 
     58    echo 'NEMO '$rev >> model.log 
     59} 
     60 
     61mesg_make() { 
    462    paste -d ';' mesg_*_${CFG_USER}_${CFG_ARCH}.txt > trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt 
    563    cat trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt 
    664} 
    765 
    8 #============================================= 
    9 function mesg_publish { 
     66mesg_publish() { 
    1067   
    1168if [ $PUBLISH -eq 1 ]; then 
     
    43100 
    44101fi 
    45  
    46102} 
    47103 
    48 #============================================= 
    49 function get_out { 
     104get_out() { 
    50105   cd ${TEST_DIR} 
    51106        mesg_make; mesg_publish 
     
    58113        exit 
    59114} 
    60  
    61 #============================================= 
    62 function diff_nc { 
    63     stat=100; file1=$1; file2=$2 
    64  
    65     cdo diffv $file1 $file2 > out_tmp 
    66     ( [ $? -ne 0 ] && stat=100 ) || stat=$( grep -m 1 'records differ' out_tmp | awk -Fof '{print $1}' ) 
    67     [ -f out_tmp ] && rm out_tmp 
    68  
    69     return $stat 
    70 }  
    71  
    72 #--------------------------------------------- 
    73 function diff_restart { 
    74     last_time_step=$( cat ${REFE_DIR}/time.step ) 
    75     result_final=0 
    76  
    77     echo 'Last time step: '${last_time_step} 
    78  
    79     if [ $( find ${REFE_DIR} -name *restart*_${last_time_step}.nc ) ]; then 
    80  
    81    for file in find ${REFE_DIR} -name *restart*_${last_time_step}.nc; do 
    82        echo ${TEST_DIR}'/*'${file}'_'${last_time_step}'.nc: ' 
    83        result=$( diff_nc $file ) 
    84        printf "diffnc $result\n" 
    85        (( result_final = result_final + result )) 
    86    done 
    87  
    88     else 
    89    echo 'No restart files found for comparison' 
    90     fi 
    91  
    92     return ${result_final} 
    93 } 
Note: See TracChangeset for help on using the changeset viewer.