Skip to content

Commit

Permalink
Add Bnds array
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewhoffman committed Nov 21, 2024
1 parent 77e1f98 commit 3a8f805
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions landice/mesh_tools_li/interpolate_mpasOcean_to_mali.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,18 @@ def __init__(self):
-570, -630, -690, -750, -810, -870, -930, -990, -1050, -1110, -1170,\
-1230, -1290, -1350, -1410, -1470, -1530, -1590, -1650, -1710, -1770), dtype='float64')

# create bnds array
self.ismip6shelfMelt_zBndsOcean = np.zeros((2, len(self.ismip6shelfMelt_zOcean)))
self.ismip6shelfMelt_zBndsOcean[0, 0] = 0.0
for z in range(1, len(self.ismip6shelfMelt_zOcean)):
self.ismip6shelfMelt_zBndsOcean[0, z] = 0.5 * (self.ismip6shelfMelt_zOcean[z - 1] +
self.ismip6shelfMelt_zOcean[z])
for z in range(0, len(self.ismip6shelfMelt_zOcean) - 1):
self.ismip6shelfMelt_zBndsOcean[1, z] = 0.5 * (self.ismip6shelfMelt_zOcean[z] +
self.ismip6shelfMelt_zOcean[z + 1])
self.ismip6shelfMelt_zBndsOcean[1, -1] = self.ismip6shelfMelt_zOcean[-1] + \
(self.ismip6shelfMelt_zOcean[-1] - self.ismip6shelfMelt_zBndsOcean[0, -1])

def prepare_mpaso_mesh_data(self):

#open mpas ocean mesh
Expand Down Expand Up @@ -335,6 +347,7 @@ def remap_mpas_to_mali(self, year):
ds_remapped = xr.open_dataset(tmp_maliDestFile, decode_times=False, decode_cf=False)
ds_out = xr.Dataset(data_vars={'ismip6shelfMelt_3dThermalForcing': ds_remapped['ismip6shelfMelt_3dThermalForcing']})
ds_out['ismip6shelfMelt_zOcean'] = xr.DataArray(self.ismip6shelfMelt_zOcean, dims=("nISMIP6OceanLayers"))
ds_out['ismip6shelfMelt_zBndsOcean'] = xr.DataArray(self.ismip6shelfMelt_zBndsOcean, dims=("TWO", "nISMIP6OceanLayers"))
if self.have_landIceFreshwaterFlux:
ds_out['floatingBasalMassBal'] = ds_remapped['floatingBasalMassBal']

Expand Down

0 comments on commit 3a8f805

Please sign in to comment.