Skip to content

Commit c4b494f

Browse files
committed
Fixup output comparison paths
1 parent 2a41fe5 commit c4b494f

File tree

2 files changed

+28
-20
lines changed

2 files changed

+28
-20
lines changed

compass/ocean/tests/global_ocean/init/__init__.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ def __init__(self, test_group, mesh, initial_condition,
5454
# Add the name of the subdir without inactive top cells whether or
5555
# not is has or will be run
5656
self.inactive_top_comp_subdir = init_subdir
57-
init_subdir = os.path.join(init_subdir, inactive_top)
57+
name = f'{name}_inactive_top'
5858
self.init_subdir = init_subdir
5959
subdir = os.path.join(self.init_subdir, name)
6060
super().__init__(test_group=test_group, name=name, subdir=subdir)
@@ -66,7 +66,7 @@ def __init__(self, test_group, mesh, initial_condition,
6666
self.add_step(
6767
InitialState(
6868
test_case=self, mesh=mesh,
69-
initial_condition=initial_condition,
69+
initial_condition=initial_condition,
7070
with_inactive_top_cells=with_inactive_top_cells))
7171

7272
if mesh.with_ice_shelf_cavities:
@@ -116,11 +116,12 @@ def validate(self):
116116
if os.path.exists(filename2):
117117
variables = ['temperature', 'salinity', 'layerThickness',
118118
'normalVelocity']
119-
compare_variables(test_case=self, variables=variables,
120-
filename1='initial_state/initial_state_crop.nc'
121-
filename2=filename2,
122-
quiet=False, check_outputs=False,
123-
skip_if_step_not_run=False)
119+
compare_variables(
120+
test_case=self, variables=variables,
121+
filename1='initial_state/initial_state_crop.nc',
122+
filename2=filename2,
123+
quiet=False, check_outputs=False,
124+
skip_if_step_not_run=False)
124125

125126
else:
126127
self.logger.warn('The version of "init" without inactive top '

compass/ocean/tests/global_ocean/performance_test/__init__.py

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import os
2+
3+
from compass.ocean.inactive_top_cells import remove_inactive_top_cells_output
24
from compass.ocean.tests.global_ocean.forward import (
35
ForwardStep,
46
ForwardTestCase,
57
)
68
from compass.validate import compare_timers, compare_variables
7-
from compass.ocean.inactive_top_cells import remove_inactive_top_cells_output
89

910

1011
class PerformanceTest(ForwardTestCase):
@@ -33,9 +34,13 @@ def __init__(self, test_group, mesh, init, time_integrator):
3334
time_integrator : {'split_explicit', 'RK4'}
3435
The time integrator to use for the forward run
3536
"""
37+
name = 'performance_test'
38+
if init.with_inactive_top_cells:
39+
self.inactive_top_comp_subdir = os.path.join(
40+
mesh.mesh_name, init.initial_condition, name)
41+
name = f'{name}_inactive_top'
3642
super().__init__(test_group=test_group, mesh=mesh, init=init,
37-
time_integrator=time_integrator,
38-
name='performance_test')
43+
time_integrator=time_integrator, name=name)
3944

4045
if mesh.with_ice_shelf_cavities:
4146
this_module = self.__module__
@@ -74,19 +79,21 @@ def validate(self):
7479
filename1=f'{step_subdir}/output.nc')
7580

7681
if self.init.with_inactive_top_cells:
77-
# construct the work directory for the other test
78-
subdir = get_forward_subdir(self.init.inactive_top_comp_subdir,
79-
self.time_integrator, self.name)
80-
filename2 = os.path.join(self.base_work_dir, self.mpas_core.name,
81-
self.test_group.name, subdir,
82+
filename2 = os.path.join(self.base_work_dir,
83+
self.mpas_core.name,
84+
self.test_group.name,
85+
self.inactive_top_comp_subdir,
8286
'forward/output.nc')
8387
if os.path.exists(filename2):
84-
compare_variables(test_case=self, variables=variables,
85-
filename1='forward/output_crop.nc',
86-
filename2=filename2)
88+
compare_variables(
89+
test_case=self, variables=variables,
90+
filename1=f'{step_subdir}/output_crop.nc',
91+
filename2=filename2,
92+
quiet=False, check_outputs=False,
93+
skip_if_step_not_run=False)
8794
else:
88-
self.logger.warn('The version of "performance_test" without '
89-
'inactive top cells was not run.\n'
95+
self.logger.warn('The version of "performance_test" '
96+
'without inactive top cells was not run. '
9097
'Skipping validation.')
9198

9299
if self.mesh.with_ice_shelf_cavities:

0 commit comments

Comments
 (0)