From 04535929ec8df35c90a30f385436bae5bdfcdc29 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Fri, 28 Jul 2023 11:20:05 -0700 Subject: [PATCH 1/2] Fixes for rc4 --- .../generated/test_bundles_chrysalis.cfg | 4 +++- .../generated/test_bundles_pm-cpu.cfg | 2 +- .../generated/test_complete_run_chrysalis.cfg | 6 ++++-- .../generated/test_complete_run_pm-cpu.cfg | 4 ++-- tests/integration/template_bundles.cfg | 2 ++ tests/integration/template_complete_run.cfg | 2 ++ tests/integration/utils.py | 20 +++++++++++++------ tests/test_sections.py | 5 +++++ zppy/templates/coupled_global.py | 3 ++- zppy/templates/default.ini | 1 + zppy/templates/ts.bash | 2 ++ 11 files changed, 38 insertions(+), 13 deletions(-) diff --git a/tests/integration/generated/test_bundles_chrysalis.cfg b/tests/integration/generated/test_bundles_chrysalis.cfg index 714f7219..14299c3c 100644 --- a/tests/integration/generated/test_bundles_chrysalis.cfg +++ b/tests/integration/generated/test_bundles_chrysalis.cfg @@ -1,7 +1,8 @@ [default] case = v2.LR.historical_0201 constraint = "" -environment_commands = "" +dry_run = "False" +environment_commands = "source /lcrc/soft/climate/e3sm-unified/test_e3sm_unified_1.9.0rc9_chrysalis.sh" input = "/lcrc/group/e3sm/ac.forsyth2/E3SMv2/v2.LR.historical_0201" input_subdir = archive/atm/hist mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc" @@ -35,6 +36,7 @@ years = "1850:1854:2", "1850:1854:4", [ts] active = True bundle = "bundle1" +e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_fix_np" years = "1850:1854:2", [[ atm_monthly_180x360_aave ]] diff --git a/tests/integration/generated/test_bundles_pm-cpu.cfg b/tests/integration/generated/test_bundles_pm-cpu.cfg index 3c536886..605f0612 100644 --- a/tests/integration/generated/test_bundles_pm-cpu.cfg +++ b/tests/integration/generated/test_bundles_pm-cpu.cfg @@ -1,7 +1,7 @@ [default] case = v2.LR.historical_0201 constraint = "cpu" -environment_commands = "" +environment_commands = "source /global/common/software/e3sm/anaconda_envs/test_e3sm_unified_1.9.0rc9_pm-cpu.sh" input = "/global/cfs/cdirs/e3sm/forsyth/E3SMv2/v2.LR.historical_0201" input_subdir = archive/atm/hist mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc" diff --git a/tests/integration/generated/test_complete_run_chrysalis.cfg b/tests/integration/generated/test_complete_run_chrysalis.cfg index a2042f34..7fcb626d 100644 --- a/tests/integration/generated/test_complete_run_chrysalis.cfg +++ b/tests/integration/generated/test_complete_run_chrysalis.cfg @@ -1,7 +1,8 @@ [default] case = v2.LR.historical_0201 constraint = "" -environment_commands = "" +dry_run = "False" +environment_commands = "source /lcrc/soft/climate/e3sm-unified/test_e3sm_unified_1.9.0rc9_chrysalis.sh" input = "/lcrc/group/e3sm/ac.forsyth2//E3SMv2/v2.LR.historical_0201" input_subdir = archive/atm/hist mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc" @@ -27,6 +28,7 @@ years = "1850:1854:2", "1850:1854:4", [ts] active = True +e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_fix_np" walltime = "00:30:00" years = "1850:1854:2", @@ -92,7 +94,7 @@ years = "1850:1854:2", "1850:1854:4", walltime = "2:00:00" [[ atm_monthly_180x360_aave_environment_commands ]] - environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_dev_20220614" + environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20230731" sets = "qbo", ts_subsection = "atm_monthly_180x360_aave" diff --git a/tests/integration/generated/test_complete_run_pm-cpu.cfg b/tests/integration/generated/test_complete_run_pm-cpu.cfg index 10a6e4a8..bef8fdae 100644 --- a/tests/integration/generated/test_complete_run_pm-cpu.cfg +++ b/tests/integration/generated/test_complete_run_pm-cpu.cfg @@ -1,7 +1,7 @@ [default] case = v2.LR.historical_0201 constraint = "cpu" -environment_commands = "" +environment_commands = "source /global/common/software/e3sm/anaconda_envs/test_e3sm_unified_1.9.0rc9_pm-cpu.sh" input = "/global/cfs/cdirs/e3sm/forsyth//E3SMv2/v2.LR.historical_0201" input_subdir = archive/atm/hist mapping_file = "map_ne30pg2_to_cmip6_180x360_aave.20200201.nc" @@ -92,7 +92,7 @@ years = "1850:1854:2", "1850:1854:4", walltime = "6:00:00" [[ atm_monthly_180x360_aave_environment_commands ]] - environment_commands = "source /global/homes/f/forsyth/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_dev_20220715" + environment_commands = "source /global/homes/f/forsyth/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20230728" sets = "qbo", ts_subsection = "atm_monthly_180x360_aave" diff --git a/tests/integration/template_bundles.cfg b/tests/integration/template_bundles.cfg index 594b6fcc..91fd57fa 100644 --- a/tests/integration/template_bundles.cfg +++ b/tests/integration/template_bundles.cfg @@ -1,6 +1,7 @@ [default] case = v2.LR.historical_0201 constraint = "#expand constraint#" +dry_run = "#expand dry_run#" environment_commands = "#expand environment_commands#" input = "#expand user_input#E3SMv2/v2.LR.historical_0201" input_subdir = archive/atm/hist @@ -35,6 +36,7 @@ years = "1850:1854:2", "1850:1854:4", [ts] active = True bundle = "bundle1" +e3sm_to_cmip_environment_commands = "#expand e3sm_to_cmip_environment_commands#" years = "1850:1854:2", [[ atm_monthly_180x360_aave ]] diff --git a/tests/integration/template_complete_run.cfg b/tests/integration/template_complete_run.cfg index 221f3701..088f9d47 100644 --- a/tests/integration/template_complete_run.cfg +++ b/tests/integration/template_complete_run.cfg @@ -1,6 +1,7 @@ [default] case = v2.LR.historical_0201 constraint = "#expand constraint#" +dry_run = "#expand dry_run#" environment_commands = "#expand environment_commands#" input = "#expand user_input#/E3SMv2/v2.LR.historical_0201" input_subdir = archive/atm/hist @@ -27,6 +28,7 @@ years = "1850:1854:2", "1850:1854:4", [ts] active = True +e3sm_to_cmip_environment_commands = "#expand e3sm_to_cmip_environment_commands#" walltime = "00:30:00" years = "1850:1854:2", diff --git a/tests/integration/utils.py b/tests/integration/utils.py index f38d1d04..b20e4aa2 100644 --- a/tests/integration/utils.py +++ b/tests/integration/utils.py @@ -134,9 +134,10 @@ def get_chyrsalis_expansions(config): "bundles_walltime": "02:00:00", "constraint": "", # To run this test, replace conda environment with your e3sm_diags dev environment - "diags_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_dev_20220614", + "diags_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20230731", "diags_walltime": "2:00:00", - "environment_commands_test": "source /lcrc/soft/climate/e3sm-unified/test_e3sm_unified_1.8.0rc6_chrysalis.sh", + "e3sm_to_cmip_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_fix_np", + "environment_commands_test": "source /lcrc/soft/climate/e3sm-unified/test_e3sm_unified_1.9.0rc9_chrysalis.sh", "expected_dir": "/lcrc/group/e3sm/public_html/zppy_test_resources/", "partition_long": "compute", "partition_short": "debug", @@ -160,6 +161,7 @@ def get_compy_expansions(config): # To run this test, replace conda environment with your e3sm_diags dev environment "diags_environment_commands": "source /qfs/people/fors729/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_dev_20220722", "diags_walltime": "03:00:00", + "e3sm_to_cmip_environment_commands": "", "environment_commands_test": "source /share/apps/E3SM/conda_envs/test_e3sm_unified_1.8.0rc6_compy.sh", "expected_dir": "/compyfs/www/zppy_test_resources/", "partition_long": "slurm", @@ -182,9 +184,10 @@ def get_perlmutter_expansions(config): "bundles_walltime": "6:00:00", "constraint": "cpu", # To run this test, replace conda environment with your e3sm_diags dev environment - "diags_environment_commands": "source /global/homes/f/forsyth/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_dev_20220715", + "diags_environment_commands": "source /global/homes/f/forsyth/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20230728", "diags_walltime": "6:00:00", - "environment_commands_test": "source /global/common/software/e3sm/anaconda_envs/test_e3sm_unified_1.8.0rc6_pm-cpu.sh", + "e3sm_to_cmip_environment_commands": "", + "environment_commands_test": "source /global/common/software/e3sm/anaconda_envs/test_e3sm_unified_1.9.0rc9_pm-cpu.sh", "expected_dir": "/global/cfs/cdirs/e3sm/www/zppy_test_resources/", "partition_long": "", "partition_short": "", @@ -231,7 +234,7 @@ def substitute_expansions(expansions, file_in, file_out): file_write.write(line) -def generate_cfgs(unified_testing=False): +def generate_cfgs(unified_testing=False, dry_run=False): git_top_level = ( subprocess.check_output("git rev-parse --show-toplevel".split()) .strip() @@ -246,6 +249,11 @@ def generate_cfgs(unified_testing=False): expansions["environment_commands"] = "" machine = expansions["machine"] + if dry_run: + expansions["dry_run"] = "True" + else: + expansions["dry_run"] = "False" + cfg_names = ["bundles", "complete_run"] for cfg_name in cfg_names: cfg_template = f"{git_top_level}/tests/integration/template_{cfg_name}.cfg" @@ -268,4 +276,4 @@ def generate_cfgs(unified_testing=False): if __name__ == "__main__": - generate_cfgs() + generate_cfgs(unified_testing=True) diff --git a/tests/test_sections.py b/tests/test_sections.py index b4959838..23fb4937 100644 --- a/tests/test_sections.py +++ b/tests/test_sections.py @@ -100,6 +100,7 @@ def test_sections(self): "area_nm": "area", "cmip_metadata": "e3sm_to_cmip/default_metadata.json", "dpf": 30, + "e3sm_to_cmip_environment_commands": "", "extra_vars": "", "mapping_file": "MAPPING_FILE_TS", "tpd": 1, @@ -123,6 +124,7 @@ def test_sections(self): "debug": False, "dpf": 30, "dry_run": False, + "e3sm_to_cmip_environment_commands": "", "environment_commands": "", "extra_vars": "", "frequency": "monthly", @@ -253,6 +255,7 @@ def test_subsections(self): "area_nm": "area", "cmip_metadata": "e3sm_to_cmip/default_metadata.json", "dpf": 30, + "e3sm_to_cmip_environment_commands": "", "extra_vars": "", "tpd": 1, "ts_fmt": "ts_only", @@ -294,6 +297,7 @@ def test_subsections(self): "debug": False, "dpf": 30, "dry_run": False, + "e3sm_to_cmip_environment_commands": "", "environment_commands": "", "extra_vars": "", "frequency": "monthly", @@ -331,6 +335,7 @@ def test_subsections(self): "debug": False, "dpf": 30, "dry_run": False, + "e3sm_to_cmip_environment_commands": "", "environment_commands": "", "extra_vars": "", "frequency": "monthly", diff --git a/zppy/templates/coupled_global.py b/zppy/templates/coupled_global.py index c8de89bc..6fcaba47 100644 --- a/zppy/templates/coupled_global.py +++ b/zppy/templates/coupled_global.py @@ -26,7 +26,7 @@ def getmoc(dir_in): fin = Dataset(files[i], "r") time0 = fin["year"][:] var0 = fin["mocAtlantic26"][:] - for iyear in range(np.int(time0[0]), np.int(time0[-1]) + 1): + for iyear in range(int(time0[0]), int(time0[-1]) + 1): if i > 0 and iyear <= time[-1]: print( "the amoc value for year", @@ -613,6 +613,7 @@ def run(parameters, rgn): # noqa: C901 pdf = matplotlib.backends.backend_pdf.PdfPages(f"{figstr}_{rgn}.pdf") for page in range(num_pages): fig = plt.figure(1, figsize=[13.5, 16.5]) + fig.suptitle(f"{figstr}_{rgn}") for j in range(plots_per_page): if i < num_plots: ax = plt.subplot(nrows, ncols, j + 1) diff --git a/zppy/templates/default.ini b/zppy/templates/default.ini index 3a4a9f40..d2ebf352 100644 --- a/zppy/templates/default.ini +++ b/zppy/templates/default.ini @@ -89,6 +89,7 @@ area_nm = string(default="area") cmip_metadata = string(default="e3sm_to_cmip/default_metadata.json") # Days per file dpf = integer(default=30) +e3sm_to_cmip_environment_commands = string(default="") extra_vars = string(default="") # Time-steps per day tpd = integer(default=1) diff --git a/zppy/templates/ts.bash b/zppy/templates/ts.bash index ee9f82dc..19cca1a9 100644 --- a/zppy/templates/ts.bash +++ b/zppy/templates/ts.bash @@ -148,6 +148,7 @@ EOF input_dir={{ output }}/post/{{ component }}/{{ grid }}/ts/{{ frequency }}/{{ '%dyr' % (ypf) }} dest_cmip={{ output }}/post/{{ component }}/{{ grid }}/cmip_ts/{{ frequency }} mkdir -p ${dest_cmip} + {{ e3sm_to_cmip_environment_commands }} srun -N 1 e3sm_to_cmip \ --output-path \ ${dest_cmip}/${tmp_dir} \ @@ -178,6 +179,7 @@ EOF exit 4 fi + {{ environment_commands }} # Move output ts files to final destination mv ${dest_cmip}/${tmp_dir}/CMIP6/CMIP/*/*/*/*/*/*/*/*/*.nc ${dest_cmip} if [ $? != 0 ]; then From c939071a3adafb3efb1db5ee889cab52a9c27452 Mon Sep 17 00:00:00 2001 From: Ryan Forsyth Date: Thu, 3 Aug 2023 19:19:40 -0500 Subject: [PATCH 2/2] Remove e3sm_to_cmip_environment_commands --- tests/integration/generated/test_bundles_chrysalis.cfg | 1 - tests/integration/generated/test_complete_run_chrysalis.cfg | 1 - tests/integration/template_bundles.cfg | 1 - tests/integration/template_complete_run.cfg | 1 - tests/integration/utils.py | 3 --- tests/test_sections.py | 5 ----- zppy/templates/default.ini | 1 - zppy/templates/ts.bash | 2 -- 8 files changed, 15 deletions(-) diff --git a/tests/integration/generated/test_bundles_chrysalis.cfg b/tests/integration/generated/test_bundles_chrysalis.cfg index 14299c3c..0698a9a2 100644 --- a/tests/integration/generated/test_bundles_chrysalis.cfg +++ b/tests/integration/generated/test_bundles_chrysalis.cfg @@ -36,7 +36,6 @@ years = "1850:1854:2", "1850:1854:4", [ts] active = True bundle = "bundle1" -e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_fix_np" years = "1850:1854:2", [[ atm_monthly_180x360_aave ]] diff --git a/tests/integration/generated/test_complete_run_chrysalis.cfg b/tests/integration/generated/test_complete_run_chrysalis.cfg index 7fcb626d..6f3a21a1 100644 --- a/tests/integration/generated/test_complete_run_chrysalis.cfg +++ b/tests/integration/generated/test_complete_run_chrysalis.cfg @@ -28,7 +28,6 @@ years = "1850:1854:2", "1850:1854:4", [ts] active = True -e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_fix_np" walltime = "00:30:00" years = "1850:1854:2", diff --git a/tests/integration/template_bundles.cfg b/tests/integration/template_bundles.cfg index 91fd57fa..2c28be4e 100644 --- a/tests/integration/template_bundles.cfg +++ b/tests/integration/template_bundles.cfg @@ -36,7 +36,6 @@ years = "1850:1854:2", "1850:1854:4", [ts] active = True bundle = "bundle1" -e3sm_to_cmip_environment_commands = "#expand e3sm_to_cmip_environment_commands#" years = "1850:1854:2", [[ atm_monthly_180x360_aave ]] diff --git a/tests/integration/template_complete_run.cfg b/tests/integration/template_complete_run.cfg index 088f9d47..847c8001 100644 --- a/tests/integration/template_complete_run.cfg +++ b/tests/integration/template_complete_run.cfg @@ -28,7 +28,6 @@ years = "1850:1854:2", "1850:1854:4", [ts] active = True -e3sm_to_cmip_environment_commands = "#expand e3sm_to_cmip_environment_commands#" walltime = "00:30:00" years = "1850:1854:2", diff --git a/tests/integration/utils.py b/tests/integration/utils.py index b20e4aa2..b1715edf 100644 --- a/tests/integration/utils.py +++ b/tests/integration/utils.py @@ -136,7 +136,6 @@ def get_chyrsalis_expansions(config): # To run this test, replace conda environment with your e3sm_diags dev environment "diags_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20230731", "diags_walltime": "2:00:00", - "e3sm_to_cmip_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_fix_np", "environment_commands_test": "source /lcrc/soft/climate/e3sm-unified/test_e3sm_unified_1.9.0rc9_chrysalis.sh", "expected_dir": "/lcrc/group/e3sm/public_html/zppy_test_resources/", "partition_long": "compute", @@ -161,7 +160,6 @@ def get_compy_expansions(config): # To run this test, replace conda environment with your e3sm_diags dev environment "diags_environment_commands": "source /qfs/people/fors729/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_dev_20220722", "diags_walltime": "03:00:00", - "e3sm_to_cmip_environment_commands": "", "environment_commands_test": "source /share/apps/E3SM/conda_envs/test_e3sm_unified_1.8.0rc6_compy.sh", "expected_dir": "/compyfs/www/zppy_test_resources/", "partition_long": "slurm", @@ -186,7 +184,6 @@ def get_perlmutter_expansions(config): # To run this test, replace conda environment with your e3sm_diags dev environment "diags_environment_commands": "source /global/homes/f/forsyth/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_diags_20230728", "diags_walltime": "6:00:00", - "e3sm_to_cmip_environment_commands": "", "environment_commands_test": "source /global/common/software/e3sm/anaconda_envs/test_e3sm_unified_1.9.0rc9_pm-cpu.sh", "expected_dir": "/global/cfs/cdirs/e3sm/www/zppy_test_resources/", "partition_long": "", diff --git a/tests/test_sections.py b/tests/test_sections.py index 23fb4937..b4959838 100644 --- a/tests/test_sections.py +++ b/tests/test_sections.py @@ -100,7 +100,6 @@ def test_sections(self): "area_nm": "area", "cmip_metadata": "e3sm_to_cmip/default_metadata.json", "dpf": 30, - "e3sm_to_cmip_environment_commands": "", "extra_vars": "", "mapping_file": "MAPPING_FILE_TS", "tpd": 1, @@ -124,7 +123,6 @@ def test_sections(self): "debug": False, "dpf": 30, "dry_run": False, - "e3sm_to_cmip_environment_commands": "", "environment_commands": "", "extra_vars": "", "frequency": "monthly", @@ -255,7 +253,6 @@ def test_subsections(self): "area_nm": "area", "cmip_metadata": "e3sm_to_cmip/default_metadata.json", "dpf": 30, - "e3sm_to_cmip_environment_commands": "", "extra_vars": "", "tpd": 1, "ts_fmt": "ts_only", @@ -297,7 +294,6 @@ def test_subsections(self): "debug": False, "dpf": 30, "dry_run": False, - "e3sm_to_cmip_environment_commands": "", "environment_commands": "", "extra_vars": "", "frequency": "monthly", @@ -335,7 +331,6 @@ def test_subsections(self): "debug": False, "dpf": 30, "dry_run": False, - "e3sm_to_cmip_environment_commands": "", "environment_commands": "", "extra_vars": "", "frequency": "monthly", diff --git a/zppy/templates/default.ini b/zppy/templates/default.ini index d2ebf352..3a4a9f40 100644 --- a/zppy/templates/default.ini +++ b/zppy/templates/default.ini @@ -89,7 +89,6 @@ area_nm = string(default="area") cmip_metadata = string(default="e3sm_to_cmip/default_metadata.json") # Days per file dpf = integer(default=30) -e3sm_to_cmip_environment_commands = string(default="") extra_vars = string(default="") # Time-steps per day tpd = integer(default=1) diff --git a/zppy/templates/ts.bash b/zppy/templates/ts.bash index 19cca1a9..ee9f82dc 100644 --- a/zppy/templates/ts.bash +++ b/zppy/templates/ts.bash @@ -148,7 +148,6 @@ EOF input_dir={{ output }}/post/{{ component }}/{{ grid }}/ts/{{ frequency }}/{{ '%dyr' % (ypf) }} dest_cmip={{ output }}/post/{{ component }}/{{ grid }}/cmip_ts/{{ frequency }} mkdir -p ${dest_cmip} - {{ e3sm_to_cmip_environment_commands }} srun -N 1 e3sm_to_cmip \ --output-path \ ${dest_cmip}/${tmp_dir} \ @@ -179,7 +178,6 @@ EOF exit 4 fi - {{ environment_commands }} # Move output ts files to final destination mv ${dest_cmip}/${tmp_dir}/CMIP6/CMIP/*/*/*/*/*/*/*/*/*.nc ${dest_cmip} if [ $? != 0 ]; then