Skip to content

Commit f4261d1

Browse files
xylarforsyth2
andauthored
Add support for cryosphere campaign (#144)
* Add support for cryosphere campaign This includes a new cryosphere config file in the templates and a special `--polar_regions` flag for MPAS-Analysis. The new flag will only be supported for MPAS-Analysis >= 1.5.0 (not yet released), so it will require an update of E3SM-Unified to work correctly. * Add testing and documentation Co-authored-by: Ryan Forsyth <[email protected]>
1 parent 15fce90 commit f4261d1

File tree

6 files changed

+222
-4
lines changed

6 files changed

+222
-4
lines changed

docs/source/dev_guide/testing.rst

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,24 @@ To replace the expected files for ``test_campaign.py`` run the following:
6868

6969
.. code::
7070
71+
rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_cryosphere_expected_files
72+
rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_cryosphere_override_expected_files
7173
rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_none_expected_files
7274
rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_water_cycle_expected_files
7375
rm -rf /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_water_cycle_override_expected_files
76+
mkdir -p /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_cryosphere_expected_files
77+
mkdir -p /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_cryosphere_override_expected_files
7478
mkdir -p /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_none_expected_files
7579
mkdir -p /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_water_cycle_expected_files
7680
mkdir -p /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_water_cycle_override_expected_files
7781
cd <top level of zppy repo>
7882
# Your output will now become the new expectation.
7983
# You can just move (i.e., not copy) the output since re-running this test will re-generate the output.
80-
mv test_campaign_none_output/post/scripts /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_none_expected_files
81-
mv test_campaign_water_cycle_output/post/scripts /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_water_cycle_expected_files
82-
mv test_campaign_water_cycle_override_output/post/scripts /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_water_cycle_override_expected_files
84+
mv test_campaign_cryosphere_output/post/scripts/*.settings /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_cryosphere_expected_files
85+
mv test_campaign_cryosphere_override_output/post/scripts/*.settings /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_cryosphere_override_expected_files
86+
mv test_campaign_none_output/post/scripts/*.settings /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_none_expected_files
87+
mv test_campaign_water_cycle_output/post/scripts/*.settings /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_water_cycle_expected_files
88+
mv test_campaign_water_cycle_override_output/post/scripts/*.settings /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_water_cycle_override_expected_files
8389
# Rerun test
8490
python -m unittest tests/integration/test_campaign.py
8591

tests/integration/test_campaign.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,42 @@
33

44

55
class TestCampaign(unittest.TestCase):
6+
def test_campaign_cryosphere(self):
7+
self.assertEqual(
8+
os.system("zppy -c tests/integration/test_campaign_cryosphere.cfg"), 0
9+
)
10+
self.assertEqual(
11+
os.system("rm test_campaign_cryosphere_output/post/scripts/*.bash"), 0
12+
)
13+
self.assertEqual(
14+
os.system(
15+
"diff -u test_campaign_cryosphere_output/post/scripts /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_cryosphere_expected_files"
16+
),
17+
0,
18+
)
19+
self.assertEqual(os.system("rm -r test_campaign_cryosphere_output"), 0)
20+
21+
def test_campaign_cryosphere_override(self):
22+
self.assertEqual(
23+
os.system(
24+
"zppy -c tests/integration/test_campaign_cryosphere_override.cfg"
25+
),
26+
0,
27+
)
28+
self.assertEqual(
29+
os.system(
30+
"rm test_campaign_cryosphere_override_output/post/scripts/*.bash"
31+
),
32+
0,
33+
)
34+
self.assertEqual(
35+
os.system(
36+
"diff -u test_campaign_cryosphere_override_output/post/scripts /lcrc/group/e3sm/public_html/zppy_test_resources/test_campaign_cryosphere_override_expected_files"
37+
),
38+
0,
39+
)
40+
self.assertEqual(os.system("rm -r test_campaign_cryosphere_override_output"), 0)
41+
642
def test_campaign_none(self):
743
self.assertEqual(
844
os.system("zppy -c tests/integration/test_campaign_none.cfg"), 0
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[default]
2+
input = .
3+
input_subdir = archive/atm/hist
4+
output = test_campaign_cryosphere_output
5+
case = case_name
6+
www = www/path
7+
e3sm_unified = latest
8+
partition = compute
9+
ref_start_yr = 1979
10+
ref_final_yr = 2016
11+
dry_run = True
12+
environment_commands = "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh"
13+
campaign = "cryosphere"
14+
15+
[climo]
16+
active = True
17+
years = "1:100:20", "1:100:50",
18+
# Use default vars
19+
20+
[[ atm_monthly_180x360_aave ]]
21+
mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
22+
frequency = "monthly"
23+
24+
[[ atm_monthly_diurnal_8xdaily_180x360_aave ]]
25+
input_subdir = "archive/atm/hist"
26+
input_files = "eam.h4"
27+
mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
28+
vars = "PRECT"
29+
frequency = "monthly_diurnal_8xdaily"
30+
31+
[ts]
32+
active = True
33+
years = "1:100:10",
34+
35+
[[ atm_monthly_180x360_aave ]]
36+
input_subdir = "archive/atm/hist"
37+
input_files = "eam.h0"
38+
frequency = "monthly"
39+
mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
40+
# Use default vars
41+
42+
[[ rof_monthly ]]
43+
input_subdir = "archive/rof/hist"
44+
input_files = "mosart.h0"
45+
frequency = "monthly"
46+
mapping_file = ""
47+
vars = "RIVER_DISCHARGE_OVER_LAND_LIQ"
48+
extra_vars = 'areatotal2'
49+
50+
[e3sm_diags]
51+
active = True
52+
years = "1:100:20", "1:100:50",
53+
ts_num_years = 10
54+
# Use default `sets`
55+
56+
[[ atm_monthly_180x360_aave ]]
57+
short_name = case_name
58+
grid = '180x360_aave'
59+
reference_data_path = '/lcrc/soft/climate/e3sm_diags_data/obs_for_e3sm_diags/climatology'
60+
obs_ts = '/lcrc/soft/climate/e3sm_diags_data/obs_for_e3sm_diags/time-series'
61+
dc_obs_climo = '/lcrc/group/e3sm/public_html/e3sm_diags_test_data/unit_test_complete_run/obs/climatology'
62+
climo_diurnal_subsection = "atm_monthly_diurnal_8xdaily_180x360_aave"
63+
streamflow_obs_ts = '/lcrc/group/e3sm/public_html/e3sm_diags_test_data/unit_test_complete_run/obs/time-series/'
64+
65+
[e3sm_diags_vs_model]
66+
active = False
67+
68+
[amwg]
69+
active = False
70+
71+
[mpas_analysis]
72+
active = True
73+
walltime = "24:00:00"
74+
parallelTaskCount = 6
75+
ts_years = "1-50", "1-100",
76+
enso_years = "11-50", "11-100",
77+
climo_years ="21-50", "51-100",
78+
mesh = "EC30to60E2r2"
79+
80+
[global_time_series]
81+
active = False
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
[default]
2+
input = .
3+
input_subdir = archive/atm/hist
4+
output = test_campaign_cryosphere_override_output
5+
case = case_name
6+
www = www/path
7+
e3sm_unified = latest
8+
partition = compute
9+
ref_start_yr = 1979
10+
ref_final_yr = 2016
11+
dry_run = True
12+
environment_commands = "source /lcrc/soft/climate/e3sm-unified/load_latest_e3sm_unified_chrysalis.sh"
13+
campaign = "cryosphere"
14+
15+
[climo]
16+
active = True
17+
years = "1:100:20", "1:100:50",
18+
# Use default vars
19+
20+
[[ atm_monthly_180x360_aave ]]
21+
mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
22+
frequency = "monthly"
23+
24+
[[ atm_monthly_diurnal_8xdaily_180x360_aave ]]
25+
input_subdir = "archive/atm/hist"
26+
input_files = "eam.h4"
27+
mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
28+
vars = "PRECT"
29+
frequency = "monthly_diurnal_8xdaily"
30+
31+
[ts]
32+
active = True
33+
years = "1:100:10",
34+
35+
[[ atm_monthly_180x360_aave ]]
36+
input_subdir = "archive/atm/hist"
37+
input_files = "eam.h0"
38+
frequency = "monthly"
39+
mapping_file = /home/ac.zender/data/maps/map_ne30pg2_to_cmip6_180x360_aave.20200201.nc
40+
# Use default vars
41+
42+
[[ rof_monthly ]]
43+
input_subdir = "archive/rof/hist"
44+
input_files = "mosart.h0"
45+
frequency = "monthly"
46+
mapping_file = ""
47+
vars = "RIVER_DISCHARGE_OVER_LAND_LIQ"
48+
extra_vars = 'areatotal2'
49+
50+
[e3sm_diags]
51+
active = True
52+
years = "1:100:20", "1:100:50",
53+
ts_num_years = 10
54+
sets = "qbo", # Override `sets` from `campaign = "cryosphere"`
55+
56+
[[ atm_monthly_180x360_aave ]]
57+
short_name = case_name
58+
grid = '180x360_aave'
59+
reference_data_path = '/lcrc/soft/climate/e3sm_diags_data/obs_for_e3sm_diags/climatology'
60+
obs_ts = '/lcrc/soft/climate/e3sm_diags_data/obs_for_e3sm_diags/time-series'
61+
dc_obs_climo = '/lcrc/group/e3sm/public_html/e3sm_diags_test_data/unit_test_complete_run/obs/climatology'
62+
climo_diurnal_subsection = "atm_monthly_diurnal_8xdaily_180x360_aave"
63+
streamflow_obs_ts = '/lcrc/group/e3sm/public_html/e3sm_diags_test_data/unit_test_complete_run/obs/time-series/'
64+
65+
[e3sm_diags_vs_model]
66+
active = False
67+
68+
[amwg]
69+
active = False
70+
71+
[mpas_analysis]
72+
active = True
73+
walltime = "24:00:00"
74+
parallelTaskCount = 6
75+
ts_years = "1-50", "1-100",
76+
enso_years = "11-50", "11-100",
77+
climo_years ="21-50", "51-100",
78+
mesh = "EC30to60E2r2"
79+
80+
[global_time_series]
81+
active = False

zppy/templates/cryosphere.cfg

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[e3sm_diags]
2+
sets = "lat_lon","zonal_mean_xy","zonal_mean_2d","polar","cosp_histogram","meridional_mean_2d","enso_diags","qbo","diurnal_cycle","annual_cycle_zonal_mean","streamflow"
3+
4+
[e3sm_diags_vs_model]
5+
sets = "lat_lon","zonal_mean_xy","zonal_mean_2d","polar","cosp_histogram","meridional_mean_2d","enso_diags","annual_cycle_zonal_mean"
6+
7+
[mpas_analysis]
8+
generate = 'all', 'no_BGC', 'no_icebergs'

zppy/templates/mpas_analysis.bash

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,13 @@ mpi="--mpi=pmi2"
302302
mpi=""
303303
{% endif %}
304304

305-
srun ${mpi} -N 1 -n 1 mpas_analysis ${purge} --verbose cfg/mpas_analysis_${identifier}.cfg
305+
{% if campaign == 'cryosphere' %}
306+
extra_config="--polar_regions"
307+
{% else %}
308+
extra_config=""
309+
{% endif %}
310+
311+
srun ${mpi} -N 1 -n 1 mpas_analysis ${purge} --verbose ${extra_config} cfg/mpas_analysis_${identifier}.cfg
306312
if [ $? != 0 ]; then
307313
echo 'ERROR (1)' > {{ scriptDir }}/{{ prefix }}.status
308314
exit 1

0 commit comments

Comments
 (0)