From ad8d2596654a2ca4d97519ec5f4b64a5c4fb170a Mon Sep 17 00:00:00 2001 From: Etienne Tourigny Date: Tue, 4 Jul 2023 16:21:00 +0200 Subject: [PATCH 1/2] fix run_example.sh namelist output --- tests/run_example.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/run_example.sh b/tests/run_example.sh index 7318d9d..04008e1 100755 --- a/tests/run_example.sh +++ b/tests/run_example.sh @@ -154,10 +154,10 @@ else fi if [ ${CO2_EMODE} == true ] ; then # this is the 3D monthly emissions used for ECE4, the calendar fix mentionned below is probably required - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_em_monthly', 'CO2_emis', '"$mod"_CO2_emis', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 1, 0, , ,true,true," + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_em_monthly', 'CO2_emis', '"$mod"_CO2_emis', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 1, 0, , ,true,true,"$'\n' # add land/ocean fluxes equal to 0.5/0.1 that of emissions, for demonstration purposes - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_land_monthly', 'CO2_emis', '"$mod"_CO2_land', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.5, 0, , ,true,true," - co2_conf_var+=${var}"("$((i++))",:) = 'CO2_ocean_monthly', 'CO2_emis', '"$mod"_CO2_ocean', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.1, 0, , ,true,true," + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_land_monthly', 'CO2_emis', '"$mod"_CO2_land', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.5, 0, , ,true,true,"$'\n' + co2_conf_var+=${var}"("$((i++))",:) = 'CO2_ocean_monthly', 'CO2_emis', '"$mod"_CO2_ocean', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.1, 0, , ,true,true,"$'\n' fi j=1 #OasisOutputVars(i,:) = -- GitLab From 6df17a1103f1717a5621b6d44d03f2ddf33895a3 Mon Sep 17 00:00:00 2001 From: Etienne Tourigny Date: Tue, 4 Jul 2023 17:16:58 +0200 Subject: [PATCH 2/2] fixes for model=datacoupler and amip_mode=co2 --- tests/data/namcouple_co2.sh | 9 ++++---- tests/data/namelist_python.amip.sh | 1 + tests/launch-mn4.cmd | 8 +++++-- tests/run_example.sh | 34 +++++++++++++++++++++--------- 4 files changed, 36 insertions(+), 16 deletions(-) diff --git a/tests/data/namcouple_co2.sh b/tests/data/namcouple_co2.sh index 92bf6f0..8e7212b 100644 --- a/tests/data/namcouple_co2.sh +++ b/tests/data/namcouple_co2.sh @@ -31,11 +31,12 @@ cat << EOF SCRIPR CONSERV GAUSWGT LR SCALAR LATITUDE 1 9 2.0 - AMIP_CO2_cconc:AMIP_CO2_econc A_CO2_cconc:A_CO2_econc 1 86400 1 rstas.nc EXPOUT - CO2_conc CO2_conc LAG=0 + AMIP_CO2_land:AMIP_CO2_ocean A_CO2_land:A_CO2_ocean 1 86400 1 rstas.nc EXPOUT + CO2_emis B${ifs_grid} LAG=0 P 0 P 0 - LOCTRANS - AVERAGE + SCRIPR CONSERV + GAUSWGT LR SCALAR LATITUDE 1 9 2.0 + # ------------------------------------------------------------------------------------------------- \$END # ================================================================================================= diff --git a/tests/data/namelist_python.amip.sh b/tests/data/namelist_python.amip.sh index 995be21..d135769 100755 --- a/tests/data/namelist_python.amip.sh +++ b/tests/data/namelist_python.amip.sh @@ -11,6 +11,7 @@ cat << EOF ${sst_conf_var} ${sic_conf_var} ${co2_conf_var} +${oasis_conf_var} LDebug = false !----------------------------------------------------------------------- / diff --git a/tests/launch-mn4.cmd b/tests/launch-mn4.cmd index 2385c1a..95c5fd6 100644 --- a/tests/launch-mn4.cmd +++ b/tests/launch-mn4.cmd @@ -16,8 +16,12 @@ source ../sources/oasis3-mct/generated/python/init.sh #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 datacoupler co2 4 2005-01-01 2005-03-01 0 128 true false +#bash ./run_example.sh co2box co2 4 2005-01-01 2005-03-01 0 128 true false + +#bash ./run_example.sh datacoupler forcing 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 +#bash ./run_example.sh co2box co2 4 2005-01-01 2005-05-01 0 128 true false diff --git a/tests/run_example.sh b/tests/run_example.sh index 04008e1..dcb068f 100755 --- a/tests/run_example.sh +++ b/tests/run_example.sh @@ -131,15 +131,31 @@ else #if [ $amip_mode = forcing ] || [ $amip_mode = co2 ]; then if [ $amip_mode = forcing ] || [ $amip_mode = co2 ]; then i=1 - [ $model = co2box ] && var=FileInputVars || var=Vars + if [ $model = co2box ] || [ $model = datacoupler ]; then + var=FileInputVars + else + var=Vars + fi sst_conf_var=${var}"("$((i++))",:) = 'AMIP_sst_monthly', 'AMIP', 'AMIP_sst', 'tosbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc', 'tosbcs', 1870, 2016, 'monthly', ${amip_interpolate}, 1, 273.15, 271.38, ,true,true," sic_conf_var=${var}"("$((i++))",:) = 'AMIP_sic_monthly', 'AMIP', 'AMIP_sic', 'siconcbcs_input4MIPs_SSTsAndSeaIce_CMIP_PCMDI-AMIP-1-1-3_gn_187001-201706.nc', 'siconcbcs', 1870, 2016, 'monthly', ${amip_interpolate}, 0.01, 0, 0, 1,true,true," - co2_conf_var="" - co2_conf_var+="!FileInputVars(i,:) = "$'\n' + + j=1 + oasis_conf_var="!OasisOutputVars(j,:) = , , , , , \n" + oasis_conf_var=$'\n'"OasisOutputVars("$((j++))",:) = 'AMIP_sst', 'AMIP', 'daily', 1, 0, true," + oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = 'AMIP_sic', 'AMIP', 'daily', 1, 0, true," if [ $amip_mode = co2 ]; then - [ $model = co2box ] && mod=CO2BOX || mod=AMIP - CO2_CMODE=true # set to false to disable co2 concentrations reading - CO2_EMODE=true # set to false to disable emissions reading + co2_conf_var="" + co2_conf_var+="!FileInputVars(i,:) = "$'\n' + #[ $model = co2box ] && mod=CO2BOX || mod=AMIP + if [ $model = co2box ] ; then + mod=CO2BOX + CO2_CMODE=true # set to false to disable co2 concentrations reading + CO2_EMODE=true # set to false to disable emissions reading + else + mod=AMIP + CO2_CMODE=false # don't change this! + CO2_EMODE=true # don't change this! + fi #this fix is required to correctly read the co2 files which havereftime 0-1-1, which isn't supported by python netcdf4 #cdo -R -setreftime,1849-01-01,00:00 mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc mole-fraction-of-carbon-dioxide-in-air_input4MIPs_GHGConcentrations_CMIP_UoM-CMIP-1-2-0_gr1-GMNHSH_184901-201412.nc.mod #this fix is required to correctly read the CO2_em_monthly files which have a 365day calendar and also to convert from a grid point/sectors fields to a global one @@ -159,10 +175,7 @@ else co2_conf_var+=${var}"("$((i++))",:) = 'CO2_land_monthly', 'CO2_emis', '"$mod"_CO2_land', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.5, 0, , ,true,true,"$'\n' co2_conf_var+=${var}"("$((i++))",:) = 'CO2_ocean_monthly', 'CO2_emis', '"$mod"_CO2_ocean', 'CO2-em-anthro_input4MIPs_emissions_CMIP_CEDS-2017-05-18_gn_200001-201412.nc', 'CO2_em_anthro', 1750, 2018, 'monthly', ${co2_interpolate}, 0.1, 0, , ,true,true,"$'\n' fi - j=1 #OasisOutputVars(i,:) = - oasis_conf_var="OasisOutputVars("$((j++))",:) = 'AMIP_sst', 'AMIP', 'daily', 1, 0, true," - oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = 'AMIP_sic', 'AMIP', 'daily', 1, 0, true," if [ ${CO2_CMODE} == true ] ; then oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_cconc', 'GLOBAL', 'daily', 1, 0, true," oasis_conf_var+=$'\n'"OasisOutputVars("$((j++))",:) = '"$mod"_CO2_econc', 'GLOBAL', 'daily', 'co2_mass_to_ppm', 0, false," @@ -175,11 +188,12 @@ else fi else co2_conf_var="" - oasis_conf_var="" fi else sst_conf_var="Vars(1,:) = 'AMIP_sst_daily', 'PSST', 'AMIP_sst', 'HadISST2_prelim_0to360_alldays_sst_[year].nc', 'sst', 1850, 2016, 'daily', false, 1, 0, , ," sic_conf_var="Vars(2,:) = 'AMIP_sic_daily', 'PSIC', 'AMIP_sic', 'HadISST2_prelim_0to360_alldays_sic_[year].nc', 'sic', 1850, 2016, 'daily', false, 1, 0, , ," + co2_conf_var="" + oasis_conf_var="" fi . ./namelist_python.amip.sh > ./namelist.amip [ $model = co2box ] && . ./namelist.co2box.sh > ./namelist.co2box -- GitLab