diff --git a/compass/ocean/tests/global_ocean/mesh/remap_mali_topography/__init__.py b/compass/ocean/tests/global_ocean/mesh/remap_mali_topography/__init__.py index 6bf7ceb88..f661f9f8f 100644 --- a/compass/ocean/tests/global_ocean/mesh/remap_mali_topography/__init__.py +++ b/compass/ocean/tests/global_ocean/mesh/remap_mali_topography/__init__.py @@ -110,20 +110,27 @@ def _remap_mali_topo(self): ice_density = config.getfloat('remap_topography', 'ice_density') - mali_ice_density = ds_mali.attrs['config_ice_density'] - mali_ocean_density = ds_mali.attrs['config_ocean_density'] - sea_level = ds_mali.attrs['config_sea_level'] - g = constants['SHR_CONST_G'] ocean_density = constants['SHR_CONST_RHOSW'] - if ice_density != mali_ice_density: - raise ValueError('Ice density from the config option in ' - '[remap_topography] does not match the value ' - 'from MALI config_ice_density') - if ocean_density != mali_ocean_density: - logger.warn('\nWARNING: Ocean density from SHR_CONST_RHOSW does ' - 'not match the value from MALI config_ocean_density\n') + if 'config_ice_density' in ds_mali.attrs: + mali_ice_density = ds_mali.attrs['config_ice_density'] + if ice_density != mali_ice_density: + raise ValueError('Ice density from the config option in ' + '[remap_topography] does not match the value ' + 'from MALI config_ice_density') + + if 'config_ocean_density' in ds_mali.attrs: + mali_ocean_density = ds_mali.attrs['config_ocean_density'] + if ocean_density != mali_ocean_density: + logger.warn('\nWARNING: Ocean density from SHR_CONST_RHOSW ' + 'does not match the value from MALI ' + 'config_ocean_density\n') + + if 'config_sea_level' in ds_mali.attrs: + sea_level = ds_mali.attrs['config_sea_level'] + else: + sea_level = 0. draft = - (ice_density / ocean_density) * thickness