插值结果python metpy中的NAN值

发布于 2025-02-01 15:12:14 字数 710 浏览 2 评论 0原文

我有一个带有(纬度,经度,温度)的数据集,我正在尝试将温度插入以与轮廓绘制。但是,插值中有NAN值(我敢肯定我的数据没有NAN值)。

df = pd.read_excel('temp_data.xlsx')
lat = df['LatDD'].values
lon = df['LongDD'].values
tem = df['Air_T'].values

# convert from ccrs.LambertConformal to ccrs.PlateCarree()
xp, yp, _ = crs.transform_points(ccrs.PlateCarree(), lon, lat ).T

xp, yp, tem = remove_nan_observations(xp, yp, tem)

alt_x, alt_y, data = interpolate_to_grid( xp, yp, tem, minimum_neighbors=1, interp_type = 'cressman', hres = 2000)
print(data.min())

结果(以及一些信息)

印刷结果

以下是插值温度 即使原始数据没有任何数据,数据也具有NAN?最后会影响我的轮廓图吗?如果是,我该如何解决此问题?

I have a data set with (latitude, longitude, temperature) and I'm trying to interpolate the temperature to graph it with contourf. However, the interpolated has nan values in it (I'm sure that my data does not have nan values).

df = pd.read_excel('temp_data.xlsx')
lat = df['LatDD'].values
lon = df['LongDD'].values
tem = df['Air_T'].values

# convert from ccrs.LambertConformal to ccrs.PlateCarree()
xp, yp, _ = crs.transform_points(ccrs.PlateCarree(), lon, lat ).T

xp, yp, tem = remove_nan_observations(xp, yp, tem)

alt_x, alt_y, data = interpolate_to_grid( xp, yp, tem, minimum_neighbors=1, interp_type = 'cressman', hres = 2000)
print(data.min())

Below is the interpolated temperature result (as well as some information)

Printed result

Is it normal for interpolated data to have nan even though the original data does not have any? Will it affect my contourf plot at the end? If yes, how do I fix this problem?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

倒数 2025-02-08 15:12:15

如果网格试图插值到原始数据域之外的点,则返回nan而不是推断。

If the grid tries to interpolate to points outside the domain of the original data, than nan is returned rather than extrapolating.

梦亿 2025-02-08 15:12:15

正如上面提到的多普勒速度(Dopplershift),看来我的search_radius太小了,在域之外的某些点找不到任何参考点以插入的参考点。我的解决方案是增加search_radius并解决了问题。

As DopplerShift mentioned above, it seems that my search_radius is too small and some point that is outside of the domain cannot find any reference point close to it to interpolate. My solution was to increase the search_radius and the problem was solved.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文