#-Q- platine #!/usr/bin/ksh #-Q- platine ################### #-Q- platine ## PLATINE CEA ## #-Q- platine ################### #-Q- platine #BSUB -J SE # 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 = SE #-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 ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_SRF #-Q- sx8brodie # @ queue #-Q- sx8mercure #!/bin/ksh #-Q- sx8mercure ###################### #-Q- sx8mercure ## SX8MERCURE CEA ## #-Q- sx8mercure ###################### #-Q- sx8mercure #PBS -N SE # 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=1:00:00 # Limite temps a 1 heures #-Q- sx8mercure #PBS -q scalaire #-Q- default #!/bin/ksh #-Q- default ################## #-Q- default ## DEFAULT HOST ## #-Q- default ################## #set -vx date #-Q- sx8brodie export OMP_NUM_THREADS=1 # $Date$ # $Author$ # $Revision$ # IPSL (2006) # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC ######################################################################## #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 atlas 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:=/home/rech/ces/rces452/libIGCM} #D- TEMPORARY Flag to determine atmospheric resolution #D- Default : value from atmospheric driver if any RESOL_ATM=${RESOL_ATM:=LMD144142} #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- Flag to determine surface resolution #D- Default : value from surface driver if any RESOL_SRF=${RESOL_SRF:=LMD144142} ######################################################################## . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh ; . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh #; IGCM_debug_Check . ${libIGCM}/libIGCM_card/libIGCM_card.ksh #; IGCM_card_Check . ${libIGCM}/libIGCM_date/libIGCM_date.ksh #; IGCM_date_Check ######################################################################## #set -vx 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} # IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents # IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency # # Determine period for seasonnal average. Default : value from AA_job if any # DateBegin=${DateBegin:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )} # PeriodDateEnd=${PeriodDateEnd:=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )} # freq=$( echo ${config_Post_SeasonalFrequency} | sed -e "s/[yY]//" ) # an_fin=$( expr $( IGCM_date_ConvertGregorianDateToJulian $PeriodDateEnd ) / 1000 ) an_deb=$( IGCM_date_YearDigit $(( an_fin - freq + 1 )) ) an_fin=$( IGCM_date_YearDigit ${an_fin} ) # # For each component selected determine which files need post-processing # for comp in ${config_ListOfComponents[*]} ; do # 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 # eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1 typeset i=0 # until [ $i -eq $NbFiles ]; do # eval file_in_=\${${ListFilesName}[$i]} > /dev/null 2>&1 eval file_in=${file_in_} let $(( i_ = i+2 )) eval flag_post_=\${${ListFilesName}[$i_]} > /dev/null 2>&1 eval flag_post=${flag_post_} # if [ X${flag_post} != XNONE ] ; then # # Initialize ${flag_post}_${compname}_${post_freq} # eval export ${flag_post}_${compname}_SeasonalFrequency=true fi let $(( i=i+3 )) done fi for element in $( env | grep Post_ | grep ${compname}_SeasonalFrequency | grep -i "=true" ) ; do # FILE=$( echo ${element} | awk -F "_${compname}" '{print $1}' | awk "-FPost_" '{print $2}' ) # IGCM_card_DefineArrayFromOption ${card} Post_${FILE} Patches # # CREATE LIST # DIRECTORY=${R_SAVE}/${comp}/Analyse/SE # TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc # IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} if [ ! $? = 0 ] ; then eval set +A LISTE_FILE_${comp} \$\{LISTE_FILE_${comp}[*]} ${FILE} 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 # done # for element done # for comp for comp in ${config_ListOfComponents[*]} ; do # 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 1Y) FreqDir=YE ;; 1M) FreqDir=MO ;; 5D|1D) FreqDir=DA ;; HF) FreqDir=HF ;; INS) FreqDir=INS ;; esac # RESULT_SE=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${file}.nc # Do not redoo an existing SE IGCM_sys_TestFileArchive ${R_SAVE}/${comp}/Analyse/SE/${RESULT_SE} if [ $? = 0 ] ; then continue fi # eval file_path=\${R_OUT_${comp}}/Output/${FreqDir}/ # case ${config_UserChoices_PeriodLength} in # For Yearly simulation : 1Y|1y) (( an = an_deb )) # Initialize array #set -A liste_file_se #set -A liste_file_se_tmp unset liste_file_se unset liste_file_se_tmp while [ ${an} -le ${an_fin} ] ; do moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) # an4=$(printf "%04i\n" ${an} ) # diy=$( IGCM_date_DaysInYear $an4 ) afin=$( IGCM_date_AddDaysToGregorianDate ${an4}0101 $(( diy - 1 )) ) date=${an4}0101_${afin} #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc (( an = an + 1 )) done # IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} eval ExitFlag=false IGCM_debug_Verif_Exit_Post # Apply IGCM_Patch if needed if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do IGCM_${Patch} ${file_t} done done fi for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do # (( nb = ${mois} - 1 )) # OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc IGCM_sys_ncra -O -d time_counter,${nb},,12 ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} done IGCM_sys_Rm ${liste_file_se_tmp[*]} eval ExitFlag=false IGCM_debug_Verif_Exit_Post ;; # For Monthly simulation : 1M|1m) for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do # (( nb = ${mois} - 1 )) # OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc # (( an = an_deb )) # Initialize array #set -A liste_file_se #set -A liste_file_se_tmp unset liste_file_se unset liste_file_se_tmp while [ ${an} -le ${an_fin} ] ; do moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) # an4=$(printf "%04i\n" ${an} ) # date=${an4}${mois}01_${an4}${mois}${moisL} #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc (( an = an + 1 )) done # IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} eval ExitFlag=false IGCM_debug_Verif_Exit_Post # Apply IGCM_Patch if needed if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do IGCM_${Patch} ${file_t} done done fi IGCM_sys_ncra -O ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} IGCM_sys_Rm ${liste_file_se_tmp[*]} eval ExitFlag=false IGCM_debug_Verif_Exit_Post done ;; *D|*d) for mois in 01 02 03 04 05 06 07 08 09 10 11 12 ; do # (( nb = ${mois} - 1 )) # OUT_SE[${nb}]=${config_UserChoices_JobName}_SE${mois}_${an_deb}_${an_fin}_${file}.nc # (( an = an_deb )) # Initialize array #set -A liste_file_se #set -A liste_file_se_tmp unset liste_file_se unset liste_file_se_tmp while [ ${an} -le ${an_fin} ] ; do moisL=$( IGCM_date_DaysInMonth ${an} ${mois} ) # an4=$(printf "%04i\n" ${an} ) # length_d=$(( ${config_UserChoices_PeriodLength} - 1 )) # for one day if [ ${length_d} -eq 1 ] ; then (( length_d = 0 )) fi (( day = 1 )) while [ ${day} -le ${moisL} ] ; do day2=$(printf "%02i\n" ${day} ) day_beg=${an4}${mois}${day2} day_end=$( IGCM_date_AddDaysToGregorianDate ${day_beg} ${length_d} ) date=${an4}${mois}${day_beg}_${an4}${mois}${day_end} #set +A liste_file_se ${liste_file_se[*]} ${file_path}${config_UserChoices_JobName}_${date}_${file}.nc #set +A liste_file_se_tmp ${liste_file_se_tmp[*]} ${config_UserChoices_JobName}_${date}_${file}.nc liste_file_se[${#liste_file_se[*]}]=${file_path}${config_UserChoices_JobName}_${date}_${file}.nc liste_file_se_tmp[${#liste_file_se_tmp[*]}]=${config_UserChoices_JobName}_${date}_${file}.nc (( day = day + 1 )) done (( an = an + 1 )) done # IGCM_sys_Get /l liste_file_se[*] ${RUN_DIR_PATH} eval ExitFlag=false IGCM_debug_Verif_Exit_Post # Apply IGCM_Patch if needed if [ X$( eval echo \${LISTE_PATCHES_${file}[0]} ) != X${NULL_STR} ]; then for file_t in $( eval echo ${liste_file_se_tmp[*]} ); do for Patch in $( eval echo \${LISTE_PATCHES_${file}[*]} ); do IGCM_${Patch} ${file_t} done done fi IGCM_sys_ncra -O ${liste_file_se_tmp[*]} ${OUT_SE[${nb}]} IGCM_sys_Rm ${liste_file_se_tmp[*]} eval ExitFlag=false IGCM_debug_Verif_Exit_Post done ;; esac # IGCM_sys_ncrcat -O ${OUT_SE[*]} ${RESULT_SE} # IGCM_sys_Rm ${OUT_SE[*]} # ${ncatted} -a modulo,time_counter,c,c," " ${RESULT_SE} # eval IGCM_sys_Put_Out ${RESULT_SE} \${R_OUT_${comp}}/Analyse/SE/${RESULT_SE} IGCM_sys_Rm ${RESULT_SE} # eval ExitFlag=false IGCM_debug_Verif_Exit_Post done done # DODS copy for comp in ${config_ListOfComponents[*]} ; do IGCM_sys_TestDirArchive ${R_SAVE}/${comp}/Analyse/SE [ $? = 0 ] && IGCM_sys_Put_Dods ${comp}/Analyse/SE done YEARS=${an_deb}_${an_fin} # clean environment variables and export usefull one : if [ X$( hostname -s ) = Xrhodes ] ; then LISTE_ENV=$( env | grep -iv MYLANG | grep -iv HOST | grep -iv LOGIN | grep -iv config_ | grep -iv R_ | grep -iv libIGCM | grep -iv PERIOD \ | grep -iv DMFDIR | grep -iv AN_| grep -iv YEARS | grep -iv ex | grep -iv RESOL_ | grep -iv PATH | grep -iv WORKDIR | grep -iv USER \ | grep -iv LOGNAME | grep -iv PROFILE | grep -iv ENV | grep -iv TMPDIR | grep -iv POST_DIR | grep -iv DB |awk -F= '{print $1}' ) for variables in ${LISTE_ENV} ; do unset ${variables} done fi 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_SRF export R_SAVE; export config_UserChoices_JobName; export config_UserChoices_TagName; export YEARS; listVarEnv="POST_DIR,SUBMIT_DIR,libIGCM,R_INIT,R_BC,StandAlone,RESOL_ATM,RESOL_OCE,RESOL_ICE,RESOL_SRF,R_SAVE,config_UserChoices_JobName,config_UserChoices_TagName,YEARS" export listVarEnv; #D- # -------------------------------------------------------------------- #D- Test if all was right before ATLAS # -------------------------------------------------------------------- IGCM_debug_Verif_Exit_Post if [ ${config_UserChoices_TagName} = "IPSLCM4_v1_OASIS3" ] || \ [ ${config_UserChoices_TagName} = "IPSLCM4_v2" ] || \ [ ${config_UserChoices_TagName} = "IPSLCM5" ] || \ [ ${config_UserChoices_TagName} = "IPSL_ESM_V1" ] ; then # IGCM_sys_QsubPost atlas_ORCHIDEE ; IGCM_sys_QsubPost atlas_LMDZ ; IGCM_sys_QsubPost atlas_ORCA_LIM ; IGCM_sys_QsubPost additionnal ; # elif [ ${config_UserChoices_TagName} = "LMDZ4OR" ] || \ [ ${config_UserChoices_TagName} = "LMDZOR" ] || \ [ ${config_UserChoices_TagName} = "LMDZ4OR_v2" ] ; then # IGCM_sys_QsubPost atlas_LMDZ ; IGCM_sys_QsubPost atlas_ORCHIDEE ; # elif [ ${config_UserChoices_TagName} = "LMDZ" ] ; then # IGCM_sys_QsubPost atlas_LMDZ ; # elif [ ${config_UserChoices_TagName} = "OL" ] || \ [ ${config_UserChoices_TagName} = "OL2" ] ; then # IGCM_sys_QsubPost atlas_ORCHIDEE ; # elif [ ${config_UserChoices_TagName} = "ORCA2_LIM" ] ; then # IGCM_sys_QsubPost atlas_ORCA_LIM ; IGCM_sys_QsubPost additionnal ; # fi