<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body style="overflow-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;">Hi Joan,<div><br></div><div>did you get an answer for this question?</div><div><br></div><div>It’s clearly an xmitgcm/xgcm question and should be posted on their respective pages, I guess that’s why no-one has replied so far.</div><div><br></div><div>I just played with the xgcm.Grid.interp yesterday and my conclusion is that “fill_value” determines what you have after interpolation (in your example you chose np.nan), also the value of “boundary” should be choosen carefully (maybe try ‘<font face="var(--jp-code-font-family)">extend')</font>. Obviously this is not an expert opinion (I really struggle with xArray and xgcm).</div><div><br></div><div>Martin</div><div><div><br><blockquote type="cite"><div>On 1. Feb 2024, at 23:26, Joan M. Bonilla Pagan <jbonil11@jhu.edu> wrote:</div><br class="Apple-interchange-newline"><div><meta charset="UTF-8"><div class="WordSection1" style="page: WordSection1; caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="background: white;">Hello,</span><span style=""><br><br><o:p></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="">Hope this one works.<o:p></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><span style=""><br><span style="background: white;">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:</span><br><span style="background: white;">grid.interp(</span><br><span style="background: white;"> ds[var],</span><br><span style="background: white;"> axis=dim[0],</span><br><span style="background: white;"> to="center",</span><br><span style="background: white;"> boundary="fill",</span><br><span style="background: white;"> fill_value=_np.nan,</span><br><span style="background: white;"> )</span><br><span style="background: white;">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.</span><br><br><span style="background: white;">Very respectfully,</span></span><span style="color: rgb(29, 29, 29);"><o:p></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><span style="background: white;">Joan M.</span><span style="color: rgb(29, 29, 29);"><o:p></o:p></span></div><div style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;"><o:p> </o:p></div></div><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">_______________________________________________</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><span style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none; float: none; display: inline !important;">MITgcm-support mailing list</span><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><a href="mailto:MITgcm-support@mitgcm.org" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">MITgcm-support@mitgcm.org</a><br style="caret-color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; word-spacing: 0px; -webkit-text-stroke-width: 0px; text-decoration: none;"><a href="http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant-caps: normal; font-weight: 400; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;">http://mailman.mitgcm.org/mailman/listinfo/mitgcm-support</a></div></blockquote></div><br></div></body></html>