Skip to content

Commit

Permalink
Handle MALI IC without attributes
Browse files Browse the repository at this point in the history
Move ocean_density and sea_level to config options
  • Loading branch information
xylar committed Jul 8, 2024
1 parent cd673ee commit b5e6880
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,28 +109,17 @@ def _remap_mali_topo(self):
thickness = ds_mali.thickness

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']
ocean_density = config.getfloat('remap_topography', 'ocean_density')
sea_level = config.getfloat('remap_topography', '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')

draft = - (ice_density / ocean_density) * thickness

ice_mask = ds_mali.thickness > 0
floating_mask = np.logical_and(
ice_mask,
ice_density / mali_ocean_density * thickness <= sea_level - bed)
ice_density / ocean_density * thickness <= sea_level - bed)
grounded_mask = np.logical_and(ice_mask, np.logical_not(floating_mask))
ocean_mask = np.logical_and(np.logical_not(grounded_mask),
bed < sea_level)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# config options related to remapping topography to an MPAS-Ocean mesh
[remap_topography]

# the density of ocean water (kg/m^3), equivalent to config_ocean_density in MALI
ocean_density = 1028.0

# the elevation of sea level, equivalent to config_sea_level in MALI
sea_level = 0.0


# config options related to remapping MALI topography to an MPAS-Ocean mesh
[remap_mali_topography]

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
# config options related to remapping topography to an MPAS-Ocean mesh
[remap_topography]

# the density of ocean water (kg/m^3), equivalent to config_ocean_density in MALI
ocean_density = 1028.0

# the elevation of sea level, equivalent to config_sea_level in MALI
sea_level = 0.0


# config options related to remapping MALI topography to an MPAS-Ocean mesh
[remap_mali_topography]

Expand Down

0 comments on commit b5e6880

Please sign in to comment.