Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add e3sm_to_cmip_environment_commands parameter #556

Merged
merged 1 commit into from
Feb 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/integration/generated/test_bundles_chrysalis.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,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_20240223"
years = "1850:1854:2",

[[ atm_monthly_180x360_aave ]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,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_20240223"
walltime = "00:30:00"
years = "1850:1854:2",

Expand Down
5 changes: 3 additions & 2 deletions tests/integration/generated/test_debug_chrysalis.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ years = "1850:1854:2",
vars = "PRECT"

[[ land_monthly ]]
e3sm_to_cmip_environment_commands = "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240223"
extra_vars = "landfrac"
frequency = "monthly"
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
#vars = "LAISHA,LAISUN"
vars = "FSH,RH2M"
vars = "LAISHA,LAISUN"
#vars = "FSH,RH2M"
ts_fmt = "cmip"

[ilamb]
Expand Down
1 change: 1 addition & 0 deletions tests/integration/template_bundles.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,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 ]]
Expand Down
1 change: 1 addition & 0 deletions tests/integration/template_complete_run.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,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",

Expand Down
5 changes: 3 additions & 2 deletions tests/integration/template_debug.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,13 @@ years = "1850:1854:2",
vars = "PRECT"

[[ land_monthly ]]
e3sm_to_cmip_environment_commands = "#expand e3sm_to_cmip_environment_commands#"
extra_vars = "landfrac"
frequency = "monthly"
input_files = "elm.h0"
input_subdir = "archive/lnd/hist"
#vars = "LAISHA,LAISUN"
vars = "FSH,RH2M"
vars = "LAISHA,LAISUN"
#vars = "FSH,RH2M"
ts_fmt = "cmip"

[ilamb]
Expand Down
3 changes: 3 additions & 0 deletions tests/integration/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ 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_20240214",
"diags_walltime": "5:00:00",
"e3sm_to_cmip_environment_commands": "source /home/ac.forsyth2/miniconda3/etc/profile.d/conda.sh; conda activate e3sm_to_cmip_20240223",
"environment_commands_test": "source /lcrc/soft/climate/e3sm-unified/test_e3sm_unified_1.9.0rc16_chrysalis.sh",
"expected_dir": "/lcrc/group/e3sm/public_html/zppy_test_resources/",
"mpas_analysis_walltime": "00:30:00",
Expand All @@ -163,6 +164,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/mambaforge/etc/profile.d/conda.sh; conda activate e3sm_diags_20230914",
"diags_walltime": "03:00:00",
"e3sm_to_cmip_environment_commands": "",
"environment_commands_test": "source /share/apps/E3SM/conda_envs/test_e3sm_unified_1.9.0rc16_compy.sh",
"expected_dir": "/compyfs/www/zppy_test_resources/",
"mpas_analysis_walltime": "00:30:00",
Expand All @@ -188,6 +190,7 @@ 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_20230914",
"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.0rc16_pm-cpu.sh",
"expected_dir": "/global/cfs/cdirs/e3sm/www/zppy_test_resources/",
"mpas_analysis_walltime": "01:00:00",
Expand Down
8 changes: 8 additions & 0 deletions tests/test_sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def test_sections(self):
"constraint": "",
"debug": False,
"dry_run": False,
"e3sm_to_cmip_environment_commands": "",
"environment_commands": "",
"frequency": "monthly",
"grid": "",
Expand Down Expand Up @@ -124,6 +125,7 @@ def test_sections(self):
"debug": False,
"dpf": 30,
"dry_run": False,
"e3sm_to_cmip_environment_commands": "",
"environment_commands": "",
"extra_vars": "",
"frequency": "monthly",
Expand Down Expand Up @@ -176,6 +178,7 @@ def test_sections(self):
"constraint": "",
"debug": False,
"dry_run": False,
"e3sm_to_cmip_environment_commands": "",
"environment_commands": "",
"exclude": False,
"frequency": "monthly",
Expand Down Expand Up @@ -228,6 +231,7 @@ def test_subsections(self):
"constraint": "",
"debug": False,
"dry_run": False,
"e3sm_to_cmip_environment_commands": "",
"environment_commands": "",
"frequency": "monthly",
"grid": "",
Expand Down Expand Up @@ -301,6 +305,7 @@ def test_subsections(self):
"debug": False,
"dpf": 30,
"dry_run": False,
"e3sm_to_cmip_environment_commands": "",
"environment_commands": "",
"extra_vars": "",
"frequency": "monthly",
Expand Down Expand Up @@ -339,6 +344,7 @@ def test_subsections(self):
"debug": False,
"dpf": 30,
"dry_run": False,
"e3sm_to_cmip_environment_commands": "",
"environment_commands": "",
"extra_vars": "",
"frequency": "monthly",
Expand Down Expand Up @@ -407,6 +413,7 @@ def test_subsections(self):
"constraint": "",
"debug": False,
"dry_run": False,
"e3sm_to_cmip_environment_commands": "",
"environment_commands": "",
"exclude": False,
"frequency": "monthly",
Expand Down Expand Up @@ -440,6 +447,7 @@ def test_subsections(self):
"constraint": "",
"debug": False,
"dry_run": False,
"e3sm_to_cmip_environment_commands": "",
"environment_commands": "",
"exclude": False,
"frequency": "monthly",
Expand Down
5 changes: 5 additions & 0 deletions zppy/templates/default.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ debug = boolean(default=False)
# diagnostics_base_path -- NOTE: this parameter is created internally
# This should be set to True if you don't want the batch jobs to be submitted
dry_run = boolean(default=False)
# Set up the environment for e3sm_to_cmip.
# Because e3sm_to_cmip is used internally in the `ts` task,
# the `environment_commands` parameter below is insufficient
# and this parameter must be used instead.
e3sm_to_cmip_environment_commands = string(default="")
# Set up the environment -- this is where you can tell zppy to use a custom conda environment.
# To use a custom conda environment, you can set `environment_commands="source <path to conda.sh>; conda activate <custom environment>"`.
environment_commands = string(default="")
Expand Down
2 changes: 2 additions & 0 deletions zppy/templates/ts.bash
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,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} \
Expand Down Expand Up @@ -173,6 +174,7 @@ EOF
echo 'ERROR (4)' > {{ prefix }}.status
exit 4
fi
{{ environment_commands }}

# Move output ts files to final destination
mv ${dest_cmip}/${tmp_dir}/CMIP6/CMIP/*/*/*/*/*/*/*/*/*.nc ${dest_cmip}
Expand Down
Loading