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

source: branches/2015/dev_r5092_CNRS_SETTE/NEMOGCM/TRUST/trusting_func.sh @ 5355

Last change on this file since 5355 was 5355, checked in by nicolasmartin, 9 years ago

dev_r5092_CNRS_SETTE Many improvments

  • Property eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Rev URL
File size: 2.9 KB
Line 
1#!/bin/bash
2
3function mesg_make {
4    paste -d ';' mesg_*_${CFG_USER}_${CFG_ARCH}.txt > trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt
5    cat trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt
6}
7
8#=============================================
9function mesg_publish {
10 
11if [ $PUBLISH -eq 1 ]; then
12
13  if [ -f ${TEST_DIR}/trusting_${CFG_USER}_${CFG_ARCH}.txt ] ; then
14      tail -1 trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt >> ${TEST_DIR}/trusting_${CFG_USER}_${CFG_ARCH}.txt
15  else
16      cp      trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt    ${TEST_DIR}/trusting_${CFG_USER}_${CFG_ARCH}.txt
17  fi
18
19  cp trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt ${TEST_DIR}
20#  chmod o+r ${TEST_DIR}/trusting_${DATE_STR}_${CFG_USER}_${CFG_ARCH}.txt
21 
22#  rm -rf              ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF}
23#  cp -alf ${TEST_DIR} ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF}
24#  chmod o+rX          ${DIR_WORK}/../../dods/public/${LOGNAME}/trusting/${CONF_REF}
25 
26  # Send mail only when FAILED
27  if [[ $( grep 'FAILED' mesg_02_status_${CFG_USER}_${CFG_ARCH}.txt ) && ! -z $MAIL ]]; then
28      cat << END_MAIL > ${TEST_DIR}/trusting.mail
29XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
30Dear $USER,
31
32The trusting sequence for ${CONF_REF} has failed.
33Please consult http://webservices.ipsl.fr/trusting/
34
35Failed at step: `tail -n 1 mesg_03_step_${CFG_USER}_${CFG_ARCH}.txt`
36Directory : ${TEST_DIR}
37
38XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
39
40END_MAIL
41      mail -s "[trusting ${CONF_REF}] FAILED" $MAIL < ${TEST_DIR}/trusting.mail
42  fi
43
44fi
45
46}
47
48#=============================================
49function get_out {
50   cd ${TEST_DIR}
51        mesg_make; mesg_publish
52
53        # Add tar saved into {DIR_STOR}
54   find ${DIR_SCRA}/trusting/${CONF_REF}/* -prune -mtime +7 -exec /bin/rm -rf {} \; > /dev/null 2>&1
55        [ -f ${DIR_STOR}/${CONF_REF}.tar ] && \rm ${DIR_STOR}/${CONF_REF}.tar
56        tar -cf ${DIR_STOR}/${CONF_REF}.tar .
57
58        exit
59}
60
61#=============================================
62function 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#---------------------------------------------
73function 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 TracBrowser for help on using the repository browser.