Skip to content

Commit f3946a7

Browse files
committed
EAMxx: rename test to RCS
1 parent 221dbc2 commit f3946a7

File tree

7 files changed

+295
-102
lines changed

7 files changed

+295
-102
lines changed

components/eamxx/cime_config/SystemTests/est.py renamed to components/eamxx/cime_config/SystemTests/rcs.py

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
"""
2-
Ensemble Statistical Test using multi-instance capability.
2+
Reproducible Climate Statistics testing using multi-instance capability.
33
44
This test runs multiple EAMxx instances with different perturbation seeds
55
and uses statistical tests to verify that the climate state is identical
66
between different runs.
77
8-
EST inherits from SystemTestsCommon and only overrides:
8+
RCS inherits from SystemTestsCommon and only overrides:
99
- setup_phase (to setup multi-instance with per-instance perturbed seeds)
1010
- _generate_baseline (move needed hist files to baseline directory)
1111
- _compare_baseline methods (to run the statistical tests)
1212
13-
EST relies on two util files:
14-
- est_perts.py: functions to duplicate and modify yaml files
15-
- est_stats.py: functions to conduct statistical testing
13+
RCS relies on two util files:
14+
- rcs_perts.py: functions to duplicate and modify yaml files
15+
- rcs_stats.py: functions to conduct statistical testing
1616
"""
1717

1818
import os
@@ -30,8 +30,12 @@
3030

3131

3232
# pylint: disable=too-few-public-methods
33-
class EST(SystemTestsCommon):
34-
"""Ensemble Statistical Test using multi-instance capability"""
33+
class RCS(SystemTestsCommon):
34+
"""Reproducible Climate Statistics Test using multi-instance capability"""
35+
36+
# File pattern for multi-instance ensemble output files
37+
# Use ???? as placeholder for 4-digit instance number
38+
ENSEMBLE_FILE_PATTERN = "*.scream_????.h.AVERAGE.*.nc"
3539

3640
# pylint: disable=too-many-arguments, too-many-positional-arguments
3741
def setup_phase(
@@ -72,19 +76,19 @@ def setup_phase(
7276
)
7377
raise ValueError(msg)
7478

75-
# get est_perts functions
79+
# get rcs_perts functions
7680
# but first add the directory to sys.path if not already there
77-
est_perts_path = os.path.join(
78-
os.path.dirname(__file__), 'est_perts.py'
81+
rcs_perts_path = os.path.join(
82+
os.path.dirname(__file__), 'rcs_perts.py'
7983
)
80-
if not os.path.exists(est_perts_path):
84+
if not os.path.exists(rcs_perts_path):
8185
raise ImportError(
82-
f"Cannot find est_perts.py at {est_perts_path}"
86+
f"Cannot find rcs_perts.py at {rcs_perts_path}"
8387
)
8488
if os.path.dirname(__file__) not in sys.path:
8589
sys.path.insert(0, os.path.dirname(__file__))
8690
# pylint: disable=import-outside-toplevel
87-
from est_perts import duplicate_yaml_file, update_yaml_file
91+
from rcs_perts import duplicate_yaml_file, update_yaml_file
8892

8993
# duplicate the yaml files n_inst times
9094
duplicate_yaml_file(f"{run_dir}/data/scream_input.yaml", n_inst)
@@ -115,10 +119,9 @@ def _generate_baseline(self):
115119
)
116120
run_dir = self._case.get_value("RUNDIR")
117121

118-
# for eamxx, we need to get all files that have
119-
# *scream_????.h.*.nc added to this list
122+
# Get all files that match the ensemble pattern
120123
hists = glob.glob(
121-
os.path.join(run_dir, "*scream_????.h.AVERAGE.*.nc")
124+
os.path.join(run_dir, self.ENSEMBLE_FILE_PATTERN)
122125
)
123126
hist_files = [os.path.basename(h) for h in hists]
124127

@@ -162,28 +165,30 @@ def _compare_baseline(self):
162165
)
163166

164167
# launch the statistics tests
165-
# first, import est_stats funcs from the other file
166-
est_stats_path = os.path.join(
167-
os.path.dirname(__file__), 'est_stats.py'
168+
# first, import rcs_stats funcs from the other file
169+
rcs_stats_path = os.path.join(
170+
os.path.dirname(__file__), 'rcs_stats.py'
168171
)
169-
if not os.path.exists(est_stats_path):
172+
if not os.path.exists(rcs_stats_path):
170173
raise ImportError(
171-
f"Cannot find est_stats.py at {est_stats_path}"
174+
f"Cannot find rcs_stats.py at {rcs_stats_path}"
172175
)
173176
# Add the directory to sys.path if not already there
174177
if os.path.dirname(__file__) not in sys.path:
175178
sys.path.insert(0, os.path.dirname(__file__))
176179
# note be extra safe and import whole file
177180
# because we want to avoid import errors of needed pkgs
178181
# pylint: disable=import-outside-toplevel
179-
import est_stats as est
182+
import rcs_stats as rcss
180183
# now, launch
181-
comments, new_ts = est.run_stats_comparison(
184+
comments, new_ts = rcss.run_stats_comparison(
182185
run_dir,
183186
base_dir,
184187
analysis_type="spatiotemporal",
185188
test_type="ks",
186189
alpha=0.01,
190+
run_file_pattern=self.ENSEMBLE_FILE_PATTERN,
191+
base_file_pattern=self.ENSEMBLE_FILE_PATTERN,
187192
)
188193

189194
if new_ts == "PASS":

0 commit comments

Comments
 (0)