|
1 | 1 | import os |
| 2 | + |
| 3 | +from compass.ocean.inactive_top_cells import remove_inactive_top_cells_output |
2 | 4 | from compass.ocean.tests.global_ocean.forward import ( |
3 | 5 | ForwardStep, |
4 | 6 | ForwardTestCase, |
5 | 7 | ) |
6 | 8 | from compass.validate import compare_timers, compare_variables |
7 | | -from compass.ocean.inactive_top_cells import remove_inactive_top_cells_output |
8 | 9 |
|
9 | 10 |
|
10 | 11 | class PerformanceTest(ForwardTestCase): |
@@ -33,9 +34,13 @@ def __init__(self, test_group, mesh, init, time_integrator): |
33 | 34 | time_integrator : {'split_explicit', 'RK4'} |
34 | 35 | The time integrator to use for the forward run |
35 | 36 | """ |
| 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' |
36 | 42 | 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) |
39 | 44 |
|
40 | 45 | if mesh.with_ice_shelf_cavities: |
41 | 46 | this_module = self.__module__ |
@@ -74,19 +79,21 @@ def validate(self): |
74 | 79 | filename1=f'{step_subdir}/output.nc') |
75 | 80 |
|
76 | 81 | 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, |
82 | 86 | 'forward/output.nc') |
83 | 87 | 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) |
87 | 94 | 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. ' |
90 | 97 | 'Skipping validation.') |
91 | 98 |
|
92 | 99 | if self.mesh.with_ice_shelf_cavities: |
|
0 commit comments