diff --git a/.gitignore b/.gitignore index d9c2eab0c84fe46503c4e4193f8584b8b0b6b0ce..671056823a03468d57fc442ceefaced77bcdd6c9 100644 --- a/.gitignore +++ b/.gitignore @@ -6,17 +6,30 @@ work_* sources/oasis3-mct/generated __pycache__ -tests/data// +tests/slurm-* tests/.coverage* tests/data/primavera/ tests/htmlcov tests/.gitignore tests/amip.yaml.sh +tests/data/ICMGGa22e+000000 +tests/data/grids-noamip.nc +tests/data/masks-noamip.nc tests/data/areas-amip.nc tests/data/bak/ -tests/data/ece3-toy-model/ +#tests/data/ece3-toy-model/ tests/data/grids-amip.nc tests/data/masks-amip.nc tests/data/test_word_break.sh tests/data/tmp1.nc sources/oasis3-mct/util/make_dir/make.inc +tests/data/ece3-toy-model/areas.nc +tests/data/ece3-toy-model/grids.nc +tests/data/ece3-toy-model/masks.nc +tests/data/ece3-toy-model/rmp_* +tests/data/ece3-toy-model/rstas2.nc +tests/data/ece3-toy-model/rstas.nc +tests/data/ece3-toy-model/rstos.nc +tests/data/areas-noamip.nc +sources/oasis3-mct/util/make_dir/make.inc +docs/A_Ice_frac_optimized.gif diff --git a/README.md b/README.md index c776881ac7a45afa576243d2ce0fbc2cf96a4a70..825948b87e8e607f8b2f2cab7fa700d021432b87 100644 --- a/README.md +++ b/README.md @@ -379,6 +379,4 @@ Here is the complete specification for the script: ./nc_to_gif.py ``` -Running the script will generate two files: a raw GIF file and an optimized one. In this case `A_Ice_frac.gif` and `A_Ice_frac_optimized.gif` are generated. `A_Ice_frac_optimized.gif` is displayed below: - -![A_Ice_frac_optimized](docs/A_Ice_frac_optimized.gif) +Running the script will generate two files: a raw GIF file and an optimized one. diff --git a/sources/ece3-toy-model/ifs_toy_model.yaml b/sources/ece3-toy-model/ifs_toy_model.yaml index 0beb1dbe9a634df7be7ad0cd195c627c7e3bc473..2a15a0ba3c0c2eea593c960c84e911b5b21d82cc 100644 --- a/sources/ece3-toy-model/ifs_toy_model.yaml +++ b/sources/ece3-toy-model/ifs_toy_model.yaml @@ -19,7 +19,6 @@ simulation: coupling: out_vars : [A_TauX_oce, A_TauY_oce, A_TauX_ice, A_TauY_ice, A_Qns_mix, A_Qs_mix, A_Evap_total, A_Precip_liquid, A_Precip_solid, A_Qs_ice, A_Qns_ice, A_dQns_dT, A_Evap_ice, A_Runoff, A_Calving] - in_vars : [A_SST, A_Ice_temp, A_Ice_albedo, A_Ice_frac, A_Ice_thickness, A_Snow_thickness] restart_file : /path/ diff --git a/sources/ece3-toy-model/runoff_toy_model.yaml b/sources/ece3-toy-model/runoff_toy_model.yaml index e78f53ba63c066d551e1a94227edcd33ee68161d..5cdb3344ac3779f0fd12ace654f0d221978480c0 100644 --- a/sources/ece3-toy-model/runoff_toy_model.yaml +++ b/sources/ece3-toy-model/runoff_toy_model.yaml @@ -15,7 +15,6 @@ simulation: coupling: out_vars : [R_Runoff_oce, R_Calving_oce] - in_vars : [R_Runoff_atm, R_Calving_atm] restart_file : /path/ diff --git a/tests/data/ece3-toy-model/grid-runoff.txt b/tests/data/ece3-toy-model/grid-runoff.txt new file mode 100644 index 0000000000000000000000000000000000000000..5cdc9aca11e6a12a9b8faaa85703d2f1877ef573 --- /dev/null +++ b/tests/data/ece3-toy-model/grid-runoff.txt @@ -0,0 +1,7 @@ +# +# gridID 1 +# +gridtype = generic +gridsize = 131072 +xsize = 512 +ysize = 256 diff --git a/tests/launch-hpc2020.cmd b/tests/launch-hpc2020.cmd deleted file mode 100644 index de3a7af1492972e0b9aa3227464daa25dd6a6a8f..0000000000000000000000000000000000000000 --- a/tests/launch-hpc2020.cmd +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash -#SBATCH --qos=nf -#SBATCH --ntasks=6 -#SBATCH --cpus-per-task=1 -#SBATCH -t 0:10:00 - -module reset -#module load python3/3.8.8-01 prgenv/intel intel/2021.4.0 intel-mkl/19.0.5 hpcx-openmpi/2.9.0 hdf5-parallel/1.10.6 netcdf4-parallel/4.7.4 cdo -module load python3/3.10.10-01 prgenv/intel intel/2021.4.0 hpcx-openmpi/2.9.0 hdf5-parallel/1.12.2 netcdf4-parallel/4.9.1 cdo -module list -export MPIRUN="mpirun -oversubscribe" - -source ../sources/oasis3-mct/generated/python/init.sh - -export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${NETCDF4_PARALLEL_DIR}/lib:${ECCODES_DIR}/lib:${HDF5_DIR}/lib" -echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH - -#bash ./run_example.sh pythoncompat forcing 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example.sh fortran forcing 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example-t1279.sh python forcing 4 2010-01-01 2010-03-01 0 128 true -#bash ./run_example.sh datacoupler co2 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example.sh python co2 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true false - -bash ./run_example.sh co2box co2 4 2005-01-01 2005-05-01 0 128 true false -#bash ./run_example.sh fortran forcing 4 2005-01-01 2005-03-01 0 128 true false diff --git a/tests/launch_ece3_data_coupler_hpc2020.cmd b/tests/launch_ece3_data_coupler_hpc2020.cmd new file mode 100644 index 0000000000000000000000000000000000000000..52c2b673dd45920c504cae453aebf7fb8d27ebcb --- /dev/null +++ b/tests/launch_ece3_data_coupler_hpc2020.cmd @@ -0,0 +1,21 @@ +#!/bin/bash + +# SLURM configuration for HPC2020 +#SBATCH --qos=nf +#SBATCH --ntasks=6 +#SBATCH --cpus-per-task=1 +#SBATCH -t 0:10:00 +#SBATCH --hint=nomultithread + + +# loading required modules and machine dependence paths on MN4 or HPC2020 +source modules.sh + + +#AMIP Forcing only +#bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml +#AMIP Forcing + co2flux +bash ./run_example.sh datacoupler co2flux 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml +#co2box only +#bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml + diff --git a/tests/launch_ece3_data_coupler_mn4.cmd b/tests/launch_ece3_data_coupler_mn4.cmd index 771dccbe1a2c9330604eeafc253dd30619ca97a0..99e7fe61da07678760c1783e84c0daf7c2230f14 100644 --- a/tests/launch_ece3_data_coupler_mn4.cmd +++ b/tests/launch_ece3_data_coupler_mn4.cmd @@ -1,36 +1,16 @@ #!/bin/bash -# slurm specific options for MN4 -#SBATCH --qos=debug -#SBATCH -N 1 -#SBATCH -n 5 -#SBATCH -c 1 -#SBATCH -t 0:05:00 -#SBATCH --exclusive -# Please indicate the machine that is in use. for now only includes "BSC_MN4" & "EC_HPC2020" -platform="BSC_MN4" - -if [ $platform = BSC_MN4 ]; then - # Environment for MN4 - module load python/3.6.1 - module load netcdf/4.2 - module load CDO/1.9.3 - module list - export MPIRUN="mpirun" -elif [ $platform = EC_HPC2020 ] ; then +# SLURM configuration for MN4 +#SBATCH --qos=debug +#SBATCH --ntasks=5 +#SBATCH --cpus-per-task=1 +#SBATCH -t 0:10:00 +#SBATCH --hint=nomultithread - module reset - #module load python3/3.8.8-01 prgenv/intel intel/2021.4.0 intel-mkl/19.0.5 hpcx-openmpi/2.9.0 hdf5-parallel/1.10.6 netcdf4-parallel/4.7.4 cdo - module load python3/3.10.10-01 prgenv/intel intel/2021.4.0 hpcx-openmpi/2.9.0 hdf5-parallel/1.12.2 netcdf4-parallel/4.9.1 cdo - module list - export MPIRUN="mpirun -oversubscribe" - source ../sources/oasis3-mct/generated/python/init.sh - export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${NETCDF4_PARALLEL_DIR}/lib:${ECCODES_DIR}/lib:${HDF5_DIR}/lib" - echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH -fi +# loading required modules and machine dependence paths on MN4 or HPC2020 +source modules.sh -source ../sources/oasis3-mct/generated/python/init.sh #AMIP Forcing only #bash ./run_example.sh datacoupler forcing 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_forcing.yaml @@ -38,13 +18,3 @@ source ../sources/oasis3-mct/generated/python/init.sh bash ./run_example.sh datacoupler co2flux 4 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2flux.yaml #co2box only #bash ./run_example.sh datacoupler co2box 1 2005-01-01 2005-03-01 0 128 true false template_conf_datacoupler_co2box.yaml - -# old tests, TODO test them -#bash ./run_example.sh pythoncompat forcing 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example.sh fortran forcing 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example-t1279.sh python forcing 4 2010-01-01 2010-03-01 0 128 true -#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true false -#bash ./run_example.sh python co2 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true -#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true false -#bash ./run_example.sh co2box co2 4 2005-01-01 2005-05-01 0 128 true false diff --git a/tests/launch_ece3_toy_model_hpc2020.cmd b/tests/launch_ece3_toy_model_hpc2020.cmd new file mode 100644 index 0000000000000000000000000000000000000000..8fab4e9885f1dd7f2130e4b747ff39571a05888a --- /dev/null +++ b/tests/launch_ece3_toy_model_hpc2020.cmd @@ -0,0 +1,11 @@ +#!/bin/bash + +# SLURM configuration for HPC2020 +#SBATCH --qos=nf +#SBATCH --ntasks=3 +#SBATCH --cpus-per-task=1 +#SBATCH -t 0:10:00 +#SBATCH --hint=nomultithread + +# Runing the toy model script +./run_toy_model.sh diff --git a/tests/launch_ece3_toy_model_mn4.cmd b/tests/launch_ece3_toy_model_mn4.cmd old mode 100755 new mode 100644 index 8ed9b73933229abbfad8c736b7dd76eaf9e81808..8809b16ace4b59df8b4881183ded9dd0723f8913 --- a/tests/launch_ece3_toy_model_mn4.cmd +++ b/tests/launch_ece3_toy_model_mn4.cmd @@ -1,51 +1,13 @@ #!/bin/bash -# slurm specific options for Marenostrum4 +# SLURM configuration for MN4 #SBATCH --qos=debug -#SBATCH -N 1 -#SBATCH -n 3 -#SBATCH -c 1 -#SBATCH -t 0:05:00 -#SBATCH --exclusive +#SBATCH --ntasks=3 +#SBATCH --cpus-per-task=1 +#SBATCH -t 0:10:00 +#SBATCH --hint=nomultithread -#load python and netcdf modules -export PYTHONPATH="" -module load python/3.6.1 -module load netcdf/4.2 +# Runing the toy model script +./run_toy_model.sh -set -xuve - -# setup pyOasis environment -source ../sources/oasis3-mct/generated/python/init.sh - -## -timestamp=$(date +%Y%m%d_%H%M%S) - - -# prepare rundir -datadir=/gpfs/scratch/bsc32/bsc32051/git/python-amip-reader/tests/data/ece3-toy-model -testdir=`pwd` -srcdir=$testdir/../sources/ece3-toy-model - -rundir=${testdir}/work_ece3_toy_model_${timestamp} - -rm -rf $rundir -mkdir -p $rundir - -for f in masks.nc grids.nc areas.nc rstas.nc rstos.nc; do - cp -f $datadir/$f $rundir -done -cp -f $datadir/rmp* $rundir -cp -f $srcdir/*.py $rundir -cp -f $srcdir/namcouple $rundir -cp -f $srcdir/*.yaml $rundir - -toy_model="toy_model.py" - -echo "prep is finished" - -cd $rundir - -# run IFS+NEMO+runoff toy model -mpirun -np 1 python3 ${rundir}/${toy_model} --conf ifs_toy_model.yaml : -np 1 python3 ${rundir}/${toy_model} --conf nemo_toy_model.yaml : -np 1 python3 ${rundir}/${toy_model} --conf runoff_toy_model.yaml diff --git a/tests/modules.sh b/tests/modules.sh new file mode 100644 index 0000000000000000000000000000000000000000..d089610ff034101d860411c3d54c68a1043137f6 --- /dev/null +++ b/tests/modules.sh @@ -0,0 +1,34 @@ +#!/bin/bash + + +if [ $BSC_MACHINE = mn4 ]; then + # Environment for MN4 + module load python/3.6.1 + module load netcdf/4.2 + module load CDO/1.9.3 + module list + export MPIRUN="mpirun" + export PYTHONPATH="" + echo "MN4 modules are loaded" + # setup pyOasis environment + source ../sources/oasis3-mct/generated/python/init.sh + +elif [ $ECPLATFORM = hpc2020 ]; then + # Environment for HPC2020 + module reset + #module load python3/3.8.8-01 prgenv/intel intel/2021.4.0 intel-mkl/19.0.5 hpcx-openmpi/2.9.0 hdf5-parallel/1.10.6 netcdf4-parallel/4.7.4 cdo + module load python3/3.10.10-01 prgenv/intel intel/2021.4.0 hpcx-openmpi/2.9.0 hdf5-parallel/1.12.2 netcdf4-parallel/4.9.1 cdo + module list + export MPIRUN="mpirun -oversubscribe" + export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${NETCDF4_PARALLEL_DIR}/lib:${ECCODES_DIR}/lib:${HDF5_DIR}/lib" + echo LD_LIBRARY_PATH: $LD_LIBRARY_PATH + echo "HPC2020 modules are loaded" + export PYTHONPATH="" + # setup pyOasis environment + source ../sources/oasis3-mct/generated/python/init.sh + +else + echo "Error: Platform is unkown, could not load required moduleds." + exit 1 + +fi \ No newline at end of file diff --git a/tests/run_toy_model.sh b/tests/run_toy_model.sh new file mode 100755 index 0000000000000000000000000000000000000000..cc215814e2fea382df8c13cb913e9d6ec168ceaf --- /dev/null +++ b/tests/run_toy_model.sh @@ -0,0 +1,35 @@ +#!/bin/bash + +# loading required modules and machine dependence paths on MN4 or HPC2020 +source modules.sh + +set -xuve + +exp_id="ifs_nemo_runoff" + +# prepare rundir +testdir=`pwd` +datadir=$testdir/data/ece3-toy-model +srcdir=$testdir/../sources/ece3-toy-model + +rundir=${testdir}/work_ece3_toy_model_${exp_id} + +rm -rf $rundir +mkdir -p $rundir + +for f in masks.nc grids.nc areas.nc rstas.nc rstos.nc; do + cp -f $datadir/$f $rundir +done +cp -f $datadir/rmp* $rundir +cp -f $srcdir/*.py $rundir +cp -f $srcdir/namcouple $rundir +cp -f $srcdir/*.yaml $rundir + +toy_model="toy_model.py" + +echo "prep is finished" + +cd $rundir + +# run IFS+NEMO+runoff toy model +mpirun -np 1 python3 ${rundir}/${toy_model} --conf ifs_toy_model.yaml : -np 1 python3 ${rundir}/${toy_model} --conf nemo_toy_model.yaml : -np 1 python3 ${rundir}/${toy_model} --conf runoff_toy_model.yaml