forked from CMCC-Foundation/ccs_config_cmcc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request CMCC-Foundation#11 from daniele-peano/dev/NemoMulti
Add rebuild nemo in the workflow and its template
- Loading branch information
Showing
2 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#!/usr/bin/bash -l | ||
{{ batchdirectives }} | ||
#. ~/.bashrc | ||
|
||
# activate needed env | ||
module purge | ||
module load anaconda | ||
conda activate nemo_rebuild | ||
module load --auto oneapi-2022.1.0/compiler-rt/2022.1.0 intel-2021.6.0/2021.6.0 impi-2021.6.0/2021.6.0 intel-2021.6.0/curl/7.85.0-djjip intel-2021.6.0/cmake/3.25.1-7wfsx intel-2021.6.0/perl/5.36.0-jj4hw intel-2021.6.0/perl-xml-libxml/2.0201-shybf intel-2021.6.0/xerces-c/3.2.3-witnt oneapi-2022.1.0/tbb/2021.6.0 oneapi-2022.1.0/mkl/2022.1.0 intel-2021.6.0/impi-2021.6.0/hdf5/1.13.3-76cip intel-2021.6.0/impi-2021.6.0/netcdf-c/4.9.0-qbuoy intel-2021.6.0/impi-2021.6.0/netcdf-fortran/4.6.0-gohn7 intel-2021.6.0/impi-2021.6.0/parallel-netcdf/1.12.3-eshb5 intel-2021.6.0/impi-2021.6.0/xios/2.5-36kwn intel-2021.6.0/impi-2021.6.0/parallelio/2.6.0-tc4q3 intel-2021.6.0/impi-2021.6.0/esmf/8.4.2-pioext_2.6.0-dnjmu intel-2021.6.0/impi-2021.6.0/parmetis/4.0.3-ocsgn | ||
|
||
set -euvx | ||
CASEROOT={{ caseroot }} | ||
cd $CASEROOT | ||
#get case name and cores dedicated to ocean model from xml files | ||
CASE=`./xmlquery CASE|cut -d ':' -f2|sed 's/ //g'` | ||
NTASK=`./xmlquery NTASKS_OCN |cut -d ':' -f2|sed 's/ //g'` | ||
# this is the number of parallel postprocessign you want to set and must be a an integer | ||
N=$((NTASK/10)) | ||
CIME_OUTPUT_ROOT=`./xmlquery CIME_OUTPUT_ROOT|cut -d ':' -f2|sed 's/ //g'` | ||
NEMO_REBUILD_ROOT=`./xmlquery NEMO_REBUILD_ROOT|cut -d ':' -f2|sed 's/ //g'` | ||
# add your frequencies and grids. The script skip them if not present | ||
for frq in 1m 1d | ||
do | ||
for grd in T U V W | ||
do | ||
nfile=`ls $CIME_OUTPUT_ROOT/archive/$CASE/ocn/hist/${CASE}_${frq}_*grid_${grd}_0000.nc|wc -l` | ||
if [[ $nfile -eq 0 ]] | ||
then | ||
continue | ||
fi | ||
# this should be independent from expID and general | ||
data_now=`ls -t $CIME_OUTPUT_ROOT/archive/$CASE/ocn/hist/${CASE}_${frq}_*grid_${grd}_0000.nc|tail -1|rev|cut -d '_' -f4-5|rev` | ||
mpirun -n $N python -m mpi4py $NEMO_REBUILD_ROOT/py_nemo_rebuild/src/py_nemo_rebuild/nemo_rebuild.py -i $CIME_OUTPUT_ROOT/archive/$CASE/ocn/hist/${CASE}_${frq}_${data_now}_grid_${grd} | ||
stat=$? | ||
# if correctly merged remove single files | ||
if [[ $stat -eq 0 ]] | ||
then | ||
rm $CIME_OUTPUT_ROOT/archive/$CASE/ocn/hist/${CASE}_${frq}_${data_now}_grid_${grd}_0???.nc | ||
fi | ||
done | ||
done |