Changeset 1588 for branches/libIGCM_pack/AA_pack_output
- Timestamp:
- 07/18/23 17:42:27 (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libIGCM_pack/AA_pack_output
r1568 r1588 155 155 DEBUG_debug=${DEBUG_debug:=false} 156 156 157 #D- Surpack_mode : to pack existing packs output files 158 #D- Default : n 159 surpack_mode=n 160 157 161 ######################################################################## 158 162 … … 231 235 IGCM_debug_Verif_Exit 232 236 233 IGCM_debug_Print 1 "Check coherence between PackFrequency and PeriodLength"234 IGCM_post_CheckModuloFrequency PeriodPack config_UserChoices_PeriodLength NbPeriodPerFrequency235 # ------------------------------------------------------------------236 # Test if all was right before proceeding further237 # ------------------------------------------------------------------238 IGCM_debug_Verif_Exit239 240 IGCM_debug_Print 1 "We must process ${NbPeriodPerFrequency} files for each pack"241 242 237 # Init loop 243 238 date_begin_pack=${DateBegin} … … 248 243 IGCM_debug_PrintVariables 3 date_end_simulation 249 244 250 while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do 251 252 IGCM_debug_PrintVariables 3 number_pack 253 DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack} ) 254 date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) ) 255 256 for comp in ${config_ListOfComponents[*]} ; do 245 # Loop over components 246 for comp in ${config_ListOfComponents[*]} ; do 247 248 IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp} 249 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 250 card=${SUBMIT_DIR}/COMP/${compname}.card 251 # 252 if [ X${surpack_mode} = Xy ] ; then 253 dirList=$( find ${R_SAVE}/${comp}/Output -maxdepth 1 -mindepth 1 -type d ) 254 else 257 255 dirList=$( find ${R_BUFR}/${comp}/Output -maxdepth 1 -mindepth 1 -type d ) 256 fi 257 # Loop over directories containing output files 258 258 for dir in ${dirList} ; do 259 259 # dirID is like ATM.Output.MO … … 266 266 # Loop over the file type and pack them when in between date_begin_pack and date_end_pack 267 267 for myType in ${fileType} ; do 268 # Read comp.card and find specific pack period for each type of file 269 IGCM_card_DefineArrayFromOption ${card} OutputFiles List 270 ListFilesName=${compname}_OutputFiles_List 271 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 272 273 if [ X${FileName0} != X${NULL_STR} ] ; then 274 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 275 276 (( i=0 )) 277 until [ $i -ge $NbFiles ]; do 278 (( i_ = i+1 )) 279 eval file_out_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 280 eval file_out=${file_out_} 281 (( i_ = i+3 )) 282 eval Testvar_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 283 eval Testvar=${Testvar_} 284 if [[ ${Testvar} =~ [0-9][DMY]$ ]] ; then 285 eval PeriodPack_FileType=${Testvar} 286 ((i = i+4)) 287 else 288 PeriodPack_FileType=${PeriodPack} 289 ((i = i+3)) 290 fi 291 if [[ ${file_out} =~ ${myType} ]] ; then 292 break 293 fi 294 done 295 fi 296 IGCM_debug_Print 1 "Check coherence between PackFrequency and PeriodLength" 297 IGCM_post_CheckModuloFrequency PeriodPack_FileType config_UserChoices_PeriodLength NbPeriodPerFrequency 298 # ------------------------------------------------------------------ 299 # Test if all was right before proceeding further 300 # ------------------------------------------------------------------ 301 IGCM_debug_Verif_Exit 302 303 # Loop over period pack 304 while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do 305 DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack_FileType} ) 306 date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) ) 307 # 268 308 grep ${myType} liste_files.${dirID}.txt > liste_files.${dirID}.${myType}.txt 269 309 nbfile=0 310 # If no surpack, no need to demigrate. 311 if [ X${surpack_mode} = Xn ] ; then 270 312 for file in $( gawk '{print $11}' liste_files.${dirID}.${myType}.txt ); do 271 313 extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) 272 314 date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) 273 315 # echo pack n°${number_pack} ${date_file} ${date_begin_pack} ${date_end_pack} 316 # Ajouter un test sur la date 274 317 if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 275 318 echo ${file} >> liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt … … 278 321 fi 279 322 done 323 else 324 for file in $( gawk '{print $11}' liste_files.${dirID}.${myType}.txt ); do 325 extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) 326 date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) 327 # echo pack n°${number_pack} ${date_file} ${date_begin_pack} ${date_end_pack} 328 # Ajouter un test sur la date 329 if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 330 echo ${file} >> liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt 331 (( nbfile = nbfile + 1 )) 332 fi 333 done 334 # If surpack_mode, archive demigration is needed on TGCC 335 #-Q- irene-amd ccc_hsm get $( cat liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt ) 336 #-Q- irene ccc_hsm get $( cat liste_pack_${myType}_${date_begin_pack}_${date_end_pack}.txt ) 337 for file in $( gawk '{print $11}' liste_files.${dirID}.${myType}.txt ); do 338 extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) 339 date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) 340 # echo pack n°${number_pack} ${date_file} ${date_begin_pack} ${date_end_pack} 341 # Ajouter un test sur la date 342 if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then 343 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 344 fi 345 done 346 fi 280 347 281 348 if [ ${nbfile} = 0 ] ; then … … 283 350 IGCM_debug_Print 1 "We should have found ${NbPeriodPerFrequency} files" 284 351 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" 352 date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) 353 continue 354 fi 355 if [ X${surpack_mode} = Xy ] && [ ${nbfile} = 1 ] ; then 356 IGCM_debug_Print 1 "Only 1 file to pack in surpack mode, nothing to be done" 357 date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) 285 358 continue 286 359 fi 287 288 360 # Select list of variables to work with 289 361 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 ',' ) … … 291 363 # Create packed files 292 364 IGCM_debug_Print 1 "Ncrcat ongoing for ${dir} and ${myType}" 365 if [ X${surpack_mode} = Xn ] ; then 293 366 if [ ! ${nbfile} = ${NbPeriodPerFrequency} ] ; then 367 # if [ ${date_end_pack} -le ${date_end_simulation} ] ; then 294 368 IGCM_debug_Print 1 "Number of files to process is not equal to what it should be" 295 369 IGCM_debug_Print 1 "We found ${nbfile} files and it should have been ${NbPeriodPerFrequency} files" 296 370 IGCM_debug_Exit "ERROR in number of files to process. STOP HERE INCLUDING THE COMPUTING JOB" 297 371 IGCM_debug_Verif_Exit 372 fi 298 373 fi 299 374 output=${JobName}_${date_begin_pack}_${date_end_pack}_${myType} … … 309 384 IGCM_debug_Verif_Exit 310 385 # Save it 386 if [ X${surpack_mode} = Xy ] ; then 387 IGCM_sys_Put_Out ${output} ${R_SAVE}/$( echo $dir | sed "s:${R_SAVE}/::" )/${output} 388 else 311 389 IGCM_sys_Put_Out ${output} ${R_SAVE}/$( echo $dir | sed "s:${R_BUFR}/::" )/${output} 390 fi 312 391 # Clean file produced by ncrcat 313 392 IGCM_sys_Rm ${output} … … 322 401 IGCM_debug_Print 1 "Ncrcat and cleaning done for ${dir} and ${myType}" 323 402 echo 403 # Add 1 day to date_end_pack to have the new date_begin_pack 404 date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) 324 405 done 325 406 done 326 407 done 327 (( number_pack = number_pack + 1 ))328 # Add 1 day to date_end_pack to have the new date_begin_pack329 date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 )330 408 done 331 332 409 # Flush post-processing submission 410 if [ X${surpack_mode} = Xn ] && [ ${StandAlone} = false ] ; then 333 411 if [ -f ${R_BUFR}/FlushPost_${DateEnd}.ksh ] ; then 334 412 . ${R_BUFR}/FlushPost_${DateEnd}.ksh … … 336 414 #IGCM_sys_Rm -f ${R_BUFR}/FlushPost_${DateEnd}.ksh 337 415 fi 338 416 fi 339 417 # Clean RUN_DIR_PATH (necessary for cesium and titane only) 340 418 IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
Note: See TracChangeset
for help on using the changeset viewer.