From fbb62e7301cee056b07d80942bb88d4109b216fc Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 20 Sep 2023 16:52:00 +0200 Subject: [PATCH 01/17] unique name for work directory for all four model and removing them in next run --- sources/ece3-toy-model/ifs_toy_model.yaml | 1 - tests/launch_ece3_data_coupler_mn4.cmd | 4 ++-- tests/launch_ece3_toy_model_mn4.cmd | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/sources/ece3-toy-model/ifs_toy_model.yaml b/sources/ece3-toy-model/ifs_toy_model.yaml index 0beb1db..2a15a0b 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/tests/launch_ece3_data_coupler_mn4.cmd b/tests/launch_ece3_data_coupler_mn4.cmd index 771dccb..343660c 100644 --- a/tests/launch_ece3_data_coupler_mn4.cmd +++ b/tests/launch_ece3_data_coupler_mn4.cmd @@ -35,9 +35,9 @@ 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 #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 +#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 +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 diff --git a/tests/launch_ece3_toy_model_mn4.cmd b/tests/launch_ece3_toy_model_mn4.cmd index 8ed9b73..c485d6d 100755 --- a/tests/launch_ece3_toy_model_mn4.cmd +++ b/tests/launch_ece3_toy_model_mn4.cmd @@ -19,15 +19,15 @@ set -xuve source ../sources/oasis3-mct/generated/python/init.sh ## -timestamp=$(date +%Y%m%d_%H%M%S) +model_names="ifs_nemo_runoff" # 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} +rundir=${testdir}/work_ece3_toy_model_${model_names} rm -rf $rundir mkdir -p $rundir -- GitLab From 964df13311e441a255fc80652c609cfc77015722 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Thu, 21 Sep 2023 16:50:48 +0200 Subject: [PATCH 02/17] platform-spesific modules are read from seperate file --- tests/launch_ece3_data_coupler_mn4.cmd | 16 ++-------------- tests/launch_ece3_toy_model_mn4.cmd | 23 +++++++++++++++++------ tests/modules_hpc2020.sh | 10 ++++++++++ tests/modules_mn4.sh | 7 +++++++ 4 files changed, 36 insertions(+), 20 deletions(-) create mode 100644 tests/modules_hpc2020.sh create mode 100644 tests/modules_mn4.sh diff --git a/tests/launch_ece3_data_coupler_mn4.cmd b/tests/launch_ece3_data_coupler_mn4.cmd index 343660c..d233eba 100644 --- a/tests/launch_ece3_data_coupler_mn4.cmd +++ b/tests/launch_ece3_data_coupler_mn4.cmd @@ -11,23 +11,11 @@ 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" + source modules_mn4.sh elif [ $platform = EC_HPC2020 ] ; then - 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 - + source modules_hpc2020.sh fi source ../sources/oasis3-mct/generated/python/init.sh diff --git a/tests/launch_ece3_toy_model_mn4.cmd b/tests/launch_ece3_toy_model_mn4.cmd index c485d6d..1fcf885 100755 --- a/tests/launch_ece3_toy_model_mn4.cmd +++ b/tests/launch_ece3_toy_model_mn4.cmd @@ -1,5 +1,4 @@ #!/bin/bash - # slurm specific options for Marenostrum4 #SBATCH --qos=debug #SBATCH -N 1 @@ -9,9 +8,21 @@ #SBATCH --exclusive #load python and netcdf modules -export PYTHONPATH="" -module load python/3.6.1 -module load netcdf/4.2 + + +platform="BSC_MN4" + +if [ $platform = BSC_MN4 ]; then + # Environment for MN4 + source modules_mn4.sh + export PYTHONPATH="" + +elif [ $platform = EC_HPC2020 ] ; then + + source modules_hpc2020.sh + +fi + set -xuve @@ -20,14 +31,14 @@ source ../sources/oasis3-mct/generated/python/init.sh ## -model_names="ifs_nemo_runoff" +exp_id="ifs_nemo_runoff" # 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_${model_names} +rundir=${testdir}/work_ece3_toy_model_${exp_id} rm -rf $rundir mkdir -p $rundir diff --git a/tests/modules_hpc2020.sh b/tests/modules_hpc2020.sh new file mode 100644 index 0000000..07095a8 --- /dev/null +++ b/tests/modules_hpc2020.sh @@ -0,0 +1,10 @@ +#!/bin/bash +# 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" +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 \ No newline at end of file diff --git a/tests/modules_mn4.sh b/tests/modules_mn4.sh new file mode 100644 index 0000000..73f9b14 --- /dev/null +++ b/tests/modules_mn4.sh @@ -0,0 +1,7 @@ +#!/bin/bash +# 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" -- GitLab From 2b5a65703b5652a7b86ffa136d042feb35d2e962 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Fri, 22 Sep 2023 09:43:50 +0200 Subject: [PATCH 03/17] Automatically detect and load platform-dependent path and modules for MN4 and HPC2020. --- sources/ece3-toy-model/runoff_toy_model.yaml | 1 - tests/launch_ece3_data_coupler_mn4.cmd | 11 ++----- tests/launch_ece3_toy_model_mn4.cmd | 17 ++--------- tests/modules.sh | 30 ++++++++++++++++++++ tests/modules_hpc2020.sh | 10 ------- tests/modules_mn4.sh | 7 ----- 6 files changed, 35 insertions(+), 41 deletions(-) create mode 100644 tests/modules.sh delete mode 100644 tests/modules_hpc2020.sh delete mode 100644 tests/modules_mn4.sh diff --git a/sources/ece3-toy-model/runoff_toy_model.yaml b/sources/ece3-toy-model/runoff_toy_model.yaml index e78f53b..5cdb334 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/launch_ece3_data_coupler_mn4.cmd b/tests/launch_ece3_data_coupler_mn4.cmd index d233eba..ca95732 100644 --- a/tests/launch_ece3_data_coupler_mn4.cmd +++ b/tests/launch_ece3_data_coupler_mn4.cmd @@ -6,17 +6,12 @@ #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 - source modules_mn4.sh -elif [ $platform = EC_HPC2020 ] ; then +# loading required modules and machine dependence paths on MN4 or HPC2020 +source modules.sh + - source modules_hpc2020.sh -fi source ../sources/oasis3-mct/generated/python/init.sh diff --git a/tests/launch_ece3_toy_model_mn4.cmd b/tests/launch_ece3_toy_model_mn4.cmd index 1fcf885..8650d2c 100755 --- a/tests/launch_ece3_toy_model_mn4.cmd +++ b/tests/launch_ece3_toy_model_mn4.cmd @@ -7,21 +7,8 @@ #SBATCH -t 0:05:00 #SBATCH --exclusive -#load python and netcdf modules - - -platform="BSC_MN4" - -if [ $platform = BSC_MN4 ]; then - # Environment for MN4 - source modules_mn4.sh - export PYTHONPATH="" - -elif [ $platform = EC_HPC2020 ] ; then - - source modules_hpc2020.sh - -fi +# loading required modules and machine dependence paths on MN4 or HPC2020 +source modules.sh set -xuve diff --git a/tests/modules.sh b/tests/modules.sh new file mode 100644 index 0000000..838f850 --- /dev/null +++ b/tests/modules.sh @@ -0,0 +1,30 @@ +#!/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" + +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" + 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 + echo "HPC2020 modules are loaded" + +else + echo "Error: Platform is unkown, could not load required moduleds." + exit 1 + +fi \ No newline at end of file diff --git a/tests/modules_hpc2020.sh b/tests/modules_hpc2020.sh deleted file mode 100644 index 07095a8..0000000 --- a/tests/modules_hpc2020.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/bin/bash -# 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" -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 \ No newline at end of file diff --git a/tests/modules_mn4.sh b/tests/modules_mn4.sh deleted file mode 100644 index 73f9b14..0000000 --- a/tests/modules_mn4.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -# 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" -- GitLab From 0090db58e0ba7df52a99208f56b4314128973ccd Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Fri, 22 Sep 2023 12:50:49 +0200 Subject: [PATCH 04/17] WIP: relative path for mn4 & hpc2020 --- ...h_ece3_data_coupler_mn4.cmd => launch_ece3_data_coupler.cmd} | 0 ...{launch_ece3_toy_model_mn4.cmd => launch_ece3_toy_model.cmd} | 2 +- tests/modules.sh | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) rename tests/{launch_ece3_data_coupler_mn4.cmd => launch_ece3_data_coupler.cmd} (100%) rename tests/{launch_ece3_toy_model_mn4.cmd => launch_ece3_toy_model.cmd} (92%) diff --git a/tests/launch_ece3_data_coupler_mn4.cmd b/tests/launch_ece3_data_coupler.cmd similarity index 100% rename from tests/launch_ece3_data_coupler_mn4.cmd rename to tests/launch_ece3_data_coupler.cmd diff --git a/tests/launch_ece3_toy_model_mn4.cmd b/tests/launch_ece3_toy_model.cmd similarity index 92% rename from tests/launch_ece3_toy_model_mn4.cmd rename to tests/launch_ece3_toy_model.cmd index 8650d2c..a94256d 100755 --- a/tests/launch_ece3_toy_model_mn4.cmd +++ b/tests/launch_ece3_toy_model.cmd @@ -21,8 +21,8 @@ source ../sources/oasis3-mct/generated/python/init.sh exp_id="ifs_nemo_runoff" # prepare rundir -datadir=/gpfs/scratch/bsc32/bsc32051/git/python-amip-reader/tests/data/ece3-toy-model testdir=`pwd` +datadir=$testdir/data/ece3-toy-model srcdir=$testdir/../sources/ece3-toy-model rundir=${testdir}/work_ece3_toy_model_${exp_id} diff --git a/tests/modules.sh b/tests/modules.sh index 838f850..902709f 100644 --- a/tests/modules.sh +++ b/tests/modules.sh @@ -18,7 +18,6 @@ elif [ $ECPLATFORM = hpc2020 ]; then 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 echo "HPC2020 modules are loaded" -- GitLab From 9d0aaa9bab1145fb0ecab4420d5637cddb3503c9 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Fri, 22 Sep 2023 14:25:24 +0200 Subject: [PATCH 05/17] WIP:including /data/ece_toy_model to the repo. --- .gitignore | 4 ++-- tests/data/ece3-toy-model/grid-runoff.txt | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 tests/data/ece3-toy-model/grid-runoff.txt diff --git a/.gitignore b/.gitignore index d9c2eab..0496a3b 100644 --- a/.gitignore +++ b/.gitignore @@ -6,7 +6,7 @@ work_* sources/oasis3-mct/generated __pycache__ -tests/data// +#tests/data// tests/.coverage* tests/data/primavera/ tests/htmlcov @@ -14,7 +14,7 @@ tests/.gitignore tests/amip.yaml.sh 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 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 0000000..5cdc9ac --- /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 -- GitLab From 831bb7d9f18388596800bbb29706cc5b31be4f8b Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Fri, 22 Sep 2023 14:28:53 +0200 Subject: [PATCH 06/17] WIP:hpc2020 --- tests/modules.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/modules.sh b/tests/modules.sh index 902709f..813f1d5 100644 --- a/tests/modules.sh +++ b/tests/modules.sh @@ -21,6 +21,7 @@ elif [ $ECPLATFORM = hpc2020 ]; then 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="" else echo "Error: Platform is unkown, could not load required moduleds." -- GitLab From 064fa23e2e809da2a5c8df699d804c2d52cf39fd Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Fri, 22 Sep 2023 12:32:26 +0000 Subject: [PATCH 07/17] datacoupler & toy_model run on bash on hpc2020 and mn4 --- tests/launch_ece3_data_coupler.cmd | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/launch_ece3_data_coupler.cmd b/tests/launch_ece3_data_coupler.cmd index ca95732..42f2f08 100644 --- a/tests/launch_ece3_data_coupler.cmd +++ b/tests/launch_ece3_data_coupler.cmd @@ -16,11 +16,11 @@ 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 +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 +#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 -- GitLab From 2733daef43c0f08f3ee5e6d771a0a9e1b464374f Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Fri, 22 Sep 2023 15:32:25 +0200 Subject: [PATCH 08/17] WIP: minor chnages to module load --- tests/launch_ece3_data_coupler.cmd | 3 --- tests/launch_ece3_toy_model.cmd | 6 ------ tests/modules.sh | 4 ++++ 3 files changed, 4 insertions(+), 9 deletions(-) diff --git a/tests/launch_ece3_data_coupler.cmd b/tests/launch_ece3_data_coupler.cmd index 42f2f08..84ecb86 100644 --- a/tests/launch_ece3_data_coupler.cmd +++ b/tests/launch_ece3_data_coupler.cmd @@ -12,9 +12,6 @@ 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 #AMIP Forcing + co2flux diff --git a/tests/launch_ece3_toy_model.cmd b/tests/launch_ece3_toy_model.cmd index a94256d..8105881 100755 --- a/tests/launch_ece3_toy_model.cmd +++ b/tests/launch_ece3_toy_model.cmd @@ -10,14 +10,8 @@ # loading required modules and machine dependence paths on MN4 or HPC2020 source modules.sh - set -xuve -# setup pyOasis environment -source ../sources/oasis3-mct/generated/python/init.sh - -## - exp_id="ifs_nemo_runoff" # prepare rundir diff --git a/tests/modules.sh b/tests/modules.sh index 813f1d5..d089610 100644 --- a/tests/modules.sh +++ b/tests/modules.sh @@ -10,6 +10,8 @@ if [ $BSC_MACHINE = mn4 ]; then 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 @@ -22,6 +24,8 @@ elif [ $ECPLATFORM = hpc2020 ]; then 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." -- GitLab From 254bb48b90b175670717a8637e3355880fa6f23d Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Tue, 26 Sep 2023 09:38:13 +0200 Subject: [PATCH 09/17] purge .nc files and adding them to gitignore --- .gitignore | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.gitignore b/.gitignore index 0496a3b..9c54255 100644 --- a/.gitignore +++ b/.gitignore @@ -19,4 +19,16 @@ tests/data/grids-amip.nc tests/data/masks-amip.nc tests/data/test_word_break.sh tests/data/tmp1.nc +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_A128_to_O1t0_GAUSWGT_9.nc +tests/data/ece3-toy-model/rmp_A128_to_O1u0_GAUSWGT_9.nc +tests/data/ece3-toy-model/rmp_A128_to_O1v0_GAUSWGT_9.nc +tests/data/ece3-toy-model/rmp_O1t0_to_L128_GAUSWGT_9.nc +tests/data/ece3-toy-model/rmp_R128_to_RnfA_GAUSWGT_9.nc +tests/data/ece3-toy-model/rmp_RnfO_to_O1t0_GAUSWGT_9.nc +tests/data/ece3-toy-model/rstas2.nc +tests/data/ece3-toy-model/rstas.nc +tests/data/ece3-toy-model/rstos.nc sources/oasis3-mct/util/make_dir/make.inc -- GitLab From 7539ee2d12d1a722666782ce2fd000ec046a5842 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Tue, 26 Sep 2023 15:31:44 +0200 Subject: [PATCH 10/17] removing files and adding them to gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 9c54255..d4ad834 100644 --- a/.gitignore +++ b/.gitignore @@ -31,4 +31,6 @@ tests/data/ece3-toy-model/rmp_RnfO_to_O1t0_GAUSWGT_9.nc 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 -- GitLab From 690e8de005bb49454a8f78ac7fdb03d3afd4229e Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Tue, 26 Sep 2023 15:36:15 +0200 Subject: [PATCH 11/17] small change to README file --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index c776881..f98d227 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. In this case `A_Ice_frac.gif` and `A_Ice_frac_optimized.gif` are generated. -- GitLab From a30c0eb2552fd1879f539ed257c5dbf457eeae39 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Tue, 26 Sep 2023 14:50:00 +0000 Subject: [PATCH 12/17] WIP: tm. & dc. run on HPC2020 slurm --- tests/launch_ece3_data_coupler_hpc2020.cmd | 22 +++++++++++ tests/launch_ece3_data_coupler_mn4.cmd | 22 +++++++++++ tests/launch_ece3_toy_model_hpc2020.cmd | 44 +++++++++++++++++++++ tests/launch_ece3_toy_model_mn4.cmd | 46 ++++++++++++++++++++++ 4 files changed, 134 insertions(+) create mode 100644 tests/launch_ece3_data_coupler_hpc2020.cmd create mode 100644 tests/launch_ece3_data_coupler_mn4.cmd create mode 100644 tests/launch_ece3_toy_model_hpc2020.cmd create mode 100644 tests/launch_ece3_toy_model_mn4.cmd diff --git a/tests/launch_ece3_data_coupler_hpc2020.cmd b/tests/launch_ece3_data_coupler_hpc2020.cmd new file mode 100644 index 0000000..98c1056 --- /dev/null +++ b/tests/launch_ece3_data_coupler_hpc2020.cmd @@ -0,0 +1,22 @@ +#!/bin/bash + +# loading 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 new file mode 100644 index 0000000..57f197e --- /dev/null +++ b/tests/launch_ece3_data_coupler_mn4.cmd @@ -0,0 +1,22 @@ +#!/bin/bash + +# loading SLURM configuration for MN4 +#SBATCH --qos=debug +#SBATCH -N 1 +#SBATCH -n 3 +#SBATCH -c 1 +#SBATCH -t 0:05:00 +#SBATCH --exclusive + + +# 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_toy_model_hpc2020.cmd b/tests/launch_ece3_toy_model_hpc2020.cmd new file mode 100644 index 0000000..3eea105 --- /dev/null +++ b/tests/launch_ece3_toy_model_hpc2020.cmd @@ -0,0 +1,44 @@ +#!/bin/bash + +# Environment for HPC2020 +#SBATCH --qos=nf +#SBATCH --ntasks=3 +#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 + +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 + + diff --git a/tests/launch_ece3_toy_model_mn4.cmd b/tests/launch_ece3_toy_model_mn4.cmd new file mode 100644 index 0000000..302aaf9 --- /dev/null +++ b/tests/launch_ece3_toy_model_mn4.cmd @@ -0,0 +1,46 @@ +#!/bin/bash + +# loading SLURM configuration for MN4 +#SBATCH --qos=debug +#SBATCH -N 1 +#SBATCH -n 3 +#SBATCH -c 1 +#SBATCH -t 0:05:00 +#SBATCH --exclusive + + +# 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 + + -- GitLab From a25a6de44d75d6f4615876ff831a8226820d13ae Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 27 Sep 2023 08:43:36 +0200 Subject: [PATCH 13/17] Remove files that were purged but accidentally restored in the last commit --- .gitignore | 3 --- README.md | 2 -- 2 files changed, 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8625e3c..ab1a03f 100644 --- a/.gitignore +++ b/.gitignore @@ -19,9 +19,7 @@ tests/data/grids-amip.nc tests/data/masks-amip.nc tests/data/test_word_break.sh tests/data/tmp1.nc -<<<<<<< HEAD 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 @@ -37,4 +35,3 @@ 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 ->>>>>>> 690e8de005bb49454a8f78ac7fdb03d3afd4229e diff --git a/README.md b/README.md index 0bb45f7..ee91182 100644 --- a/README.md +++ b/README.md @@ -491,7 +491,6 @@ Optionally, you may want to save visualization as a GIF file. In order to achiev ```bash ./nc_to_gif.py work_python_forcing_4_1990-01-01_1991-01-01_0_L128_true A_Ice_frac -<<<<<<< HEAD ``` Here is the complete specification for the script: @@ -511,4 +510,3 @@ Here is the complete specification for the script: ``` 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. ->>>>>>> 690e8de005bb49454a8f78ac7fdb03d3afd4229e -- GitLab From fe729f450b86235a3e16ac0b1406e71b565f6f6d Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 27 Sep 2023 11:49:17 +0200 Subject: [PATCH 14/17] Test run on MN4; remove redundant batch scripts and consolidate similar Slurm configurations for MN4 and HPC2020. --- .gitignore | 12 +++---- tests/launch-hpc2020.cmd | 27 ---------------- tests/launch_ece3_data_coupler.cmd | 30 ------------------ tests/launch_ece3_data_coupler_mn4.cmd | 12 +++---- tests/launch_ece3_toy_model.cmd | 43 -------------------------- tests/launch_ece3_toy_model_mn4.cmd | 12 +++---- 6 files changed, 15 insertions(+), 121 deletions(-) delete mode 100644 tests/launch-hpc2020.cmd delete mode 100644 tests/launch_ece3_data_coupler.cmd delete mode 100755 tests/launch_ece3_toy_model.cmd diff --git a/.gitignore b/.gitignore index ab1a03f..6710568 100644 --- a/.gitignore +++ b/.gitignore @@ -6,12 +6,15 @@ 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/ @@ -23,12 +26,7 @@ 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_A128_to_O1t0_GAUSWGT_9.nc -tests/data/ece3-toy-model/rmp_A128_to_O1u0_GAUSWGT_9.nc -tests/data/ece3-toy-model/rmp_A128_to_O1v0_GAUSWGT_9.nc -tests/data/ece3-toy-model/rmp_O1t0_to_L128_GAUSWGT_9.nc -tests/data/ece3-toy-model/rmp_R128_to_RnfA_GAUSWGT_9.nc -tests/data/ece3-toy-model/rmp_RnfO_to_O1t0_GAUSWGT_9.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 diff --git a/tests/launch-hpc2020.cmd b/tests/launch-hpc2020.cmd deleted file mode 100644 index de3a7af..0000000 --- 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.cmd b/tests/launch_ece3_data_coupler.cmd deleted file mode 100644 index 84ecb86..0000000 --- a/tests/launch_ece3_data_coupler.cmd +++ /dev/null @@ -1,30 +0,0 @@ -#!/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 - - -# 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 - -# 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_data_coupler_mn4.cmd b/tests/launch_ece3_data_coupler_mn4.cmd index 57f197e..42dbb1c 100644 --- a/tests/launch_ece3_data_coupler_mn4.cmd +++ b/tests/launch_ece3_data_coupler_mn4.cmd @@ -1,13 +1,11 @@ #!/bin/bash -# loading SLURM configuration for MN4 +# Environment for MN4 #SBATCH --qos=debug -#SBATCH -N 1 -#SBATCH -n 3 -#SBATCH -c 1 -#SBATCH -t 0:05:00 -#SBATCH --exclusive - +#SBATCH --ntasks=5 +#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 diff --git a/tests/launch_ece3_toy_model.cmd b/tests/launch_ece3_toy_model.cmd deleted file mode 100755 index 8105881..0000000 --- a/tests/launch_ece3_toy_model.cmd +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/bash -# slurm specific options for Marenostrum4 -#SBATCH --qos=debug -#SBATCH -N 1 -#SBATCH -n 3 -#SBATCH -c 1 -#SBATCH -t 0:05:00 -#SBATCH --exclusive - -# 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 - diff --git a/tests/launch_ece3_toy_model_mn4.cmd b/tests/launch_ece3_toy_model_mn4.cmd index 302aaf9..14f7ce4 100644 --- a/tests/launch_ece3_toy_model_mn4.cmd +++ b/tests/launch_ece3_toy_model_mn4.cmd @@ -1,13 +1,11 @@ #!/bin/bash -# loading SLURM configuration for MN4 +# Environment 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 # loading required modules and machine dependence paths on MN4 or HPC2020 source modules.sh -- GitLab From 23a8dce9fac8821bd4556ffa077b58e56d80c7c3 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 27 Sep 2023 14:04:56 +0200 Subject: [PATCH 15/17] minor changes to launch scripts --- README.md | 121 +------------------------ tests/launch_ece3_data_coupler_mn4.cmd | 11 +-- tests/launch_ece3_toy_model_mn4.cmd | 37 +------- tests/run_data_coupler.sh | 12 +++ tests/run_toy_model.sh | 35 +++++++ 5 files changed, 52 insertions(+), 164 deletions(-) create mode 100755 tests/run_data_coupler.sh create mode 100755 tests/run_toy_model.sh diff --git a/README.md b/README.md index ee91182..97aef96 100644 --- a/README.md +++ b/README.md @@ -128,7 +128,6 @@ Below is an example of the old `namelist.amip` file used for AMIP forcing in EC LDebug = false !----------------------------------------------------------------------- / -<<<<<<< HEAD ``` #### Backwards compatibility @@ -238,117 +237,6 @@ on ECMWF HPC2020 : /hpcperm/c3et/work/python-amip-reader Due to the large size of some of the required files and datasets, they are not provided in this repository. It is necessary to download them from MN4 before executing any code. Use the following script to download the required files (note you must change `bsc32074` to your username in MN4): ```bash -======= -``` - -#### Backwards compatibility -The new AMIP reader is backwards compatible with both EC Earth v3.3.3.1 and EC Earth v3.2.2 (PRIMAVERA production) namelist files. It achieves this by internally converting the configuration from the old namelist files to the new representation when reading the namelist file (source code in function `read_namelist()` in [`amip_utils.py`](./sources/amip-forcing/src/python/amip_utils.py)). Here is the internal conversion of the SST coupling field when using each old namelist file: - -##### EC Earth v3.3.3.1 (AMIP forcing) -| Property | Value | -| ---------- | ----------------------- | -| id | `'AMIP_sst_monthly'` | -| grid_name | `'AMIP'` | -| oasis_name | `'AMIP_sst'` | -| file_pattern | `FileListSST` content from the old namelist file. | -| netcdf_variable | `'tosbcs'` | -| yref_min | `1870` | -| yref_max | `2016` | The last year of the netCDF files. | -| timestep | `'monthly'` | -| interpolate | `LInterpolate` content from the old namelist file. | -| scale_factor | `1` | -| offset | `273.15` | -| min | `271.38` | -| max | `None` | - -##### EC Earth v3.2.2 (PRIMAVERA production) -| Property | Value | -| ---------- | ----------------------- | -| id | `'AMIP_sst_daily'` | -| grid_name | `'PSST'` | -| oasis_name | `'AMIP_sst'` | -| file_pattern | `AmipFileRoot` content from the old namelist file appending `'_sst_[year].nc'`. | -| netcdf_variable | `'sst'` | -| yref_min | `1850` | -| yref_max | `2016` | The last year of the netCDF files. | -| timestep | `'daily'` | -| interpolate | `False` | -| scale_factor | `1` | -| offset | `0` | -| min | `None` | -| max | `None` | - -### Add a new field -Adding a new field solely consists on adding the input netCDF files to the runtime folder of the program and adding a new entry to the `Vars(:,:)` field in the namelist following the structure mentioned above (see the [new namelist file](#new-namelist-file) section). - -#### Input netCDF files -All input netCDF files must contain the following variables (assuming the dimensions `time`, `lat` and `lon` are defined): - -| Variable | Type | Shape | Description | -| --------- | ------ | ------------------------ | ------------------------- | -| `time` | `double` | `(time)` | Days since the reference year defined as `yref_min` in its namelist entry. | -| `lat` or `latitude` | `double` | `(lat)` | Latitude. | -| `lon` or `longitude` | `double` | `(lon)` | Longitude. | -| Input variable name | `double` or `float` | `(time, ..., lat, lon)` | The variable name must match the `netcdf_variable` value in its namelist entry. | - -### Hardcode an operation (inner workings) -If it is necessary to hardcode an operation with respect to one of the coupling fields, it is highly recommended to edit the code within the [`AMIPVar` class](sources/amip-forcing/src/python/amip_var.py). Right now, there are already hardcoded operations used to match the old Fortran implementation or read an specific index of the input netCDF variable. Here are some examples: - -```python -logging.debug('{}: no time interpolation t,t2 {} {}'.format(self.id, t_local, self.t2)) -# Hardcoded to match Fortran's AMIP clipping avoidance -if self.oasis_name == 'AMIP_sst': - var_min = np.NINF -``` - -```python -# This section can be "hardcoded" by the user -# Hardcoded CO2 emissions data. Read only sector id 1: Energy -if self.var_name == 'CO2_em_anthro': - raw_field = raw_field[1] -``` - -While the Python implementation was originally inspired by the Fortran implementation, it has now been refactored to take advantage of Python's OOP and simpler modules. For a deeper understanding, here are the simplified sequence and class diagrams of the current implementation. - -![Sequence_Diagram](docs/Sequence_Diagram.png) - -![Class_Diagram](docs/Class_Diagram.png) - -## Run an example -Running an example consists on executing one of the implementations (Fortran or Python) along with an IFS tyo model. This toy model simulates IFS reception behavior as designed in EC Earth v3.3.3.1. The detailed specification can be found below, with the coupling interval and run length taken directly from the `namelist.amip` file. -```python -# Constants -NAMELIST_FILE_NAME = 'namelist.amip' -L080_NX = 35718 # number of LAND grid cells at T159 resolution -L128_NX = 88838 # number of LAND grid cells at T255 resolution -L256_NX = 348528 # number of LAND grid cells at T511 resolution -``` - -**IMPORTANT NOTICE: This documentation assumes you are running an UNIX-based OS with Python +3.6 in the PATH, understand the basics of OASIS and are able to compile and run pyOASIS.** - -The bash scripts for running the examples rely on the command `cdo` for checking the results. In order to install this dependency, you may execute the following code. -```bash -apt install -y cdo -``` -Or if running in MN4: -```bash -module load cdo/1.9.3 -``` - -### Download the datasets - -The easiest way to download the datasets is to copy the datasets to your copy from 2 folders `tests/data/forcing/ and tests/data/co2/ from @etourign located here: - -on BSC marenostrum4 : /gpfs/scratch/bsc32/bsc32051/git/python-amip-reader - -on ECMWF HPC2020 : /hpcperm/c3et/work/python-amip-reader - - -### Download the datasets (deprecated) - -Due to the large size of some of the required files and datasets, they are not provided in this repository. It is necessary to download them from MN4 before executing any code. Use the following script to download the required files (note you must change `bsc32074` to your username in MN4): -```bash ->>>>>>> 690e8de005bb49454a8f78ac7fdb03d3afd4229e scp -r bsc32074@mn1.bsc.es:/gpfs/projects/bsc32/models/ecearth/v3.3.3.1/inidata/oasis/AMIP/* ./tests/data/forcing scp -r bsc32074@mn1.bsc.es:/gpfs/projects/bsc32/models/ecearth/v3.3.3.1/inidata/amip-forcing/* ./tests/data/forcing # PRIMAVERA dataset @@ -433,17 +321,10 @@ Here is the complete specification for the script: ``` Running this script will create a new folder in the root folder of this repository called `work________` with all the output and debug information from the run. -<<<<<<< HEAD ## Run the tests Execute the following command in the root folder of this repository to run all tests **except the large test** (make sure to meet all the [requirements](#requirements) stated above). -======= - -## Run the tests -Execute the following command in the root folder of this repository to run all tests **except the large test** (make sure to meet all the [requirements](#requirements) stated above). - ->>>>>>> 690e8de005bb49454a8f78ac7fdb03d3afd4229e If you are on MN4, it is highly recommended to start first an interactive session: ``` salloc -p interactive @@ -501,7 +382,7 @@ Here is the complete specification for the script: 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) -======= + ``` Here is the complete specification for the script: diff --git a/tests/launch_ece3_data_coupler_mn4.cmd b/tests/launch_ece3_data_coupler_mn4.cmd index 42dbb1c..52f44c3 100644 --- a/tests/launch_ece3_data_coupler_mn4.cmd +++ b/tests/launch_ece3_data_coupler_mn4.cmd @@ -7,14 +7,7 @@ #SBATCH -t 0:10:00 #SBATCH --hint=nomultithread -# loading required modules and machine dependence paths on MN4 or HPC2020 -source modules.sh +# Runing the data coupler script +./run_data_coupler.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_toy_model_mn4.cmd b/tests/launch_ece3_toy_model_mn4.cmd index 14f7ce4..a3f71a1 100644 --- a/tests/launch_ece3_toy_model_mn4.cmd +++ b/tests/launch_ece3_toy_model_mn4.cmd @@ -7,38 +7,5 @@ #SBATCH -t 0:10:00 #SBATCH --hint=nomultithread -# 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 - - +# Runing the toy model script +./run_toy_model.sh diff --git a/tests/run_data_coupler.sh b/tests/run_data_coupler.sh new file mode 100755 index 0000000..70fb1c3 --- /dev/null +++ b/tests/run_data_coupler.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# 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 \ 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 0000000..cc21581 --- /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 -- GitLab From 56ba824228c045dea2b86ef8257cc88d305c04f3 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 27 Sep 2023 14:47:21 +0200 Subject: [PATCH 16/17] minor chnage to launch script for MR10! --- tests/launch_ece3_data_coupler_hpc2020.cmd | 3 +- tests/launch_ece3_data_coupler_mn4.cmd | 13 ++++++-- tests/launch_ece3_toy_model_hpc2020.cmd | 39 ++-------------------- tests/launch_ece3_toy_model_mn4.cmd | 4 ++- tests/run_data_coupler.sh | 12 ------- 5 files changed, 17 insertions(+), 54 deletions(-) delete mode 100755 tests/run_data_coupler.sh diff --git a/tests/launch_ece3_data_coupler_hpc2020.cmd b/tests/launch_ece3_data_coupler_hpc2020.cmd index 98c1056..52c2b67 100644 --- a/tests/launch_ece3_data_coupler_hpc2020.cmd +++ b/tests/launch_ece3_data_coupler_hpc2020.cmd @@ -1,6 +1,6 @@ #!/bin/bash -# loading SLURM configuration for HPC2020 +# SLURM configuration for HPC2020 #SBATCH --qos=nf #SBATCH --ntasks=6 #SBATCH --cpus-per-task=1 @@ -8,7 +8,6 @@ #SBATCH --hint=nomultithread - # loading required modules and machine dependence paths on MN4 or HPC2020 source modules.sh diff --git a/tests/launch_ece3_data_coupler_mn4.cmd b/tests/launch_ece3_data_coupler_mn4.cmd index 52f44c3..99e7fe6 100644 --- a/tests/launch_ece3_data_coupler_mn4.cmd +++ b/tests/launch_ece3_data_coupler_mn4.cmd @@ -1,13 +1,20 @@ #!/bin/bash -# Environment for MN4 +# SLURM configuration for MN4 #SBATCH --qos=debug #SBATCH --ntasks=5 #SBATCH --cpus-per-task=1 #SBATCH -t 0:10:00 #SBATCH --hint=nomultithread -# Runing the data coupler script -./run_data_coupler.sh +# 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_toy_model_hpc2020.cmd b/tests/launch_ece3_toy_model_hpc2020.cmd index 3eea105..8fab4e9 100644 --- a/tests/launch_ece3_toy_model_hpc2020.cmd +++ b/tests/launch_ece3_toy_model_hpc2020.cmd @@ -1,44 +1,11 @@ #!/bin/bash -# Environment for HPC2020 +# SLURM configuration for HPC2020 #SBATCH --qos=nf #SBATCH --ntasks=3 #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 - -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 - - +# 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 index a3f71a1..8809b16 100644 --- a/tests/launch_ece3_toy_model_mn4.cmd +++ b/tests/launch_ece3_toy_model_mn4.cmd @@ -1,6 +1,6 @@ #!/bin/bash -# Environment for MN4 +# SLURM configuration for MN4 #SBATCH --qos=debug #SBATCH --ntasks=3 #SBATCH --cpus-per-task=1 @@ -9,3 +9,5 @@ # Runing the toy model script ./run_toy_model.sh + + diff --git a/tests/run_data_coupler.sh b/tests/run_data_coupler.sh deleted file mode 100755 index 70fb1c3..0000000 --- a/tests/run_data_coupler.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -# 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 \ No newline at end of file -- GitLab From 9591700835ce962e3a54456705561efddbe484b7 Mon Sep 17 00:00:00 2001 From: Amirpasha Mozaffari Date: Wed, 27 Sep 2023 16:01:11 +0200 Subject: [PATCH 17/17] minor chnage to READ.ME --- README.md | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/README.md b/README.md index 97aef96..825948b 100644 --- a/README.md +++ b/README.md @@ -379,15 +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) - -``` - -Here is the complete specification for the script: -```bash -./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. +Running the script will generate two files: a raw GIF file and an optimized one. -- GitLab