From 3a8f805dc103bfea709a4414c06ac04c785ff3b9 Mon Sep 17 00:00:00 2001 From: Matthew Hoffman Date: Wed, 20 Nov 2024 23:02:47 -0600 Subject: [PATCH] Add Bnds array --- .../mesh_tools_li/interpolate_mpasOcean_to_mali.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/landice/mesh_tools_li/interpolate_mpasOcean_to_mali.py b/landice/mesh_tools_li/interpolate_mpasOcean_to_mali.py index 9d7e6415f..7d703151d 100755 --- a/landice/mesh_tools_li/interpolate_mpasOcean_to_mali.py +++ b/landice/mesh_tools_li/interpolate_mpasOcean_to_mali.py @@ -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 @@ -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']