[MITgcm-support] Ignoring NaNs during interpolation

Joan M. Bonilla Pagan jbonil11 at jhu.edu
Thu Feb 1 17:26:36 EST 2024


Hello,

Hope this one works.

My name is Joan, I am a current student who is using MITgcm models. I am trying to edit an interpolation scheme that is taking variables located in the edges and sides of the grid cells and interpolating them to the center of the grid using a structure like the one below:
grid.interp(
                 ds[var],
                 axis=dim[0],
                 to="center",
                 boundary="fill",
                 fill_value=_np.nan,
             )
Where ds is an xarray.Dataset that contains the output of the model. Currently, if one of the corners or sides of the grid is a NaN then the interpolated values at the center will be a NaN. Is there a way to change that? I would like to make is so that the interpolation ignores NaNs for cells that have at least one value. Is this possible? I was thinking I could mask the coast afterwards.

Very respectfully,
Joan M.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.mitgcm.org/pipermail/mitgcm-support/attachments/20240201/ff943dd5/attachment.html>


More information about the MITgcm-support mailing list