[622] | 1 | #-Q- curie ###################### |
---|
| 2 | #-Q- curie ## CURIE TGCC/CEA ## |
---|
| 3 | #-Q- curie ###################### |
---|
[837] | 4 | #-Q- curie #MSUB -r PACKOUTPUT # Nom du job |
---|
[1468] | 5 | #-Q- curie #MSUB -o PACKOUTPUT.out_%I |
---|
| 6 | #-Q- curie #MSUB -e PACKOUTPUT.out_%I |
---|
[622] | 7 | #-Q- curie #MSUB -n 1 # Reservation du processus |
---|
[880] | 8 | #-Q- curie #MSUB -T 36000 # Limite de temps elapsed du job |
---|
[1154] | 9 | #-Q- curie #MSUB -q ::default_node:: |
---|
[1274] | 10 | #-Q- curie #MSUB -c ::default_core:: |
---|
[704] | 11 | #-Q- curie #MSUB -Q normal |
---|
[837] | 12 | #-Q- curie #MSUB -A ::default_project:: |
---|
[681] | 13 | #-Q- curie set +x |
---|
[1433] | 14 | #-Q- irene ###################### |
---|
| 15 | #-Q- irene ## IRENE TGCC/CEA ## |
---|
| 16 | #-Q- irene ###################### |
---|
| 17 | #-Q- irene #MSUB -r PACKOUTPUT # Job name |
---|
[1468] | 18 | #-Q- irene #MSUB -o PACKOUTPUT.out_%I |
---|
| 19 | #-Q- irene #MSUB -e PACKOUTPUT.out_%I |
---|
[1433] | 20 | #-Q- irene #MSUB -n 1 # Number of cores |
---|
| 21 | #-Q- irene #MSUB -T 36000 # Maximum elapsed time |
---|
[1468] | 22 | #-Q- irene #MSUB -q ::default_node:: |
---|
[1465] | 23 | #-Q- irene #MSUB -c ::default_core:: |
---|
[1433] | 24 | #-Q- irene #MSUB -Q normal |
---|
[1468] | 25 | #-Q- irene #MSUB -A ::default_post_project:: |
---|
[1460] | 26 | #-Q- irene #MSUB -m store,work,scratch |
---|
[1433] | 27 | #-Q- irene set +x |
---|
[1525] | 28 | #-Q- irene-amd ###################### |
---|
| 29 | #-Q- irene-amd ## IRENE TGCC/CEA ## |
---|
| 30 | #-Q- irene-amd ###################### |
---|
| 31 | #-Q- irene-amd #MSUB -r PACKOUTPUT # Job name |
---|
| 32 | #-Q- irene-amd #MSUB -o PACKOUTPUT.out_%I |
---|
| 33 | #-Q- irene-amd #MSUB -e PACKOUTPUT.out_%I |
---|
| 34 | #-Q- irene-amd #MSUB -n 1 # Number of cores |
---|
| 35 | #-Q- irene-amd #MSUB -T 36000 # Maximum elapsed time |
---|
| 36 | #-Q- irene-amd #MSUB -q ::default_node:: |
---|
| 37 | #-Q- irene-amd #MSUB -c ::default_core:: |
---|
| 38 | #-Q- irene-amd #MSUB -Q normal |
---|
| 39 | #-Q- irene-amd #MSUB -A ::default_post_project:: |
---|
| 40 | #-Q- irene-amd #MSUB -m store,work,scratch |
---|
| 41 | #-Q- irene-amd set +x |
---|
[1491] | 42 | #-Q- jeanzay #!/bin/ksh |
---|
| 43 | #-Q- jeanzay ###################### |
---|
| 44 | #-Q- jeanzay ## JEANZAY IDRIS ## |
---|
| 45 | #-Q- jeanzay ###################### |
---|
| 46 | #-Q- jeanzay #SBATCH --job-name=PACKOUTPUT # Job Name |
---|
[1501] | 47 | #-Q- jeanzay #SBATCH --output=PACKOUTPUT.out_%J # standard output |
---|
| 48 | #-Q- jeanzay #SBATCH --error=PACKOUTPUT.out_%J # error output |
---|
[1494] | 49 | #-Q- jeanzay #SBATCH -N 1 # Number of core |
---|
| 50 | #-Q- jeanzay #SBATCH --partition=prepost # Post-processing partition |
---|
[1491] | 51 | #-Q- jeanzay #SBATCH --time=10:00:00 # Wall clock limit (seconds) |
---|
| 52 | #-Q- jeanzay #SBATCH --account ::default_project::@cpu |
---|
| 53 | #-Q- jeanzay set +x |
---|
[770] | 54 | #-Q- ada #!/bin/ksh |
---|
| 55 | #-Q- ada ####################### |
---|
[929] | 56 | #-Q- ada ## ADA IDRIS ## |
---|
[770] | 57 | #-Q- ada ####################### |
---|
[1409] | 58 | #-Q- ada # @ job_type = mpich |
---|
[848] | 59 | #-Q- ada # @ requirements = (Feature == "prepost") |
---|
[770] | 60 | #-Q- ada # Temps Elapsed max. d'une requete hh:mm:ss |
---|
| 61 | #-Q- ada # @ wall_clock_limit = 10:00:00 |
---|
[1334] | 62 | #-Q- ada # Memory required for ncrcat |
---|
| 63 | #-Q- ada # @ as_limit = 30Gb |
---|
[770] | 64 | #-Q- ada # Nom du travail LoadLeveler |
---|
| 65 | #-Q- ada # @ job_name = PACKOUTPUT |
---|
| 66 | #-Q- ada # Fichier de sortie standard du travail |
---|
| 67 | #-Q- ada # @ output = $(job_name).$(jobid) |
---|
| 68 | #-Q- ada # Fichier de sortie d'erreur du travail |
---|
| 69 | #-Q- ada # @ error = $(job_name).$(jobid) |
---|
| 70 | #-Q- ada # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) |
---|
| 71 | #-Q- ada # @ notification = error |
---|
[1290] | 72 | #-Q- ada # @ environment = $DEBUG_debug ; $BigBrother ; $postProcessingStopLevel ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $POST_DIR ; $Script_Post_Output ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER ; wall_clock_limit=$(wall_clock_limit) |
---|
[770] | 73 | #-Q- ada # @ queue |
---|
[1568] | 74 | #-Q- obelix ###################### |
---|
| 75 | #-Q- obelix ## OBELIX LSCE ## |
---|
| 76 | #-Q- obelix ###################### |
---|
| 77 | #-Q- obelix #PBS -N PACKOUTPUT |
---|
| 78 | #-Q- obelix #PBS -m a |
---|
| 79 | #-Q- obelix #PBS -j oe |
---|
| 80 | #-Q- obelix #PBS -q medium |
---|
| 81 | #-Q- obelix #PBS -o PACKOUTPUT.$$ |
---|
| 82 | #-Q- obelix #PBS -S /bin/ksh |
---|
[1184] | 83 | #-Q- ifort_CICLAD ###################### |
---|
| 84 | #-Q- ifort_CICLAD ## CICLAD IPSL ## |
---|
| 85 | #-Q- ifort_CICLAD ###################### |
---|
| 86 | #-Q- ifort_CICLAD #PBS -N PACKOUTPUT |
---|
| 87 | #-Q- ifort_CICLAD #PBS -m a |
---|
| 88 | #-Q- ifort_CICLAD #PBS -j oe |
---|
| 89 | #-Q- ifort_CICLAD #PBS -q std |
---|
| 90 | #-Q- ifort_CICLAD #PBS -S /bin/ksh |
---|
[583] | 91 | #-Q- default #!/bin/ksh |
---|
| 92 | #-Q- default ################## |
---|
| 93 | #-Q- default ## DEFAULT HOST ## |
---|
| 94 | #-Q- default ################## |
---|
| 95 | |
---|
| 96 | #************************************************************** |
---|
| 97 | # Author: Sebastien Denvil |
---|
| 98 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
| 99 | # $Revision:: $ Revision of last commit |
---|
| 100 | # $Author:: $ Author of last commit |
---|
| 101 | # $Date:: $ Date of last commit |
---|
| 102 | # IPSL (2006) |
---|
| 103 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 104 | # |
---|
| 105 | #************************************************************** |
---|
| 106 | |
---|
| 107 | #set -eu |
---|
| 108 | #set -vx |
---|
| 109 | |
---|
| 110 | date |
---|
| 111 | |
---|
[1356] | 112 | #D- Task type DO NOT CHANGE (computing, post-processing or checking) |
---|
[712] | 113 | TaskType=post-processing |
---|
| 114 | |
---|
[583] | 115 | ######################################################################## |
---|
| 116 | |
---|
| 117 | #D- Flag to determine if this job in a standalone mode |
---|
| 118 | #D- Default : value from AA_job if any |
---|
| 119 | StandAlone=${StandAlone:=true} |
---|
| 120 | |
---|
| 121 | #D- Path to libIGCM |
---|
| 122 | #D- Default : value from AA_job if any |
---|
| 123 | # WARNING For StandAlone use : To run this script on some machine (ulam and cesium) |
---|
| 124 | # WARNING you must check MirrorlibIGCM variable in sys library. |
---|
| 125 | # WARNING If this variable is true, you must use libIGCM_POST path instead |
---|
| 126 | # WARNING of your running libIGCM directory. |
---|
| 127 | libIGCM=${libIGCM:=::modipsl::/libIGCM} |
---|
| 128 | |
---|
| 129 | #-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer. |
---|
[928] | 130 | MASTER=${MASTER:=ada|curie} |
---|
[583] | 131 | |
---|
| 132 | #D- Flag to determine begin date for restart pack |
---|
| 133 | #D- Default : value from AA_job if any |
---|
| 134 | DateBegin=${DateBegin:=20000101} |
---|
| 135 | |
---|
| 136 | #D- Flag to determine end date for restart pack |
---|
| 137 | #D- Default : value from AA_job if any |
---|
| 138 | DateEnd=${DateEnd:=20691231} |
---|
| 139 | |
---|
| 140 | #D- Flag to determine pack period |
---|
| 141 | #D- Default : value from AA_job if any |
---|
| 142 | PeriodPack=${PeriodPack:=10Y} |
---|
| 143 | |
---|
| 144 | #D- Uncomment to run interactively |
---|
| 145 | #D- For testing purpose, will be remove |
---|
| 146 | #SUBMIT_DIR=${PWD} |
---|
| 147 | #RUN_DIR_PATH=${SCRATCHDIR}/Pack_Test |
---|
| 148 | |
---|
| 149 | #D- Increased verbosity (1, 2, 3) |
---|
| 150 | #D- Default : value from AA_job if any |
---|
| 151 | Verbosity=${Verbosity:=3} |
---|
| 152 | |
---|
| 153 | #D- Low level debug : to bypass lib test checks and stack construction |
---|
| 154 | #D- Default : value from AA_job if any |
---|
| 155 | DEBUG_debug=${DEBUG_debug:=false} |
---|
| 156 | |
---|
[1603] | 157 | #D- Surpack_mode : to pack existing packs output files |
---|
| 158 | #D- Default : n |
---|
| 159 | surpack_mode=n |
---|
| 160 | |
---|
[1612] | 161 | #D- Needed to define this variable in order to handle exit in case of error |
---|
| 162 | Script_Post_Output=${Script_Post_Output:=pack_output} |
---|
| 163 | |
---|
[583] | 164 | ######################################################################## |
---|
| 165 | |
---|
| 166 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 167 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
| 168 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh |
---|
| 169 | #------- |
---|
| 170 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh |
---|
[731] | 171 | . ${libIGCM}/libIGCM_config/libIGCM_config.ksh |
---|
[583] | 172 | . ${libIGCM}/libIGCM_post/libIGCM_post.ksh |
---|
[832] | 173 | #------- |
---|
[1192] | 174 | RUN_DIR=${RUN_DIR_PATH} |
---|
| 175 | IGCM_sys_MkdirWork ${RUN_DIR} |
---|
| 176 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 177 | #------- |
---|
[832] | 178 | ( ${DEBUG_debug} ) && IGCM_debug_Check |
---|
| 179 | ( ${DEBUG_debug} ) && IGCM_card_Check |
---|
| 180 | ( ${DEBUG_debug} ) && IGCM_date_Check |
---|
[583] | 181 | |
---|
| 182 | ######################################################################## |
---|
| 183 | |
---|
| 184 | #set -vx |
---|
| 185 | |
---|
| 186 | # ------------------------------------------------------------------ |
---|
| 187 | # Test if all was right before proceeding further |
---|
| 188 | # ------------------------------------------------------------------ |
---|
[1206] | 189 | IGCM_debug_Verif_Exit |
---|
[583] | 190 | |
---|
| 191 | if [ ${StandAlone} = true ] ; then |
---|
| 192 | CARD_DIR=${SUBMIT_DIR} |
---|
| 193 | else |
---|
[647] | 194 | CARD_DIR=${RUN_DIR_PATH} |
---|
[640] | 195 | IGCM_sys_Get_Master ${SUBMIT_DIR}/config.card ${RUN_DIR_PATH} |
---|
| 196 | IGCM_sys_Get_Master ${SUBMIT_DIR}/run.card ${RUN_DIR_PATH} |
---|
| 197 | IGCM_sys_Get_Master ${SUBMIT_DIR}/COMP ${RUN_DIR_PATH} |
---|
| 198 | IGCM_sys_Get_Master ${SUBMIT_DIR}/POST ${RUN_DIR_PATH} |
---|
[583] | 199 | fi |
---|
| 200 | |
---|
[727] | 201 | #================================== |
---|
[583] | 202 | # First of all |
---|
| 203 | # |
---|
[727] | 204 | # Read libIGCM compatibility version in config.card |
---|
| 205 | # Read UserChoices section |
---|
| 206 | # Read Ensemble section |
---|
| 207 | # Read Post section |
---|
| 208 | # Define all netcdf output directories |
---|
| 209 | #================================== |
---|
| 210 | IGCM_config_CommonConfiguration ${CARD_DIR}/config.card |
---|
[583] | 211 | |
---|
[1198] | 212 | # ------------------------------------------------------------------ |
---|
| 213 | # Activate BigBrother so as to supervise this job |
---|
| 214 | # ------------------------------------------------------------------ |
---|
| 215 | IGCM_debug_BigBro_Initialize |
---|
| 216 | |
---|
[727] | 217 | #================================== |
---|
| 218 | # Read ListOfComponents section |
---|
| 219 | # to drive the loop over find |
---|
| 220 | IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents |
---|
[1198] | 221 | |
---|
| 222 | #================================== |
---|
| 223 | # Test and set up directories |
---|
| 224 | #================================== |
---|
[583] | 225 | IGCM_sys_TestDirArchive ${R_SAVE} |
---|
| 226 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
| 227 | |
---|
| 228 | # Where to store used file list /!\ TEMPORARY /!\ |
---|
| 229 | STORE_DEBUG=${R_SAVE}/DEBUG |
---|
| 230 | |
---|
| 231 | # Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure) |
---|
| 232 | JobName=${config_UserChoices_JobName} |
---|
[590] | 233 | echo $JobName $DateBegin $DateEnd |
---|
[583] | 234 | |
---|
| 235 | # ------------------------------------------------------------------ |
---|
| 236 | # Test if all was right before proceeding further |
---|
| 237 | # ------------------------------------------------------------------ |
---|
[1206] | 238 | IGCM_debug_Verif_Exit |
---|
[583] | 239 | |
---|
| 240 | # Init loop |
---|
| 241 | date_begin_pack=${DateBegin} |
---|
| 242 | date_end_simulation=${DateEnd} |
---|
| 243 | number_pack=1 |
---|
| 244 | |
---|
| 245 | IGCM_debug_PrintVariables 3 date_begin_pack |
---|
| 246 | IGCM_debug_PrintVariables 3 date_end_simulation |
---|
| 247 | |
---|
[1603] | 248 | # Loop over components |
---|
| 249 | for comp in ${config_ListOfComponents[*]} ; do |
---|
[583] | 250 | |
---|
[1603] | 251 | IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp} |
---|
| 252 | eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 |
---|
| 253 | card=${SUBMIT_DIR}/COMP/${compname}.card |
---|
| 254 | # |
---|
| 255 | if [ X${surpack_mode} = Xy ] ; then |
---|
| 256 | dirList=$( find ${R_SAVE}/${comp}/Output -maxdepth 1 -mindepth 1 -type d ) |
---|
| 257 | else |
---|
[584] | 258 | dirList=$( find ${R_BUFR}/${comp}/Output -maxdepth 1 -mindepth 1 -type d ) |
---|
[1603] | 259 | fi |
---|
| 260 | # Loop over directories containing output files |
---|
[584] | 261 | for dir in ${dirList} ; do |
---|
[583] | 262 | # dirID is like ATM.Output.MO |
---|
| 263 | dirID=$( echo $dir | sed "s:${R_BUFR}/::" | sed "s:/:.:g" ) |
---|
| 264 | # Sort what's in the directory |
---|
| 265 | find ${dir} -type f -name "${JobName}*.nc" -ls | sort -k 11 > liste_files.${dirID}.txt |
---|
| 266 | # How much file type. Example : 1M_histmthCOSP.nc, 1M_histmth.nc, 1M_histmthNMC.nc, 1M_paramLMDZ_phy.nc |
---|
| 267 | # /!\ fileType include the .nc extension /!\ |
---|
| 268 | fileType=$( gawk '{print $11}' liste_files.${dirID}.txt | gawk -F$dir/ '{print $2}' | sed "s:${JobName}_[0-9]\{8,9\}_[0-9]\{8,9\}_::g" | sort | uniq ) |
---|
| 269 | # Loop over the file type and pack them when in between date_begin_pack and date_end_pack |
---|
| 270 | for myType in ${fileType} ; do |
---|
[1603] | 271 | # Read comp.card and find specific pack period for each type of file |
---|
| 272 | IGCM_card_DefineArrayFromOption ${card} OutputFiles List |
---|
| 273 | ListFilesName=${compname}_OutputFiles_List |
---|
| 274 | eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 |
---|
| 275 | |
---|
| 276 | if [ X${FileName0} != X${NULL_STR} ] ; then |
---|
| 277 | eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 |
---|
| 278 | |
---|
| 279 | (( i=0 )) |
---|
| 280 | until [ $i -ge $NbFiles ]; do |
---|
| 281 | (( i_ = i+1 )) |
---|
| 282 | eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 |
---|
| 283 | eval file_out=${file_out_} |
---|
| 284 | (( i_ = i+3 )) |
---|
| 285 | eval Testvar_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 |
---|
| 286 | eval Testvar=${Testvar_} |
---|
| 287 | if [[ ${Testvar} =~ [0-9][DMY]$ ]] ; then |
---|
| 288 | eval PeriodPack_FileType=${Testvar} |
---|
| 289 | ((i = i+4)) |
---|
| 290 | else |
---|
| 291 | PeriodPack_FileType=${PeriodPack} |
---|
| 292 | ((i = i+3)) |
---|
| 293 | fi |
---|
| 294 | if [[ ${file_out} =~ ${myType} ]] ; then |
---|
| 295 | break |
---|
| 296 | fi |
---|
| 297 | done |
---|
| 298 | fi |
---|
| 299 | IGCM_debug_Print 1 "Check coherence between PackFrequency and PeriodLength" |
---|
| 300 | IGCM_post_CheckModuloFrequency PeriodPack_FileType config_UserChoices_PeriodLength NbPeriodPerFrequency |
---|
| 301 | # ------------------------------------------------------------------ |
---|
| 302 | # Test if all was right before proceeding further |
---|
| 303 | # ------------------------------------------------------------------ |
---|
| 304 | IGCM_debug_Verif_Exit |
---|
| 305 | # Initialize date_begin_pack |
---|
| 306 | date_begin_pack=${DateBegin} |
---|
| 307 | # Loop over period pack |
---|
| 308 | while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do |
---|
| 309 | DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack_FileType} ) |
---|
| 310 | date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) ) |
---|
| 311 | # |
---|
[590] | 312 | grep ${myType} liste_files.${dirID}.txt > liste_files.${dirID}.${myType}.txt |
---|
| 313 | nbfile=0 |
---|
[1603] | 314 | # If no surpack, no need to demigrate. |
---|
| 315 | if [ X${surpack_mode} = Xn ] ; then |
---|
[590] | 316 | for file in $( gawk '{print $11}' liste_files.${dirID}.${myType}.txt ); do |
---|
| 317 | extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) |
---|
| 318 | date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) |
---|
| 319 | # echo pack n°${number_pack} ${date_file} ${date_begin_pack} ${date_end_pack} |
---|
[1603] | 320 | # Ajouter un test sur la date |
---|
[590] | 321 | if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then |
---|
[617] | 322 | echo ${file} >> liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt |
---|
| 323 | ncdump -h ${file} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> liste_variables_${myType}_${date_begin_pack}_${date_end_pack}.txt |
---|
[590] | 324 | (( nbfile = nbfile + 1 )) |
---|
| 325 | fi |
---|
| 326 | done |
---|
[1603] | 327 | else |
---|
| 328 | for file in $( gawk '{print $11}' liste_files.${dirID}.${myType}.txt ); do |
---|
| 329 | extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) |
---|
| 330 | date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) |
---|
| 331 | # echo pack n°${number_pack} ${date_file} ${date_begin_pack} ${date_end_pack} |
---|
| 332 | # Ajouter un test sur la date |
---|
| 333 | if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then |
---|
| 334 | echo ${file} >> liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt |
---|
| 335 | (( nbfile = nbfile + 1 )) |
---|
| 336 | fi |
---|
| 337 | done |
---|
| 338 | # If surpack_mode, archive demigration is needed on TGCC |
---|
| 339 | #-Q- irene-amd ccc_hsm get $( cat liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt ) |
---|
| 340 | #-Q- irene ccc_hsm get $( cat liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt ) |
---|
| 341 | for file in $( gawk '{print $11}' liste_files.${dirID}.${myType}.txt ); do |
---|
| 342 | extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) |
---|
| 343 | date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) |
---|
| 344 | # echo pack n°${number_pack} ${date_file} ${date_begin_pack} ${date_end_pack} |
---|
| 345 | # Ajouter un test sur la date |
---|
| 346 | if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then |
---|
| 347 | ncdump -h ${file} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> liste_variables_${myType}_${date_begin_pack}_${date_end_pack}.txt |
---|
| 348 | fi |
---|
| 349 | done |
---|
| 350 | fi |
---|
[656] | 351 | |
---|
[718] | 352 | if [ ${nbfile} = 0 ] ; then |
---|
| 353 | IGCM_debug_Print 1 "We found no file to process" |
---|
[656] | 354 | IGCM_debug_Print 1 "We should have found ${NbPeriodPerFrequency} files" |
---|
[718] | 355 | IGCM_debug_Print 1 "As some files can be produced only for some selected period we consider we can move to the next file type" |
---|
[1603] | 356 | date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) |
---|
| 357 | continue |
---|
| 358 | fi |
---|
| 359 | if [ X${surpack_mode} = Xy ] && [ ${nbfile} = 1 ] ; then |
---|
| 360 | IGCM_debug_Print 1 "Only 1 file to pack in surpack mode, nothing to be done" |
---|
| 361 | date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) |
---|
[656] | 362 | continue |
---|
| 363 | fi |
---|
[653] | 364 | # Select list of variables to work with |
---|
| 365 | list_var=$( cat liste_variables_${myType}_${date_begin_pack}_${date_end_pack}.txt | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 != nbfile) {print $2}}' | paste -s -d ',' ) |
---|
| 366 | liste_file_tmp=$( for i in $( cat liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt ) ; do basename $i ; done ) |
---|
| 367 | # Create packed files |
---|
| 368 | IGCM_debug_Print 1 "Ncrcat ongoing for ${dir} and ${myType}" |
---|
[1603] | 369 | if [ X${surpack_mode} = Xn ] ; then |
---|
[641] | 370 | if [ ! ${nbfile} = ${NbPeriodPerFrequency} ] ; then |
---|
| 371 | IGCM_debug_Print 1 "Number of files to process is not equal to what it should be" |
---|
[653] | 372 | IGCM_debug_Print 1 "We found ${nbfile} files and it should have been ${NbPeriodPerFrequency} files" |
---|
[641] | 373 | IGCM_debug_Exit "ERROR in number of files to process. STOP HERE INCLUDING THE COMPUTING JOB" |
---|
| 374 | IGCM_debug_Verif_Exit |
---|
| 375 | fi |
---|
[1603] | 376 | fi |
---|
[590] | 377 | output=${JobName}_${date_begin_pack}_${date_end_pack}_${myType} |
---|
[617] | 378 | #cat liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt | xargs ncrcat -v ${list_var} -o ${output} |
---|
[590] | 379 | if [ X${list_var} = X ] ; then |
---|
| 380 | IGCM_sys_ncrcat -p ${dir} ${liste_file_tmp} --output ${output} |
---|
| 381 | else |
---|
| 382 | IGCM_sys_ncrcat -x -v ${list_var} -p ${dir} ${liste_file_tmp} --output ${output} |
---|
| 383 | fi |
---|
| 384 | # ------------------------------------------------------------------ |
---|
[583] | 385 | # Test if all was right before proceeding further |
---|
| 386 | # ------------------------------------------------------------------ |
---|
[1206] | 387 | IGCM_debug_Verif_Exit |
---|
[583] | 388 | # Save it |
---|
[1603] | 389 | if [ X${surpack_mode} = Xy ] ; then |
---|
| 390 | IGCM_sys_Put_Out ${output} ${R_SAVE}/$( echo $dir | sed "s:${R_SAVE}/::" )/${output} |
---|
| 391 | else |
---|
[590] | 392 | IGCM_sys_Put_Out ${output} ${R_SAVE}/$( echo $dir | sed "s:${R_BUFR}/::" )/${output} |
---|
[1603] | 393 | fi |
---|
[699] | 394 | # Clean file produced by ncrcat |
---|
| 395 | IGCM_sys_Rm ${output} |
---|
[590] | 396 | # ------------------------------------------------------------------ |
---|
[583] | 397 | # Test if all was right before proceeding further |
---|
| 398 | # ------------------------------------------------------------------ |
---|
[1206] | 399 | IGCM_debug_Verif_Exit |
---|
[583] | 400 | # Clean files used by ncrcat |
---|
[617] | 401 | cat liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt | xargs rm |
---|
[583] | 402 | # Save the list of files that has been pack (ncrcat) |
---|
[632] | 403 | #mv liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt ${STORE_DEBUG} |
---|
[590] | 404 | IGCM_debug_Print 1 "Ncrcat and cleaning done for ${dir} and ${myType}" |
---|
[785] | 405 | echo |
---|
[1603] | 406 | # Add 1 day to date_end_pack to have the new date_begin_pack |
---|
| 407 | date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) |
---|
[583] | 408 | done |
---|
| 409 | done |
---|
| 410 | done |
---|
| 411 | done |
---|
[590] | 412 | |
---|
[1598] | 413 | # Execute C-ESM-EP driver (which launches jobs) |
---|
| 414 | if [ $PostCesmep = Pack ] ; then |
---|
| 415 | ${SUBMIT_DIR}/cesmep_lite/libIGCM_post.sh $DateBegin $DateEnd |
---|
| 416 | fi |
---|
| 417 | |
---|
[628] | 418 | # Flush post-processing submission |
---|
[1603] | 419 | if [ X${surpack_mode} = Xn ] && [ ${StandAlone} = false ] ; then |
---|
[628] | 420 | if [ -f ${R_BUFR}/FlushPost_${DateEnd}.ksh ] ; then |
---|
| 421 | . ${R_BUFR}/FlushPost_${DateEnd}.ksh |
---|
| 422 | IGCM_FlushPost |
---|
| 423 | #IGCM_sys_Rm -f ${R_BUFR}/FlushPost_${DateEnd}.ksh |
---|
| 424 | fi |
---|
[1603] | 425 | fi |
---|
[590] | 426 | # Clean RUN_DIR_PATH (necessary for cesium and titane only) |
---|
| 427 | IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH} |
---|
| 428 | |
---|
[1198] | 429 | # ------------------------------------------------------------------ |
---|
| 430 | # Finalize BigBrother to inform that the jobs end |
---|
| 431 | # ------------------------------------------------------------------ |
---|
| 432 | IGCM_debug_BigBro_Finalize |
---|
| 433 | |
---|
[590] | 434 | date |
---|