Changeset 785 for trunk/libIGCM/AA_create_se
- Timestamp:
- 02/04/13 16:39:38 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/AA_create_se
r783 r785 217 217 # 218 218 for comp in ${config_ListOfComponents[*]} ; do 219 # 220 IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp} 221 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 222 # 223 card=${CARD_DIR}/COMP/${compname}.card 224 IGCM_card_DefineArrayFromOption ${card} OutputFiles List 225 # 226 ListFilesName=${compname}_OutputFiles_List 227 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 228 # 229 if [ X${FileName0} != X${NULL_STR} ] ; then 230 # 231 # INITIALISATION 232 # 233 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 234 typeset i=2 235 # 236 until [ $i -gt $NbFiles ]; do 237 # 238 eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1 239 # 240 if [ X${flag_post} != XNONE ] ; then 241 # 242 # Check if seasonal is required for this file 243 # 244 IGCM_card_DefineArrayFromSection ${card} ${flag_post} 245 # 246 # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default 247 # 248 # variable option allready typeset above 249 for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do 250 if [ ${option} = Seasonal ] ; then 251 FoundSeasonal=true 252 IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal 253 fi 254 done 255 # 256 if [ ! X${FoundSeasonal} = Xtrue ] ; then 257 eval ${compname}_${flag_post}_Seasonal=ON 258 fi 259 # 260 if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then 261 (( i=i+3 )) 262 continue 263 fi 264 # 265 # CREATE LIST 266 # 267 FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' ) 268 # 269 DIRECTORY=${R_SAVE}/${comp}/Analyse/SE 270 # 271 TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc 272 # 273 IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} 274 if [ ! $? = 0 ] ; then 275 eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE} 276 if [ ! ${RebuildFrequency} = true ] ; then 277 IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches 278 eval set +A LISTE_PATCHES_${FILE} \$\{${compname}_Post_${FILE}_Patches[*]} 279 if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) != X${NULL_STR} ]; then 280 for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do 281 if [ Xload${Patch} != X ] ; then 282 . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh 283 eval load${Patch}=loaded 284 fi 285 done 286 fi 287 fi 288 fi 289 fi 290 (( i=i+3 )) 291 done # until [ $i -eq $NbFiles ] 219 # 220 IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp} 221 eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 222 # 223 card=${CARD_DIR}/COMP/${compname}.card 224 IGCM_card_DefineArrayFromOption ${card} OutputFiles List 225 # 226 ListFilesName=${compname}_OutputFiles_List 227 eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 228 # 229 if [ X${FileName0} != X${NULL_STR} ] ; then 230 # 231 # INITIALISATION 232 # 233 eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 234 typeset i=2 235 # 236 until [ $i -gt $NbFiles ]; do 237 # 238 eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1 239 # 240 if [ X${flag_post} != XNONE ] ; then 241 # 242 # Check if seasonal is required for this file 243 # 244 IGCM_card_DefineArrayFromSection ${card} ${flag_post} 245 # 246 # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default 247 # 248 # variable option allready typeset above 249 for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do 250 if [ ${option} = Seasonal ] ; then 251 FoundSeasonal=true 252 IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal 253 fi 254 done 255 # 256 if [ ! X${FoundSeasonal} = Xtrue ] ; then 257 eval ${compname}_${flag_post}_Seasonal=ON 258 fi 259 # 260 if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then 261 (( i=i+3 )) 262 continue 263 fi 264 # 265 # CREATE LIST 266 # 267 FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' ) 268 # 269 DIRECTORY=${R_SAVE}/${comp}/Analyse/SE 270 # 271 TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc 272 # 273 IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} 274 if [ ! $? = 0 ] ; then 275 eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE} 276 if [ ! ${RebuildFrequency} = true ] ; then 277 IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches 278 eval set +A LISTE_PATCHES_${FILE} \$\{${compname}_Post_${FILE}_Patches[*]} 279 if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) != X${NULL_STR} ]; then 280 for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do 281 if [ Xload${Patch} != X ] ; then 282 . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh 283 eval load${Patch}=loaded 284 fi 285 done 286 fi 287 fi 288 fi 289 fi 290 (( i=i+3 )) 291 done # until [ $i -eq $NbFiles ] 292 fi 293 done # for comp 294 295 for comp in ${config_ListOfComponents[*]} ; do 296 # 297 eval R_OUT_${comp}=${R_SAVE}/${comp} 298 # 299 i=0 300 for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do 301 # 302 # Determine in which output can we find file 303 # IE : Output/MO or Output/DA or ... 304 # 305 FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 306 case ${FlagDir} in 307 1Y) FreqDir=YE ;; 308 1M) FreqDir=MO ;; 309 5D|1D) FreqDir=DA ;; 310 HF) FreqDir=HF ;; 311 3H) FreqDir=HF ;; 312 INS) FreqDir=INS ;; 313 esac 314 # 315 RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc 316 # Do not redoo an existing SE 317 IGCM_sys_TestFileArchive ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE} 318 if [ $? = 0 ] ; then 319 continue 292 320 fi 293 done # for comp 294 295 for comp in ${config_ListOfComponents[*]} ; do 296 # 297 eval R_OUT_${comp}=${R_SAVE}/${comp} 298 # 299 i=0 300 for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do 301 # 302 # Determine in which output can we find file 303 # IE : Output/MO or Output/DA or ... 304 # 305 FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) 306 case ${FlagDir} in 307 1Y) FreqDir=YE ;; 308 1M) FreqDir=MO ;; 309 5D|1D) FreqDir=DA ;; 310 HF) FreqDir=HF ;; 311 3H) FreqDir=HF ;; 312 INS) FreqDir=INS ;; 313 esac 314 # 315 RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc 316 # Do not redoo an existing SE 317 IGCM_sys_TestFileArchive ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE} 318 if [ $? = 0 ] ; then 319 continue 320 fi 321 # 322 eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/ 323 # 324 case ${config_UserChoices_PeriodLength} in 325 # For Yearly simulation : 326 1Y|1y) 327 (( an = an_deb )) 328 # Initialize array 329 #set -A liste_file_se 330 #set -A liste_file_se_tmp 331 unset liste_file_se 332 unset liste_file_se_tmp 333 while [ ${an} -le ${an_fin} ] ; do 334 moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) 335 # 336 an4=$(printf "%04i\n" ${an} ) 337 # 338 diy=$( IGCM_date_DaysInYear $an4 ) 339 afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) ) 340 date=${an4}0101_${afin} 341 #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 342 #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 343 liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 344 liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc 345 (( an = an + 1 )) 346 done 347 # 348 IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 349 IGCM_debug_Verif_Exit_Post 350 351 # Apply IGCM_Patch if needed 352 if [ ! ${RebuildFrequency} = true ] ; then 353 if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then 354 for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 355 for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 356 IGCM_${Patch} ${file_t} 357 done 358 done 359 fi 360 fi 361 362 # Search of common list of variables to be treated 363 nbfile=0 364 for file_common_var in ${liste_file_se_tmp[*]} ; do 365 ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra 366 (( nbfile = nbfile + 1 )) 367 done 368 list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','` 369 IGCM_sys_Rm tmpfile_ncra 370 371 # detect time counter : time or time_counter ie unlimited variable 372 var_unlim=$(ncdump -h ${liste_file_se_tmp[1]}|grep UNLIMITED|awk '{print $1}') 373 374 for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do 375 # 376 (( nb = ${mois} - 1 )) 377 # 378 OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc 379 IGCM_sys_ncra -O -v ${list_var_final_ncra} -d ${var_unlim},${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 380 done 381 IGCM_sys_Rm ${liste_file_se_tmp[*]} 382 ;; 383 # For Monthly simulation : 384 1M|1m) 385 for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do 386 # 387 (( nb = ${mois} - 1 )) 388 # 389 OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc 390 # 391 (( an = an_deb )) 392 # Initialize array 393 #set -A liste_file_se 394 #set -A liste_file_se_tmp 395 unset liste_file_se 396 unset liste_file_se_tmp 397 while [ ${an} -le ${an_fin} ] ; do 398 moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) 399 # 400 an4=$(printf "%04i\n" ${an} ) 401 # 402 date=${an4}${mois}01_${an4}${mois}${moisL} 403 #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 404 #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 405 liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 406 liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc 407 408 (( an = an + 1 )) 409 done 410 # 411 IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 412 IGCM_debug_Verif_Exit_Post 413 414 # Apply IGCM_Patch if needed 415 if [ ! ${RebuildFrequency} = true ] ; then 416 if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then 417 for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 418 for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 419 IGCM_${Patch} ${file_t} 420 done 421 done 422 fi 423 fi 424 425 # Search of common list of variables to be treated 426 nbfile=0 427 for file_common_var in ${liste_file_se_tmp[*]} ; do 428 ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra 429 (( nbfile = nbfile + 1 )) 430 done 431 list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','` 432 IGCM_sys_Rm tmpfile_ncra 433 434 IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 435 436 IGCM_sys_Rm ${liste_file_se_tmp[*]} 437 done 438 ;; 439 *D|*d) 440 for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do 441 # 442 (( nb = ${mois} - 1 )) 443 # 444 OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc 445 # 446 (( an = an_deb )) 447 # Initialize array 448 #set -A liste_file_se 449 #set -A liste_file_se_tmp 450 unset liste_file_se 451 unset liste_file_se_tmp 452 while [ ${an} -le ${an_fin} ] ; do 453 moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) 454 # 455 an4=$(printf "%04i\n" ${an} ) 456 # 457 length_d=$(( ${config_UserChoices_PeriodLength} - 1 )) 458 # for one day 459 if [ ${length_d} -eq 1 ] ; then 460 (( length_d = 0 )) 461 fi 462 (( day = 1 )) 463 while [ ${day} -le ${moisL} ] ; do 464 day2=$(printf "%02i\n" ${day} ) 465 day_beg=${an4}${mois}${day2} 466 day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} ) 467 date=${an4}${mois}${day_beg}_${an4}${mois}${day_end} 468 #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 469 #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 470 liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 471 liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc 472 (( day = day + 1 )) 473 done 474 (( an = an + 1 )) 475 done 476 # 477 IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 478 IGCM_debug_Verif_Exit_Post 479 480 # Apply IGCM_Patch if needed 481 if [ ! ${RebuildFrequency} = true ] ; then 482 if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then 483 for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 484 for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 485 IGCM_${Patch} ${file_t} 486 done 487 done 488 fi 489 fi 490 491 # Search of common list of variables to be treated 492 nbfile=0 493 for file_common_var in ${liste_file_se_tmp[*]} ; do 494 ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra 495 (( nbfile = nbfile + 1 )) 496 done 497 list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','` 498 IGCM_sys_Rm tmpfile_ncra 499 500 IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 501 IGCM_sys_Rm ${liste_file_se_tmp[*]} 502 done 503 ;; 504 esac 505 # 321 # 322 eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/ 323 # 324 case ${config_UserChoices_PeriodLength} in 325 # For Yearly simulation : 326 1Y|1y) 327 (( an = an_deb )) 328 # Initialize array 329 #set -A liste_file_se 330 #set -A liste_file_se_tmp 331 unset liste_file_se 332 unset liste_file_se_tmp 333 while [ ${an} -le ${an_fin} ] ; do 334 moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) 335 # 336 an4=$(printf "%04i\n" ${an} ) 337 # 338 diy=$( IGCM_date_DaysInYear $an4 ) 339 afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) ) 340 date=${an4}0101_${afin} 341 #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 342 #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 343 liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 344 liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc 345 (( an = an + 1 )) 346 done 347 # 348 IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 349 IGCM_debug_Verif_Exit_Post 350 351 # Apply IGCM_Patch if needed 352 if [ ! ${RebuildFrequency} = true ] ; then 353 if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then 354 for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 355 for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 356 IGCM_${Patch} ${file_t} 357 done 358 done 359 fi 360 fi 506 361 507 362 # Search of common list of variables to be treated 508 363 nbfile=0 509 for file_common_var in ${ OUT_SE[*]} ; do510 ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncrcat511 364 for file_common_var in ${liste_file_se_tmp[*]} ; do 365 ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra 366 (( nbfile = nbfile + 1 )) 512 367 done 513 list_var_final_ncrcat=`cat tmpfile_ncrcat | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','` 514 IGCM_sys_Rm tmpfile_ncrcat 515 516 IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE} 517 # 518 IGCM_sys_Rm ${OUT_SE[*]} 519 # 520 # detect time counter : time or time_counter ie unlimited variable 521 var_unlim=$(ncdump -h ${RESULT_SE}|grep UNLIMITED| cut -d ' ' -f 1) 522 523 # Put correct climatological axis following calendar 524 case ${config_UserChoices_CalendarType} in 525 360d|360_day) 526 # 360 days 527 ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345.} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 30, 30, 60, 60, 90, 90, 120, 120, 150, 150, 180, 180, 210, 210, 240, 240, 270, 270, 300, 300, 330, 330, 360.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"360_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'" 528 ;; 529 noleap|365_day) 530 # 365 days 531 ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45, 74.5, 105, 135.5, 166, 196.5, 227.5, 258, 288.5, 319, 349.5} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 59, 59, 90, 90, 120, 120, 151, 151, 181, 181, 212, 212, 243, 243, 273, 273, 304, 304, 334, 334, 365.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"365_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'" 532 ;; 533 all_leap|366_day) 534 # 366 days 535 ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45.5, 75.5, 106, 136.5, 167, 197.5, 228.5, 259, 289.5, 320, 350.5} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 60, 60, 91, 91, 121, 121, 152, 152, 182, 182, 213, 213, 244, 244, 274, 274, 305, 305, 335, 335, 366.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"366_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'" 536 ;; 537 leap|gregorian|standard) 538 # 365.2425 days 539 ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45.12125, 74.7425, 105.2425, 135.7425, 166.2425, 196.7425, 227.7425, 258.2425, 288.7425, 319.2425, 349.7425} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 59.2425, 59.2425, 90.2425, 90.2425, 120.2425, 120.2425, 151.2425, 151.2425, 181.2425, 181.2425, 212.2425, 212.2425, 243.2425, 243.2425, 273.2425, 273.2425, 304.2425, 304.2425, 334.2425, 334.2425, 365.2425} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"gregorian\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'" 540 ;; 541 esac 542 eval IGCM_sys_ncap2 -Oh -s $ncap2cmd ${RESULT_SE} tmp.nc 543 IGCM_sys_Rm ${RESULT_SE} 544 IGCM_sys_Mv tmp.nc ${RESULT_SE} 545 # 546 eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE} 547 IGCM_sys_Rm ${RESULT_SE} 548 # 549 done 368 list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','` 369 IGCM_sys_Rm tmpfile_ncra 370 371 # detect time counter : time or time_counter ie unlimited variable 372 var_unlim=$(ncdump -h ${liste_file_se_tmp[1]}|grep UNLIMITED|awk '{print $1}') 373 374 for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do 375 # 376 (( nb = ${mois} - 1 )) 377 # 378 OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc 379 IGCM_sys_ncra -O -v ${list_var_final_ncra} -d ${var_unlim},${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 380 done 381 IGCM_sys_Rm ${liste_file_se_tmp[*]} 382 ;; 383 # For Monthly simulation : 384 1M|1m) 385 for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do 386 # 387 (( nb = ${mois} - 1 )) 388 # 389 OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc 390 # 391 (( an = an_deb )) 392 # Initialize array 393 #set -A liste_file_se 394 #set -A liste_file_se_tmp 395 unset liste_file_se 396 unset liste_file_se_tmp 397 while [ ${an} -le ${an_fin} ] ; do 398 moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) 399 # 400 an4=$(printf "%04i\n" ${an} ) 401 # 402 date=${an4}${mois}01_${an4}${mois}${moisL} 403 #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 404 #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 405 liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 406 liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc 407 408 (( an = an + 1 )) 409 done 410 # 411 IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 412 IGCM_debug_Verif_Exit_Post 413 414 # Apply IGCM_Patch if needed 415 if [ ! ${RebuildFrequency} = true ] ; then 416 if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then 417 for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 418 for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 419 IGCM_${Patch} ${file_t} 420 done 421 done 422 fi 423 fi 424 425 # Search of common list of variables to be treated 426 nbfile=0 427 for file_common_var in ${liste_file_se_tmp[*]} ; do 428 ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra 429 (( nbfile = nbfile + 1 )) 430 done 431 list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','` 432 IGCM_sys_Rm tmpfile_ncra 433 434 IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 435 436 IGCM_sys_Rm ${liste_file_se_tmp[*]} 437 done 438 ;; 439 *D|*d) 440 for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do 441 # 442 (( nb = ${mois} - 1 )) 443 # 444 OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc 445 # 446 (( an = an_deb )) 447 # Initialize array 448 #set -A liste_file_se 449 #set -A liste_file_se_tmp 450 unset liste_file_se 451 unset liste_file_se_tmp 452 while [ ${an} -le ${an_fin} ] ; do 453 moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) 454 # 455 an4=$(printf "%04i\n" ${an} ) 456 # 457 length_d=$(( ${config_UserChoices_PeriodLength} - 1 )) 458 # for one day 459 if [ ${length_d} -eq 1 ] ; then 460 (( length_d = 0 )) 461 fi 462 (( day = 1 )) 463 while [ ${day} -le ${moisL} ] ; do 464 day2=$(printf "%02i\n" ${day} ) 465 day_beg=${an4}${mois}${day2} 466 day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} ) 467 date=${an4}${mois}${day_beg}_${an4}${mois}${day_end} 468 #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 469 #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc 470 liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc 471 liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc 472 (( day = day + 1 )) 473 done 474 (( an = an + 1 )) 475 done 476 # 477 IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} 478 IGCM_debug_Verif_Exit_Post 479 480 # Apply IGCM_Patch if needed 481 if [ ! ${RebuildFrequency} = true ] ; then 482 if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then 483 for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do 484 for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do 485 IGCM_${Patch} ${file_t} 486 done 487 done 488 fi 489 fi 490 491 # Search of common list of variables to be treated 492 nbfile=0 493 for file_common_var in ${liste_file_se_tmp[*]} ; do 494 ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncra 495 (( nbfile = nbfile + 1 )) 496 done 497 list_var_final_ncra=`cat tmpfile_ncra | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','` 498 IGCM_sys_Rm tmpfile_ncra 499 500 IGCM_sys_ncra -O -v ${list_var_final_ncra} ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} 501 IGCM_sys_Rm ${liste_file_se_tmp[*]} 502 done 503 ;; 504 esac 505 # 506 507 # Search of common list of variables to be treated 508 nbfile=0 509 for file_common_var in ${OUT_SE[*]} ; do 510 ncdump -h ${file_common_var} | grep -E 'float|double' | cut -f 1 -d '(' | cut -f 2 -d ' ' >> tmpfile_ncrcat 511 (( nbfile = nbfile + 1 )) 512 done 513 list_var_final_ncrcat=`cat tmpfile_ncrcat | sort | uniq -c | awk -v nbfile=$nbfile '{if ($1 == nbfile) {print $2}}' | paste -s -d ','` 514 IGCM_sys_Rm tmpfile_ncrcat 515 516 IGCM_sys_ncrcat -O -v ${list_var_final_ncrcat} ${OUT_SE[*]} ${RESULT_SE} 517 # 518 IGCM_sys_Rm ${OUT_SE[*]} 519 # 520 # detect time counter : time or time_counter ie unlimited variable 521 var_unlim=$(ncdump -h ${RESULT_SE}|grep UNLIMITED| cut -d ' ' -f 1) 522 523 # Put correct climatological axis following calendar 524 case ${config_UserChoices_CalendarType} in 525 360d|360_day) 526 # 360 days 527 ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15, 45, 75, 105, 135, 165, 195, 225, 255, 285, 315, 345.} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 30, 30, 60, 60, 90, 90, 120, 120, 150, 150, 180, 180, 210, 210, 240, 240, 270, 270, 300, 300, 330, 330, 360.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"360_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'" 528 ;; 529 noleap|365_day) 530 # 365 days 531 ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45, 74.5, 105, 135.5, 166, 196.5, 227.5, 258, 288.5, 319, 349.5} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 59, 59, 90, 90, 120, 120, 151, 151, 181, 181, 212, 212, 243, 243, 273, 273, 304, 304, 334, 334, 365.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"365_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'" 532 ;; 533 all_leap|366_day) 534 # 366 days 535 ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45.5, 75.5, 106, 136.5, 167, 197.5, 228.5, 259, 289.5, 320, 350.5} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 60, 60, 91, 91, 121, 121, 152, 152, 182, 182, 213, 213, 244, 244, 274, 274, 305, 305, 335, 335, 366.} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"366_day\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'" 536 ;; 537 leap|gregorian|standard) 538 # 365.2425 days 539 ncap2cmd="'defdim(\"tbnds\",2) ; ${var_unlim}[${var_unlim}]={15.5, 45.12125, 74.7425, 105.2425, 135.7425, 166.2425, 196.7425, 227.7425, 258.2425, 288.7425, 319.2425, 349.7425} ; ${var_unlim}_bnds[${var_unlim},tbnds]={0, 31, 31, 59.2425, 59.2425, 90.2425, 90.2425, 120.2425, 120.2425, 151.2425, 151.2425, 181.2425, 181.2425, 212.2425, 212.2425, 243.2425, 243.2425, 273.2425, 273.2425, 304.2425, 304.2425, 334.2425, 334.2425, 365.2425} ; ${var_unlim}@units=\"days since 0000-01-01 00:00:00\" ; ${var_unlim}@time_origin=\"01-JAN-0000 00:00:00\" ; ${var_unlim}@calendar=\"gregorian\" ; ${var_unlim}@bounds=\"${var_unlim}_bnds\"'" 540 ;; 541 esac 542 eval IGCM_sys_ncap2 -Oh -s $ncap2cmd ${RESULT_SE} tmp.nc 543 IGCM_sys_Rm ${RESULT_SE} 544 IGCM_sys_Mv tmp.nc ${RESULT_SE} 545 # 546 eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE} 547 IGCM_sys_Rm ${RESULT_SE} 548 # 549 done 550 550 done 551 551 552 552 # DODS copy 553 553 for comp in ${config_ListOfComponents[*]} ; do 554 555 554 IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/SE 555 [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/SE 556 556 done 557 557 … … 574 574 [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ] || \ 575 575 [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then 576 577 578 579 580 581 582 583 584 585 576 # 577 Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ; 578 IGCM_sys_QsubPost atlas_ORCHIDEE ; 579 Script_Post_Output=atlas_LMDZ.${PeriodDateEnd} ; 580 IGCM_sys_QsubPost atlas_LMDZ ; 581 Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ; 582 IGCM_sys_QsubPost atlas_ORCA_LIM ; 583 Script_Post_Output=additionnal.${PeriodDateEnd} ; 584 IGCM_sys_QsubPost additionnal ; 585 # 586 586 elif [ ${config_UserChoices_TagName} = "IPSLCM5" ] || \ 587 587 [ ${config_UserChoices_TagName} = "IPSLCM5A" ] || \ 588 588 [ ${config_UserChoices_TagName} = "IPSLCM5B" ] || \ 589 589 [ ${config_UserChoices_TagName} = "IPSLCM5A-MR" ] ; then 590 591 592 593 594 595 596 597 598 590 Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ; 591 IGCM_sys_QsubPost atlas_ORCHIDEE ; 592 Script_Post_Output=atlas_LMDZ.${PeriodDateEnd} ; 593 IGCM_sys_QsubPost atlas_LMDZ ; 594 Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ; 595 IGCM_sys_QsubPost atlas_ORCA_LIM ; 596 Script_Post_Output=atlas_PISCES.${PeriodDateEnd} ; 597 IGCM_sys_QsubPost atlas_PISCES ; 598 # 599 599 elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ] || \ 600 600 [ ${config_UserChoices_TagName} = "LMDZOR" ] || \ 601 601 [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then 602 603 604 605 606 607 602 # 603 Script_Post_Output=atlas_LMDZ.${PeriodDateEnd} ; 604 IGCM_sys_QsubPost atlas_LMDZ ; 605 Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ; 606 IGCM_sys_QsubPost atlas_ORCHIDEE ; 607 # 608 608 elif [ ${config_UserChoices_TagName} = "LMDZ" ] ; then 609 610 611 612 609 # 610 Script_Post_Output=atlas_LMDZ.${PeriodDateEnd} ; 611 IGCM_sys_QsubPost atlas_LMDZ ; 612 # 613 613 elif [ ${config_UserChoices_TagName} = "OL" ] || \ 614 614 [ ${config_UserChoices_TagName} = "OL2" ] ; then 615 616 617 618 615 # 616 Script_Post_Output=atlas_ORCHIDEE.${PeriodDateEnd} ; 617 IGCM_sys_QsubPost atlas_ORCHIDEE ; 618 # 619 619 elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ] || 620 620 [ ${config_UserChoices_TagName} = "ORCA2_LIM2" ] ; then 621 622 623 621 # 622 Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ; 623 IGCM_sys_QsubPost atlas_ORCA_LIM ; 624 624 elif [ ${config_UserChoices_TagName} = "ORCA2_LIM2_PISCES" ] ; then 625 626 627 628 629 625 # 626 Script_Post_Output=atlas_ORCA_LIM.${PeriodDateEnd} ; 627 IGCM_sys_QsubPost atlas_ORCA_LIM ; 628 Script_Post_Output=atlas_PISCES.${PeriodDateEnd} ; 629 IGCM_sys_QsubPost atlas_PISCES ; 630 630 elif [ ${config_UserChoices_TagName} = "ORCA2_OFF_PISCES" ] ; then 631 632 633 634 631 # 632 Script_Post_Output=atlas_PISCES.${PeriodDateEnd} ; 633 IGCM_sys_QsubPost atlas_PISCES ; 634 # 635 635 fi 636 636
Note: See TracChangeset
for help on using the changeset viewer.