#-Q- platine #!/usr/bin/ksh #-Q- platine ################## #-Q- platine ## PLATINE CEA ## #-Q- platine ################## #-Q- platine #BSUB -J TS # Nom du job #-Q- platine #BSUB -N # message a la fin du job #-Q- platine #BSUB -n 1 # reservation des processeurs pour le job #-Q- platine #BSUB -W 1:00 # Limite temps #-Q- platine #BSUB -q post # Passage en queue post #-Q- sx8brodie #!/bin/ksh #-Q- sx8brodie ####################### #-Q- sx8brodie ## SX8BRODIE IDRIS ## #-Q- sx8brodie ####################### #-Q- sx8brodie # Temps Elapsed max. d'une requete hh:mm:ss #-Q- sx8brodie # @ wall_clock_limit = 10:00:00 #-Q- sx8brodie # Nom du travail LoadLeveler #-Q- sx8brodie # @ job_name = TS #-Q- sx8brodie # Fichier de sortie standard du travail #-Q- sx8brodie # @ output = $(job_name).$(jobid) #-Q- sx8brodie # Fichier de sortie d'erreur du travail #-Q- sx8brodie # @ error = $(job_name).$(jobid) #-Q- sx8brodie # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) #-Q- sx8brodie # @ notification = error #-Q- sx8brodie # @ environment = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_BIOS ; $MASTER #-Q- aix6 #!/bin/ksh #-Q- aix6 ####################### #-Q- aix6 ## VARGAS IDRIS ## #-Q- aix6 ####################### #-Q- aix6 # Temps Elapsed max. d'une requete hh:mm:ss #-Q- aix6 # @ wall_clock_limit = 10:00:00 #-Q- aix6 # Nom du travail LoadLeveler #-Q- aix6 # @ job_name = TS #-Q- aix6 # Fichier de sortie standard du travail #-Q- aix6 # @ output = $(job_name).$(jobid) #-Q- aix6 # Fichier de sortie d'erreur du travail #-Q- aix6 # @ error = $(job_name).$(jobid) #-Q- aix6 # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) #-Q- aix6 # @ notification = error #-Q- aix6 # @ environment = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $MASTER ; $RebuildFrequency ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $CompletedFlag ; $TsTask ; $CompToRead ; $FlagToRead ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_BIOS ; $MASTER #-Q- aix6 # @ queue #-Q- sx8brodie # @ queue #-Q- sx8mercure #!/bin/ksh #-Q- sx8mercure ###################### #-Q- sx8mercure ## SX8MERCURE CEA ## #-Q- sx8mercure ###################### #-Q- sx8mercure #PBS -N TS # Nom du job #-Q- sx8mercure #PBS -j o # regroupement des stdout et stderr #-Q- sx8mercure #PBS -S /usr/bin/ksh # shell de soumission #-Q- sx8mercure #PBS -l memsz_job=1gb # Limite memoire a 1 Go #-Q- sx8mercure #PBS -l cputim_job=24:00:00 # Limite temps a 2 heures #-Q- sx8mercure #PBS -q scalaire #-Q- sx9mercure #!/bin/ksh #-Q- sx9mercure ###################### #-Q- sx9mercure ## SX9MERCURE CEA ## #-Q- sx9mercure ###################### #-Q- sx9mercure #PBS -N TS # Nom du job #-Q- sx9mercure #PBS -j o # regroupement des stdout et stderr #-Q- sx9mercure #PBS -S /usr/bin/ksh # shell de soumission #-Q- sx9mercure #PBS -l memsz_job=1gb # Limite memoire a 1 Go #-Q- sx9mercure #PBS -l cputim_job=24:00:00 # Limite temps a 2 heures #-Q- sx9mercure #PBS -q scalaire #-Q- default #!/bin/ksh #-Q- default ################## #-Q- default ## DEFAULT HOST ## #-Q- default ################## # $Date$ # $Author$ # $Revision$ # IPSL (2006) # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC #set -eu #set -vx date #-Q- sx8brodie export OMP_NUM_THREADS=1 #-Q- aix6 export OMP_NUM_THREADS=1 ######################################################################## #D- Flag to determine if this job in a standalone mode #D- Default : value from AA_job if any StandAlone=${StandAlone:=true} #D- Flag to determine allready produced time series. #D- Default : Commented. Uncomment for StandAlone case if you want to continue a time series #CompletedFlag= #D- Flag to determine job's output directory #D- Default : value from libIGCM_post.ksh if any POST_DIR=${POST_DIR:=${PBS_O_WORKDIR}} #D- Increased verbosity (1, 2, 3) #D- Default : value from AA_job if any Verbosity=${Verbosity:=3} #D- Low level debug : to bypass lib test checks and stack construction #D- Default : value from AA_job if any DEBUG_debug=${DEBUG_debug:=false} #D- Low level debug : to bypass lib test checks and stack construction #D- Default : value from AA_job if any libIGCM=${libIGCM:=/path/to/your/libIGCM} #D- TEMPORARY Flag to determine atmospheric resolution #D- Default : value from atmospheric driver if any RESOL_ATM=ALL #D- TEMPORARY Flag to determine ocean resolution #D- Default : value from ocean driver if any RESOL_OCE=${RESOL_OCE:=ORCA2} #D- TEMPORARY Flag to determine ice resolution #D- Default : value from ice driver if any RESOL_ICE=${RESOL_ICE:=ORCA2} #D- TEMPORARY Flag to determine marine biogeochemistry resolution #D- Default : value from ice driver if any RESOL_MBG=${RESOL_MBG:=ORCA2} #D- Flag to determine surface resolution #D- Default : value from surface driver if any RESOL_SRF=ALL #D- Flag to determine surface resolution #D- Default : value from surface driver if any RESOL_BIOS=ALL ######################################################################## . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ( ${DEBUG_debug} ) && IGCM_debug_Check . ${libIGCM}/libIGCM_card/libIGCM_card.ksh ( ${DEBUG_debug} ) && IGCM_card_Check . ${libIGCM}/libIGCM_date/libIGCM_date.ksh ( ${DEBUG_debug} ) && IGCM_date_Check #------- . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh ######################################################################## #set -vx # Useful cleaning function MENAGE () { [ -f $3 ] && ( IGCM_sys_RshArchive rm -f $1/$2 ;) } ######################################################################## if [ ${DEBUG_debug} = true ] ; then IGCM_sys_MkdirWork ${RUN_DIR_PATH} echo "RUN_DIR_PATH ${RUN_DIR_PATH} ok." fi IGCM_sys_Cd ${RUN_DIR_PATH} if [ ${StandAlone} = true ] ; then CARD_DIR=${SUBMIT_DIR} else CARD_DIR=${RUN_DIR_PATH}/$( basename ${SUBMIT_DIR} ) IGCM_sys_Get_Master ${SUBMIT_DIR} ${RUN_DIR_PATH} fi # # First of all # IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card UserChoices typeset option for option in ${config_UserChoices[*]} ; do IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card UserChoices ${option} done # echo IGCM_debug_Print 1 "DefineArrayFromOption : config_UserChoices" IGCM_debug_PrintVariables 3 config_UserChoices_JobName IGCM_debug_PrintVariables 3 config_UserChoices_LongName IGCM_debug_PrintVariables 3 config_UserChoices_TagName IGCM_debug_PrintVariables 3 config_UserChoices_CalendarType IGCM_debug_PrintVariables 3 config_UserChoices_DateBegin IGCM_debug_PrintVariables 3 config_UserChoices_DateEnd IGCM_debug_PrintVariables 3 config_UserChoices_PeriodLength echo #================================== R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName} # # Determine component to take care of depending on kind of task create_ts will perform # ( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = XChunck3D ] ) && set -A config_ListOfComponents ${CompToRead} || IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents # # Determine period for time series. Default : value from AA_job or from launch_TS if any # DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )} # PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )} # # Determine Dimension of the produced time series : 2D or 3D if ( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = X2D ] ) ; then Dimension=2D elif ( [ X${TsTask} = XChunck3D ] || [ X${TsTask} = X3D ] ) ; then Dimension=3D else Dimension="" fi ######################################################################## # # Depending on requested time series fill following variables : # # - LISTE_FILE_${comp}[*] # - LISTE_VARS_${file}[*] # - LISTE_AXIS_${file}[*] # - LISTE_PATCH_${file}[*] ######################################################################## # # For each selected component determine which files need post-processing # DoJob=false for comp in ${config_ListOfComponents[*]} ; do # ActiveComp=false # IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp} eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1 # card=${CARD_DIR}/COMP/${compname}.card IGCM_card_DefineArrayFromOption ${card} OutputFiles List # ListFilesName=${compname}_OutputFiles_List eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1 # if [ X${FileName0} != X${NULL_STR} ] ; then # #IGCM_debug_Print 1 "Component : ${compname}" # # INITIALISATION # typeset i if ( [ X${TsTask} = XChunck2D ] || [ X${TsTask} = XChunck3D ] ) ; then ((NbFiles=${FlagToRead})) ((i=${NbFiles}-2)) else eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 i=0 fi # until [ $i -ge $NbFiles ]; do # (( i_ = i+2 )) eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 eval flag_post=${flag_post_} # if [ X${flag_post} != XNONE ] ; then # # For each comp and each file who needs post-processing # determine which variables need time series. # FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' ) IGCM_card_DefineArrayFromOption ${card} Post_${FILE} TimeSeriesVars${Dimension} # if [ $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}} ) = ${NULL_STR} ] ; then # IGCM_debug_Print 3 "Nothing to do for ${FILE} according to ${card}" (( i=i+3 )) continue # fi # # If we are not a Chunck type task, skip files/variables handled by chunck task # if ( [ ! X${TsTask} = XChunck${Dimension} ] && [ ! X${TsTask} = X ] && [ ! XChunck${Dimension} = XChunck ] ) ; then IGCM_card_DefineVariableFromOption ${card} Post_${FILE} ChunckJob${Dimension} if [ ! $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} ) = NONE ] ; then IGCM_debug_Print 3 "Nothing to do for ${FILE} TimeSeriesVars${Dimension} according to ${card}" IGCM_debug_Print 3 "Let another chunck task do the job $( eval echo \${${compname}_Post_${FILE}_ChunckJob${Dimension}} )" (( i=i+3 )) continue fi fi # # We need coordinates axis to properly fill produced time series # IGCM_card_DefineArrayFromOption ${card} Post_${FILE} GatherWithInternal # if [ $( eval echo \${${compname}_Post_${FILE}_GatherWithInternal} ) = ${NULL_STR} ] ; then # IGCM_debug_Print 1 "ERROR !! We miss coordinate axis for ${FILE} according to ${card}" IGCM_debug_Print 1 "So no time series will be produced for ${FILE} !!" (( i=i+3 )) continue # fi # # We need LIST of variables not allready produced (useful for standalone mode) # FlagDir=$( echo ${FILE} | awk -F "_" '{print $1}' ) case ${FlagDir} in *Y) TS_Dir=TS_YE ;; *M) TS_Dir=TS_MO ;; *D) TS_Dir=TS_DA ;; HF) TS_Dir=TS_HF ;; INS) TS_Dir=TS_INS ;; esac # count=0 for var in $( eval echo \${${compname}_Post_${FILE}_TimeSeriesVars${Dimension}[*]} ) ; do # DIRECTORY=${R_SAVE}/${comp}/Analyse/${TS_Dir} TestedFile=${config_UserChoices_JobName}_${DateBegin}_${PeriodDateEnd}_${FlagDir}_${var}.nc # IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} if [ ! $? = 0 ] ; then eval set +A LISTE_VARS_${FILE} \${LISTE_VARS_${FILE}[*]} ${var} ActiveComp=true (( count = count + 1 )) fi done # if [ ${count} -gt 0 ] ; then # eval set +A LISTE_FILE_${comp} \${LISTE_FILE_${comp}[*]} ${FILE} eval set +A LISTE_AXIS_${FILE} \${${compname}_Post_${FILE}_GatherWithInternal[*]} # if [ ! X${RebuildFrequency} = Xtrue ] ; then IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches eval set +A LISTE_PATCHES_${FILE} \${${compname}_Post_${FILE}_Patches[*]} if [ X$( eval echo \${LISTE_PATCHES_${FILE}[0]} ) != X${NULL_STR} ]; then for Patch in $( eval echo \${LISTE_PATCHES_${FILE}[*]} ); do if [ Xload${Patch} != X ] ; then . ${libIGCM}/libIGCM_post/IGCM_${Patch}.ksh eval load${Patch}=loaded fi done fi fi fi fi (( i=i+3 )) done fi # if [ ${ActiveComp} = true ] ; then set +A ActiveListOfComponents ${ActiveListOfComponents[*]} ${comp} fi done set -A config_ListOfComponents ${ActiveListOfComponents[*]} [ ! -z "${ActiveListOfComponents}" ] && DoJob=true ######################################################################## # # DEFINE DATE FUNCTIONS # ######################################################################## # Give the end of the next $1 period from $2 date function create_ts_next_date { IGCM_debug_PushStack "create_ts_next_date" $@ typeset Length case ${config_UserChoices_PeriodLength} in *Y|*y) PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) IGCM_date_GetYearMonth ${1} year month (( Length=0 )) (( i=0 )) until [ $i -ge $PeriodLengthInYears ] ; do (( Length = Length + $( IGCM_date_DaysInYear $(( year + i + 1 )) ) )) (( i=i+1 )) done ;; *M|*m) PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) IGCM_date_GetYearMonth ${1} year month (( year0 = year )) if [ $(( month + 1 )) -lt 13 ] ; then month0=$(( month + 1 )) else month0=$(( month + 1 - 12 )) (( year = year0 + 1 )) fi (( Length=0 )) (( i=0 )) until [ $i -ge $PeriodLengthInMonths ] ; do if [ $(( month0 + i )) -lt 13 ] ; then (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i )) ) )) else (( year = year0 + 1 )) (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month0 + i - 12 )) ) )) fi (( i=i+1 )) done ;; *D|*d) Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; *) IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." IGCM_debug_Verif_Exit_Post ;; esac echo ${Length} IGCM_debug_PopStack "create_ts_next_date" } # Give the end of the actual $1 period from $2 date function create_ts_begin_date { IGCM_debug_PushStack "create_ts_begin_date" $@ typeset Length case ${config_UserChoices_PeriodLength} in *Y|*y) PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | awk -F '[yY]' '{print $1}' ) IGCM_date_GetYearMonth ${1} year month if [ X${2} = Xend ] ; then (( year = year - PeriodLengthInYears + 1)) fi (( Length=0 )) (( i=0 )) until [ $i -ge $PeriodLengthInYears ] ; do (( Length = Length + $( IGCM_date_DaysInYear $(( year + i )) ) )) (( i=i+1 )) done ;; *M|*m) PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | awk -F '[mM]' '{print $1}' ) IGCM_date_GetYearMonth ${1} year month if [ X${2} = Xend ] ; then (( month = month - PeriodLengthInMonths + 1 )) fi (( year0 = year )) if [ $month -le 0 ] ; then (( month = month + 12 )) year=$( printf "%04i\n" $(( year - 1 )) ) fi month=$( printf "%02i\n" ${month} ) (( Length=0 )) (( i=0 )) until [ $i -ge $PeriodLengthInMonths ] ; do if [ $(( month + i )) -lt 13 ] ; then (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i )) ) )) else (( year = year0 + 1 )) (( Length = Length + $( IGCM_date_DaysInMonth $year $(( month + i - 12 )) ) )) fi (( i=i+1 )) done ;; *D|*d) Length=$( echo ${config_UserChoices_PeriodLength} | sed -e "s/[dD]//" ) ;; *) IGCM_debug_Exit "create_ts " ${config_UserChoices_PeriodLength} " invalid PeriodLength : choose in 1Y, *M, *D." IGCM_debug_Verif_Exit_Post ;; esac echo ${Length} IGCM_debug_PopStack "create_ts_begin_date" } ######################################################################## # # IS THERE SOME ALLREADY PRODUCED TIME SERIES ? # IF SO BRING THEM IN THE WORKING DIRECTORY # # PS : Keep in mind that IGCM_sys_Get here is a weak link : # - especially for IDRiS # - no special protection against "command too long" ! # - libIGCM_sys should handle that or modify following code part # ######################################################################## if [ ${StandAlone} != true ] ; then Running_Flag=$( IGCM_sys_RshMaster "IGCM_card_DefineVariableFromOption \ ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning ; \ echo \${run_PostProcessing_TimeSeriesRunning}" ) #if [ X${Running_Flag} = Xy ] ; then # # Time Series Job allready running # IGCM_debug_Print 1 "Time Series Job allready running exit" # exit #fi # Now run.card know we are running IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "y" # Get information from last execution #CompletedFlag=$( IGCM_sys_RshMaster \ # "IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted ;\ # echo \${run_PostProcessing_TimeSeriesCompleted}" ) fi # Is it the first submission or not ? if ( [ X${CompletedFlag} = X ] || [ X${CompletedFlag} = X$( IGCM_date_AddDaysToGregorianDate ${DateBegin} -1 ) ] ) ; then # First Time Series Submission FIRST_PASS=TRUE Length=$( create_ts_begin_date ${DateBegin} begin) DATE_FIN_JOB_B=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( Length - 1 )) ) else # Last Completed Time Series FIRST_PASS=FALSE DATE_FIN_JOB_B=${CompletedFlag} date=${DateBegin}_${DATE_FIN_JOB_B} for comp in ${config_ListOfComponents[*]} ; do # IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp} # IGCM_sys_Cd ${RUN_DIR_PATH}/${comp} # #set -A liste_file unset liste_file # file_path=${R_SAVE}/${comp}/Analyse # i=0 file=${NULL_STR} # for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do # # Determine in which output can we find file # IE : Analyse/TS or Analyse/DA2TS or ... # FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) case ${FlagDir} in *Y) TS_Dir=TS_YE ;; *M) TS_Dir=TS_MO ;; *D) TS_Dir=TS_DA ;; HF) TS_Dir=TS_HF ;; INS) TS_Dir=TS_INS ;; esac for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do # #set +A liste_file ${liste_file[*]} ${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc liste_file[${#liste_file[*]}]=${file_path}/${TS_Dir}/${config_UserChoices_JobName}_${date}_${FlagDir}_${var}.nc # done done if [ X${file} != X${NULL_STR} ] ; then IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp} ExitFlag=false IGCM_debug_Verif_Exit_Post fi done # LEVEL=0 # fi ######################################################################## # # DEFINE LOOP PARAMETERS # ######################################################################## DATE_COUNT=${DATE_FIN_JOB_B} DATE_FIN_JOB_B_LOOP=${DATE_FIN_JOB_B} ( [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] ) && NBRE_FILE_TOT=0 || NBRE_FILE_TOT=1 if [ ${DoJob} = true ] ; then while [ ${DATE_COUNT} -lt ${PeriodDateEnd} ] ; do (( NBRE_FILE_TOT = NBRE_FILE_TOT + 1 )) Length=$( create_ts_next_date ${DATE_COUNT} ) DATE_COUNT=$( IGCM_date_AddDaysToGregorianDate ${DATE_COUNT} ${Length} ) done else NBRE_FILE_TOT=0 fi if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then NBRE_TOUR=1 elif [ ${NBRE_FILE_TOT}%${UNIX_MAX_LIMIT} -eq 0 ] ; then let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT} else let NBRE_TOUR=${NBRE_FILE_TOT}/${UNIX_MAX_LIMIT}+1 fi CURRENT_LOOP=1 # THIS LOOP GIVES PARAMETERS FOR THE DATE'S LOOP ie : DATE_COURANTE, DATE_FIN. # WE HAVE 3 LEVELS # - LEVEL 1 : JUST ONE LOOP TO COMPLETE # - LEVEL 2 : WE ARE IN THE "DEEP" LOOP # - LEVEL 3 : WE ARE IN THE LAST LOOP while [ ${CURRENT_LOOP} -le ${NBRE_TOUR} ] ; do if [ ${NBRE_FILE_TOT} -le ${UNIX_MAX_LIMIT} ] ; then # - LEVEL 1 : JUST ONE LOOP TO COMPLETE NBRE_FILE_LOOP=${NBRE_FILE_TOT} if [ ${FIRST_PASS} = TRUE ] ; then DATE_COURANTE=${DATE_FIN_JOB_B_LOOP} else Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} ) DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) fi DATE_FIN=${PeriodDateEnd} DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP=${DATE_LOOP} [ -n "${LEVEL}" ] && FLAG_B="TRUE" || FLAG_B="FALSE" LEVEL=1 DEPOT="TRUE" elif [ ${CURRENT_LOOP} -ne ${NBRE_TOUR} ] ; then # - LEVEL 2 : WE ARE IN THE "DEEP" LOOP NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} if [ ! ${FIRST_PASS} = TRUE ] && [ ${CURRENT_LOOP} -eq 1 ] ; then Length=$( create_ts_next_date ${DATE_FIN_JOB_B_LOOP} ) DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN_JOB_B_LOOP} ${Length} ) elif [ -z "${DATE_COURANTE}" ] ; then DATE_COURANTE=${DATE_FIN_JOB_B} else Length=$( create_ts_next_date ${DATE_FIN} ) DATE_COURANTE=$( IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) fi (( TotLength = 0 )) COMPTEUR=1 DATE_LOOP=${DATE_COURANTE} while [ ${COMPTEUR} -lt ${NBRE_FILE_LOOP} ] ; do # Length=$( create_ts_next_date ${DATE_LOOP} ) DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length} ) (( TotLength = TotLength + Length )) (( COMPTEUR = COMPTEUR + 1 )) # done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done DATE_FIN=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} ${TotLength} ) [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP} [ -n "${LEVEL}" ] && [ ${LEVEL} -eq 0 ] && FLAG_B="TRUE" || [ ${CURRENT_LOOP} -gt 1 ] && FLAG_B="TRUE" || FLAG_B="FALSE" DEPOT="FALSE" LEVEL=2 else # - LEVEL 3 : WE ARE IN THE LAST LOOP NBRE_FILE_LOOP=$(( ${NBRE_FILE_TOT} % ( ${UNIX_MAX_LIMIT} * ( ${CURRENT_LOOP} - 1 ) ) )) [ ${NBRE_FILE_LOOP} -eq 0 ] && NBRE_FILE_LOOP=${UNIX_MAX_LIMIT} Length=$( create_ts_next_date ${DATE_FIN} ) DATE_COURANTE=$(IGCM_date_AddDaysToGregorianDate ${DATE_FIN} ${Length} ) DATE_FIN=${PeriodDateEnd} [ -n "${DATE_LOOP}" ] && DATE_FIN_JOB_B_LOOP_PREC=${DATE_FIN_JOB_B_LOOP} ; DATE_FIN_JOB_B_LOOP=${DATE_LOOP} LEVEL=3 DEPOT="TRUE" FLAG_B="TRUE" fi # THEN FOR EACH FILE TYPE WE LOOP BETWEEN DATE_COURANTE AND DATE_FIN. for comp in ${config_ListOfComponents[*]} ; do # IGCM_sys_Mkdir ${RUN_DIR_PATH}/${comp} # IGCM_sys_Cd ${RUN_DIR_PATH}/${comp} # eval R_OUT_${comp}=${R_SAVE}/${comp} # i=0 # for file in $( eval echo \${LISTE_FILE_${comp}[*]} ); do # # Determine in which output can we find file # IE : Output/MO or Output/DA or ... # FlagDir=$( echo ${file} | awk -F "_" '{print $1}' ) case ${FlagDir} in *Y) TS_Dir=TS_YE ; FreqDir=YE ;; *M) TS_Dir=TS_MO ; FreqDir=MO ;; *D) TS_Dir=TS_DA ; FreqDir=DA ;; HF) TS_Dir=TS_HF ; FreqDir=HF ;; INS) TS_Dir=TS_INS ; FreqDir=INS ;; *) IGCM_debug_Print 1 "Error in FlagDir=${FlagDir} for file ${file}." IGCM_sys_Exit "Job create_ts" ;; esac # Initialize array #set -A liste_file #set -A liste_file_tmp unset liste_file unset liste_file_tmp eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/ COMPTEUR=1 DATE_LOOP=${DATE_COURANTE} while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] ; do # Length1=$( create_ts_begin_date ${DATE_LOOP} end) DATE_TAB=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} $(( 1 - Length1 )) )_${DATE_LOOP} Length2=$( create_ts_next_date ${DATE_LOOP} end) DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} ${Length2} ) #set +A liste_file ${liste_file[*]} ${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc #set +A liste_file_tmp ${liste_file_tmp[*]} ${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc liste_file[${#liste_file[*]}]=${file_path}${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc liste_file_tmp[${#liste_file_tmp[*]}]=${config_UserChoices_JobName}_${DATE_TAB}_${file}.nc (( COMPTEUR = COMPTEUR + 1 )) # done # while [ ${COMPTEUR} -le ${NBRE_FILE_LOOP} ] done DATE_LOOP=$( IGCM_date_AddDaysToGregorianDate ${DATE_LOOP} -${Length2} ) # Get selected files IGCM_sys_Get /l liste_file[*] ${RUN_DIR_PATH}/${comp} ExitFlag=false IGCM_debug_Verif_Exit_Post # Apply IGCM_Patch if needed if [ ! X${RebuildFrequency} = Xtrue ] ; then if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then for file_t in $( eval echo ${liste_file_tmp[*]} ); do for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do IGCM_${Patch} ${file_t} done done fi fi # WE CAN CONCATENATE FILES AT THIS POINT [ "${FLAG_B}" = "TRUE" ] && DATE_BUILD_B=${DateBegin}_${DATE_FIN_JOB_B_LOOP_PREC} Length=$( create_ts_begin_date ${DATE_COURANTE} end) DATE_BUILD1=$( IGCM_date_AddDaysToGregorianDate ${DATE_COURANTE} -$(( Length - 1 )) ) DATE_BUILD=${DATE_BUILD1}_${DATE_FIN} DATE_BUILD_END=${DateBegin}_${DATE_FIN} liste_coord=" " for axis in $( eval echo \${LISTE_AXIS_${file}[*]} ); do liste_coord=${liste_coord}${axis}"," done # Time axis must be the last dimension time_axis=${axis} # SWITCH BETWEEN MODEL TO FIT PARTICULAR CASE for var in $( eval echo \${LISTE_VARS_${file}[*]} ) ; do # IGCM_sys_ncrcat --hst -v ${liste_coord}${var} ${liste_file_tmp[*]} ${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc # # # Change time axis name to be CF compliant # if [ ${time_axis} != time_counter ]; then # IGCM_sys_ncrename -O -v ${time_axis},time_counter ${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc # fi # if [ "${FLAG_B}" = "TRUE" ] ; then # WE CONCATENATE WITH EXISTING FILES file1=${config_UserChoices_JobName}_${DATE_BUILD_B}_${FlagDir}_${var}.nc file2=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc file_out=${config_UserChoices_JobName}_${DATE_BUILD_END}_${FlagDir}_${var}.nc IGCM_sys_ncrcat --hst ${file1} ${file2} ${file_out} # IGCM_sys_Rm ${file1} ${file2} fi # if [ "${DEPOT}" = "TRUE" ] ; then # WE PUT FINAL FILE ON FILE SYSTEM [ "${FLAG_B}" = "FALSE" ] && file_out=${config_UserChoices_JobName}_${DATE_BUILD}_${FlagDir}_${var}.nc #${ncatted} -a modulo,time_counter,c,c," " ${file_out} file_before=${config_UserChoices_JobName}_${DateBegin}_${DATE_FIN_JOB_B}_${FlagDir}_${var}.nc eval IGCM_sys_Put_Out ${file_out} \${R_OUT_${comp}}/Analyse/${TS_Dir}/${file_out} [ "${FLAG_B}" = "TRUE" ] && eval MENAGE \${R_OUT_${comp}}/Analyse/${TS_Dir} ${file_before} ${file_out} IGCM_sys_Rm ${file_out} # fi # ExitFlag=false IGCM_debug_Verif_Exit_Post done # for var in ${liste_var} ; do IGCM_sys_Rm ${liste_file_tmp[*]} done # for file in ${liste_file_brut} do done # for comp in ${config_ListOfComponents[*]} ; do ExitFlag=false IGCM_debug_Verif_Exit_Post # GO AHEAD IN DEEPEST LOOP (( CURRENT_LOOP = CURRENT_LOOP + 1 )) done # while [ ${CURRENT_LOOP} -le ${NBRE_TOUR} ] do # FINISH # DODS copy for comp in ${config_ListOfComponents[*]} ; do for TS_Dir in TS_YE TS_MO TS_DA TS_HF TS_INS ; do IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/${TS_Dir} [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/${TS_Dir} done done export POST_DIR; export SUBMIT_DIR; export libIGCM; export R_INIT; export R_BC; export StandAlone export RESOL_ATM; export RESOL_OCE ; export RESOL_ICE ; export RESOL_MBG ; export RESOL_SRF ; export RESOL_BIOS listVarEnv="POST_DIR,SUBMIT_DIR,libIGCM,R_INIT,R_BC,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_MBG,RESOL_SRF,RESOL_BIOS" export listVarEnv #D- # -------------------------------------------------------------------- #D- Test if all was right # -------------------------------------------------------------------- IGCM_debug_Verif_Exit_Post # -------------------------------------------------------------------- #D- Submit MONITORING # -------------------------------------------------------------------- ( [ X${TsTask} = X2D ] || [ X${TsTask} = X ] ) && IGCM_sys_QsubPost monitoring #D- # -------------------------------------------------------------------- #D- Update the run.card # -------------------------------------------------------------------- if [ ${StandAlone} != true ] ; then # Put in run.card end period of time series IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesCompleted "${DATE_FIN}" # We have finish the job ! IGCM_sys_RshMaster IGCM_card_WriteOption ${SUBMIT_DIR}/run.card PostProcessing TimeSeriesRunning "n" fi date