123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- #!/usr/bin/env bash
- #SBATCH --job-name=nemreb
- #SBATCH --time=47:55:00
- #SBATCH --ntasks=24
- #SBATCH --mem-per-cpu=2048
- ##SBATCH --partition=debug
- #
- ##SBATCH --mail-user=noname@uclouvain.be
- ##SBATCH --mail-type=ALL
- ##SBATCH --open-mode=append
- set -ueo pipefail
- stdout_file=${SLURM_SUBMIT_DIR-$PWD}/${SLURM_JOB_NAME-"local"}_${SLURM_JOB_ID-"id"}.log
- exec > ${stdout_file}
- echo "------------------ Job Info --------------------"
- echo "jobid : ${SLURM_JOB_ID-"id"}"
- echo "jobname : ${SLURM_JOB_NAME-"local"}"
- echo "submit dir : ${SLURM_SUBMIT_DIR-$PWD}"
- set -ue
- exp="NE4_SP"
- cores="24"
- path_out="/scratch/ucl/elic/pbarriat/nemo/archive/${exp}"
- path_exe="/home/ucl/elic/pbarriat/modeles/nemo/nemo_dev_4/tools/REBUILD_NEMO"
- ###
- # Configure and load modules
- module purge
- module load netCDF-Fortran/4.5.3-gompi-2020b
- files=${path_out}/output/*
- dir=`echo $files | cut -d' ' -f1`
- cd ${dir}
- #
- file=`ls ${exp}_1m_*_grid_T_*.nc | tail -n 1`
- xios_split=`echo ${file%.nc} | rev | cut -d'_' -f1 | rev`
- xios_split=`expr $xios_split + 1`
- #
- for dir in ${files}
- do
- cd ${dir}
- #
- file=`ls ${exp}_1m_*_grid_T_0000.nc`
- to_year=`echo ${file%_grid_T_0000.nc} | rev | cut -d'_' -f1 | rev`
- from_year=`echo ${file%_grid_T_0000.nc} | rev | cut -d'_' -f2 | rev`
- #
- echo "In ${dir} :"
- echo "Processing ${exp}_1m_${from_year}_${to_year} ..."
- rm -f nam_rebuild_*
- rm -f ${exp}_1m_${from_year}_${to_year}_grid_T.nc
- rm -f ${exp}_1m_${from_year}_${to_year}_grid_U.nc
- rm -f ${exp}_1m_${from_year}_${to_year}_grid_V.nc
- rm -f ${exp}_1m_${from_year}_${to_year}_SBC.nc
- rm -f ${exp}_1m_${from_year}_${to_year}_icemod.nc
- if [ -s ${exp}_1m_${from_year}_${to_year}_grid_T_0000.nc ]
- then
- [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_T.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_T ${xios_split}
- fi
- if [ -s ${exp}_1m_${from_year}_${to_year}_grid_U_0000.nc ]
- then
- [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_U.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_U ${xios_split}
- fi
- if [ -s ${exp}_1m_${from_year}_${to_year}_grid_V_0000.nc ]
- then
- [[ ! -s ${exp}_1m_${from_year}_${to_year}_grid_V.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_grid_V ${xios_split}
- fi
- if [ -s ${exp}_1m_${from_year}_${to_year}_SBC_0000.nc ]
- then
- [[ ! -s ${exp}_1m_${from_year}_${to_year}_SBC.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_SBC ${xios_split}
- fi
- if [ -s ${exp}_1m_${from_year}_${to_year}_icemod_0000.nc ]
- then
- [[ ! -s ${exp}_1m_${from_year}_${to_year}_icemod.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_1m_${from_year}_${to_year}_icemod ${xios_split}
- fi
- done
- ###
- files=`ls ${path_out}/restart/ | tail -n 1`
- dir=${path_out}/restart/${files}
- cd ${dir}
- file=`ls ${exp}_*_restart_ice* | tail -n 1`
- nemo_split=`echo ${file%.nc} | rev | cut -d'_' -f1 | rev`
- nemo_split=`expr $nemo_split + 1`
- restart_step=`echo ${file%.nc} | rev | cut -d'_' -f4 | rev`
- echo "In ${dir} processing ${exp}_${restart_step}_restart_ice ..."
- rm -f ${exp}_${restart_step}_restart_ice.nc
- rm -f ${exp}_${restart_step}_restart_oce.nc
- if [ -s ${exp}_${restart_step}_restart_ice_0000.nc ]
- then
- [[ ! -s ${exp}_${restart_step}_restart_ice.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_${restart_step}_restart_ice ${nemo_split}
- fi
- if [ -s ${exp}_${restart_step}_restart_oce_0000.nc ]
- then
- [[ ! -s ${exp}_${restart_step}_restart_oce.nc ]] && ${path_exe}/rebuild_nemo -t ${cores} ${exp}_${restart_step}_restart_oce ${nemo_split}
- fi
- echo ----- REBUILD post finished
|