diff --git a/compass/ocean/tests/global_ocean/init/__init__.py b/compass/ocean/tests/global_ocean/init/__init__.py index e78650e1c9..bcc50f53ba 100644 --- a/compass/ocean/tests/global_ocean/init/__init__.py +++ b/compass/ocean/tests/global_ocean/init/__init__.py @@ -130,17 +130,24 @@ def validate(self): if self.with_inactive_top_cells: # construct the work directory for the other test + filename1 = 'initial_state/initial_state_crop.nc' filename2 = os.path.join(self.base_work_dir, self.mpas_core.name, self.test_group.name, self.inactive_top_comp_subdir, 'init/initial_state/initial_state.nc') - variables = [ - 'temperature', 'salinity', 'layerThickness', 'normalVelocity'] - compare_variables(test_case=self, variables=variables, - filename1='initial_state/initial_state_crop.nc', - filename2=filename2, quiet=False, - check_outputs=False, - skip_if_step_not_run=False) + if os.path.exists(filename2): + variables = [ + 'temperature', 'salinity', 'layerThickness', + 'normalVelocity'] + compare_variables(test_case=self, variables=variables, + filename1=filename1, filename2=filename2, + quiet=False, check_outputs=False, + skip_if_step_not_run=False) + + else: + self.logger.warn('The version of "init" without inactive top ' + 'cells was not run. Skipping\n' + 'validation.') if self.mesh.with_ice_shelf_cavities: variables = ['ssh', 'landIcePressure'] diff --git a/compass/ocean/tests/global_ocean/performance_test/__init__.py b/compass/ocean/tests/global_ocean/performance_test/__init__.py index 85f1f14c18..e68c89ca4a 100644 --- a/compass/ocean/tests/global_ocean/performance_test/__init__.py +++ b/compass/ocean/tests/global_ocean/performance_test/__init__.py @@ -65,19 +65,25 @@ def validate(self): if self.init.with_inactive_top_cells: # construct the work directory for the other test + filename1 = 'forward/output_crop.nc' + subdir = get_forward_subdir(self.init.inactive_top_comp_subdir, self.time_integrator, self.name) filename2 = os.path.join(self.base_work_dir, self.mpas_core.name, self.test_group.name, subdir, 'forward/output.nc') - variables = ['temperature', 'salinity', 'layerThickness', - 'normalVelocity'] - compare_variables(test_case=self, variables=variables, - filename1='forward/output_crop.nc', - filename2=filename2, - quiet=False, check_outputs=False, - skip_if_step_not_run=False) + if os.path.exists(filename2): + variables = ['temperature', 'salinity', 'layerThickness', + 'normalVelocity'] + compare_variables(test_case=self, variables=variables, + filename1=filename1, filename2=filename2, + quiet=False, check_outputs=False, + skip_if_step_not_run=False) + else: + self.logger.warn('The version of "performance_test" without ' + 'inactive top cells was not run.\n' + 'Skipping validation.') if self.mesh.with_ice_shelf_cavities: variables = [