Stream: python-questions

Topic: interpolate_na in xarray in 2d?


view this post on Zulip Allison Baker (May 07 2021 at 19:41):

I am trying to figure out if there is a way to have xr.interpolate_na perform 2d interpolation since I have CAM data on a lat/lon grid. It looks like I have to specify for it to interpolate the nans in either the lat or lon dimension (so 1d interpolation)...(and it seems like it would be location-dependent whether lat or lon was more appropriate...so I'd rather do 2d interpolation)

view this post on Zulip Brian Bonnlander (May 07 2021 at 20:01):

Based on my limited knowledge, you may have more numerical functions at your disposal if you convert the data from xr to numpy. Then check out what numpy has to offer, or other libraries built on top of numpy.

view this post on Zulip Haiying Xu (May 07 2021 at 20:14):

Scipy can partial do 2d interpolate, but the edge may still be NAN. https://stackoverflow.com/questions/37662180/interpolate-missing-values-2d-python

view this post on Zulip Allison Baker (May 07 2021 at 21:48):

ok, thanks. I don't want the edges to be nan, but I'll take a look ...


Last updated: Jan 30 2022 at 12:01 UTC