1 | ###################### |
---|
2 | ## IRENE TGCC/CEA ## |
---|
3 | ###################### |
---|
4 | #MSUB -r MONITORING # Job name |
---|
5 | #MSUB -o MONITORING.out_%I |
---|
6 | #MSUB -e MONITORING.out_%I |
---|
7 | #MSUB -n 1 # Number of cores |
---|
8 | #MSUB -T 80000 # Maximum elapsed time |
---|
9 | #MSUB -q xlarge |
---|
10 | #MSUB -c 8 |
---|
11 | #MSUB -Q normal |
---|
12 | #MSUB -A scecmip6 |
---|
13 | #MSUB -m store,work,scratch |
---|
14 | set +x |
---|
15 | |
---|
16 | #************************************************************** |
---|
17 | # Author: Sebastien Denvil |
---|
18 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
19 | # $Revision:: 1468 $ Revision of last commit |
---|
20 | # $Author:: mafoipsl $ Author of last commit |
---|
21 | # $Date:: 2018-08-14 15:55:41 +0200 (Tue, 14 Aug 2018) $ Date of last commit |
---|
22 | # IPSL (2006) |
---|
23 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
24 | # |
---|
25 | #************************************************************** |
---|
26 | |
---|
27 | #set -eu |
---|
28 | #set -vx |
---|
29 | |
---|
30 | date |
---|
31 | |
---|
32 | |
---|
33 | #D- Task type DO NOT CHANGE (computing, post-processing or checking) |
---|
34 | TaskType=post-processing |
---|
35 | |
---|
36 | ######################################################################## |
---|
37 | |
---|
38 | #D- Flag to determine if this job in a standalone mode |
---|
39 | #D- Default : value from AA_job if any |
---|
40 | StandAlone=${StandAlone:=true} |
---|
41 | |
---|
42 | #D- Path to libIGCM |
---|
43 | #D- Default : value from AA_job if any |
---|
44 | # WARNING For StandAlone use : To run this script on some machine (ada and cesium) |
---|
45 | # WARNING you must check MirrorlibIGCM variable in sys library. |
---|
46 | # WARNING If this variable is true, you must use libIGCM_POST path instead |
---|
47 | # WARNING of your running libIGCM directory. |
---|
48 | libIGCM=${libIGCM:=/ccc/cont003/dsku/perle1/home/app/gencmip6/devillim/modipsl_v20fev/libIGCM} |
---|
49 | |
---|
50 | #D- Increased verbosity (1, 2, 3) |
---|
51 | #D- Default : value from AA_job if any |
---|
52 | Verbosity=${Verbosity:=3} |
---|
53 | |
---|
54 | #D- Low level debug : to bypass lib test checks and stack construction |
---|
55 | #D- Default : value from AA_job if any |
---|
56 | DEBUG_debug=${DEBUG_debug:=false} |
---|
57 | |
---|
58 | #D- TEMPORARY Flag to determine atmospheric resolution |
---|
59 | #D- Default : value from atmospheric driver if any |
---|
60 | RESOL_ATM=${RESOL_ATM:=ALL} |
---|
61 | |
---|
62 | #D- Flag to determine surface resolution |
---|
63 | #D- Default : value from surface driver if any |
---|
64 | RESOL_SRF=${RESOL_SRF:=ALL} |
---|
65 | |
---|
66 | #D- Flag to determine surface resolution |
---|
67 | #D- Default : value from surface driver if any |
---|
68 | RESOL_SBG=${RESOL_SBG:=ALL} |
---|
69 | |
---|
70 | #D- TEMPORARY Flag to determine ocean resolution |
---|
71 | #D- Default : value from ocean driver if any |
---|
72 | RESOL_OCE=${RESOL_OCE:=ORCA1} |
---|
73 | |
---|
74 | #D- TEMPORARY Flag to determine ice resolution |
---|
75 | #D- Default : value from ice driver if any |
---|
76 | RESOL_ICE=${RESOL_OCE:=ORCA1} |
---|
77 | |
---|
78 | #D- TEMPORARY Flag to determine marine biogeochemistry resolution |
---|
79 | #D- Default : value from ice driver if any |
---|
80 | RESOL_MBG=${RESOL_OCE:=ORCA1} |
---|
81 | |
---|
82 | ###################################################################### |
---|
83 | |
---|
84 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
85 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
86 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh |
---|
87 | #------- |
---|
88 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh |
---|
89 | . ${libIGCM}/libIGCM_config/libIGCM_config.ksh |
---|
90 | #------- |
---|
91 | RUN_DIR=${RUN_DIR_PATH} |
---|
92 | IGCM_sys_MkdirWork ${RUN_DIR} |
---|
93 | IGCM_sys_Cd ${RUN_DIR} |
---|
94 | #------- |
---|
95 | ( ${DEBUG_debug} ) && IGCM_debug_Check |
---|
96 | ( ${DEBUG_debug} ) && IGCM_card_Check |
---|
97 | ( ${DEBUG_debug} ) && IGCM_date_Check |
---|
98 | |
---|
99 | ###################################################################### |
---|
100 | |
---|
101 | #set -vx |
---|
102 | |
---|
103 | # ------------------------------------------------------------------ |
---|
104 | # Test if all was right before proceeding further |
---|
105 | # ------------------------------------------------------------------ |
---|
106 | IGCM_debug_Verif_Exit |
---|
107 | |
---|
108 | if [ ${StandAlone} = true ] ; then |
---|
109 | CARD_DIR=${SUBMIT_DIR} |
---|
110 | else |
---|
111 | CARD_DIR=${RUN_DIR} |
---|
112 | IGCM_sys_Get_Master ${SUBMIT_DIR}/config.card ${RUN_DIR_PATH} |
---|
113 | IGCM_sys_Get_Master ${SUBMIT_DIR}/run.card ${RUN_DIR_PATH} |
---|
114 | IGCM_sys_Get_Master ${SUBMIT_DIR}/COMP ${RUN_DIR_PATH} |
---|
115 | IGCM_sys_Get_Master ${SUBMIT_DIR}/POST ${RUN_DIR_PATH} |
---|
116 | fi |
---|
117 | |
---|
118 | #================================== |
---|
119 | # First of all |
---|
120 | # |
---|
121 | # Read libIGCM compatibility version in config.card |
---|
122 | # Read UserChoices section |
---|
123 | # Read Ensemble section |
---|
124 | # Read Post section |
---|
125 | # Define all netcdf output directories |
---|
126 | #================================== |
---|
127 | IGCM_config_CommonConfiguration ${CARD_DIR}/config.card |
---|
128 | |
---|
129 | # ------------------------------------------------------------------ |
---|
130 | # Activate BigBrother so as to supervise this job |
---|
131 | # ------------------------------------------------------------------ |
---|
132 | IGCM_debug_BigBro_Initialize |
---|
133 | |
---|
134 | #================================== |
---|
135 | # Read ListOfComponents section: |
---|
136 | IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents |
---|
137 | |
---|
138 | # Create R_FIGR that has been defined by IGCM_config_CommonConfiguration |
---|
139 | IGCM_sys_MkdirArchive ${R_FIGR} |
---|
140 | # |
---|
141 | IGCM_sys_TestDirArchive ${R_FIGR}/MONITORING |
---|
142 | if [ $? = 0 ] ; then |
---|
143 | IGCM_debug_Print 1 "Get MONITORING directory from archive" |
---|
144 | IGCM_sys_Get_Dir ${R_FIGR}/MONITORING ${RUN_DIR} |
---|
145 | else |
---|
146 | IGCM_debug_Print 1 "MONITORING first pass. Nothing has been done before" |
---|
147 | fi |
---|
148 | # -------------------------------------------- |
---|
149 | # Insert your commands between III...III lines |
---|
150 | # and precise produced directories to save |
---|
151 | # IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII |
---|
152 | |
---|
153 | for comp in ${config_ListOfComponents[*]} ; do |
---|
154 | IGCM_debug_Print 1 "################## Component: ${comp} ######################" |
---|
155 | liste_file_monitoring="" |
---|
156 | IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp} |
---|
157 | eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 |
---|
158 | |
---|
159 | PATH_monitoring_file="" |
---|
160 | eval monitoring_file=monitoring01_${compname}_\${RESOL_${comp}}.cfg > /dev/null 2>&1 |
---|
161 | if [[ -d ${CARD_DIR}/POST && -f ${CARD_DIR}/POST/${monitoring_file} ]] ; then |
---|
162 | PATH_monitoring_file=${CARD_DIR}/POST/${monitoring_file} |
---|
163 | elif [[ -d ${CARD_DIR}/POST && -f ${CARD_DIR}/POST/monitoring01_${compname}.cfg ]] ; then |
---|
164 | PATH_monitoring_file=${CARD_DIR}/POST/monitoring01_${compname}.cfg |
---|
165 | elif [ -f ${FER_ATLAS}/${monitoring_file} ] ; then |
---|
166 | PATH_monitoring_file=${FER_ATLAS}/${monitoring_file} |
---|
167 | else |
---|
168 | IGCM_debug_Print 1 "No monitoring file found for this component. Was expecting ${monitoring_file}" |
---|
169 | IGCM_debug_Print 1 "Step to next component" |
---|
170 | continue |
---|
171 | fi |
---|
172 | # |
---|
173 | if [ X${PATH_monitoring_file} != X"" ] ; then |
---|
174 | IGCM_debug_Print 1 "Monitoring file used : ${PATH_monitoring_file}" |
---|
175 | IGCM_debug_Print 1 "Determine which frequency of time series to be used." |
---|
176 | |
---|
177 | FreqTS=$( grep FreqTS ${PATH_monitoring_file} | grep -v \# | awk -F "=" '{print $2}' ) |
---|
178 | if [ X${FreqTS} = X ] ; then |
---|
179 | # Default frequency is MO |
---|
180 | FreqTS=MO |
---|
181 | fi |
---|
182 | |
---|
183 | IGCM_debug_Print 1 "Times series frequency to be used is ${FreqTS}" |
---|
184 | IGCM_debug_Print 1 "Determine which files we need." |
---|
185 | . monitoring01 -l2 --listcommand 'IGCM_sys_RshArchive_NoError ls' ${PATH_monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_${FreqTS} |
---|
186 | liste_file_monitoring=$( . monitoring01 -q -l2 --listcommand 'IGCM_sys_RshArchive_NoError ls' ${PATH_monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_${FreqTS} ) |
---|
187 | fi |
---|
188 | # |
---|
189 | if [ ! "X${liste_file_monitoring}" = X ] ; then |
---|
190 | IGCM_sys_Get /l liste_file_monitoring ${RUN_DIR} |
---|
191 | IGCM_debug_Print 1 "monitoring01 -c ${CARD_DIR} -p ${comp} --time -t \"${config_UserChoices_JobName} monitoring\" -o ${RUN_DIR}/MONITORING ${PATH_monitoring_file} ." |
---|
192 | IGCM_debug_Print 1 "monitoring01 starts ................................................." |
---|
193 | monitoring01 -c ${CARD_DIR} -p ${comp} --time -t "${config_UserChoices_JobName} monitoring" -o ${RUN_DIR}/MONITORING ${PATH_monitoring_file} . |
---|
194 | else |
---|
195 | IGCM_debug_Print 1 "No time series detected by this command :" |
---|
196 | IGCM_debug_Print 1 "monitoring01 -l2 --listcommand 'IGCM_sys_RshArchive_NoError ls' ${PATH_monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_${FreqTS}" |
---|
197 | . monitoring01 -l2 --listcommand 'IGCM_sys_RshArchive_NoError ls' ${PATH_monitoring_file} ${R_SAVE}/${comp}/Analyse/TS_${FreqTS} |
---|
198 | fi |
---|
199 | |
---|
200 | # Now do cleaning before starting with next component |
---|
201 | rm -f ${RUN_DIR}/*nc |
---|
202 | |
---|
203 | done |
---|
204 | |
---|
205 | # IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII |
---|
206 | |
---|
207 | # Save files |
---|
208 | IGCM_sys_Put_Dir MONITORING ${R_FIGR} |
---|
209 | |
---|
210 | # Dods copy |
---|
211 | if [ X${config_Post_DodsCopy} = XTRUE ] ; then |
---|
212 | IGCM_sys_Put_Dods MONITORING |
---|
213 | fi |
---|
214 | |
---|
215 | # Clean RUN_DIR_PATH (necessary for cesium and titane only) |
---|
216 | IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH} |
---|
217 | |
---|
218 | # ------------------------------------------------------------------ |
---|
219 | # Finalize BigBrother to inform that the jobs end |
---|
220 | # ------------------------------------------------------------------ |
---|
221 | IGCM_debug_BigBro_Finalize |
---|