Skip to content

Commit 6380088

Browse files
committed
Translate var names before baseline validation
1 parent 6e35764 commit 6380088

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

polaris/ocean/model/ocean_model_step.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from ruamel.yaml import YAML
55

66
from polaris.model_step import ModelStep
7+
from polaris.tasks.ocean import Ocean
78

89

910
class OceanModelStep(ModelStep):
@@ -323,6 +324,32 @@ def update_namelist_eos(self):
323324

324325
self.add_model_config_options(options=replacements)
325326

327+
def validate_baselines(self):
328+
"""
329+
Compare variables between output files in this step and in the same
330+
step from a baseline run if one was provided.
331+
332+
Returns
333+
-------
334+
compared : bool
335+
Whether a baseline comparison was performed
336+
337+
success : bool
338+
Whether the outputs were successfully validated against a baseline
339+
"""
340+
if not isinstance(self.component, Ocean):
341+
raise TypeError(
342+
'component must be an instance of Ocean to map model vars'
343+
)
344+
# translate variable names to native model names
345+
validate_vars = {}
346+
for filename, vars in self.validate_vars.items():
347+
validate_vars[filename] = (
348+
self.component.map_var_list_to_native_model(vars)
349+
)
350+
self.validate_vars = validate_vars
351+
return super().validate_baselines()
352+
326353
def _update_ntasks(self):
327354
"""
328355
Update ``ntasks`` and ``min_tasks`` for the step based on the estimated

0 commit comments

Comments
 (0)