Skip to content

Commit

Permalink
Handle MALI IC without attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Jul 8, 2024
1 parent cd673ee commit be2486f
Showing 1 changed file with 18 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit be2486f

Please sign in to comment.