我使用这种 Metpy 插值方法 https://unidata.github.io/MetPy/latest/examples/gridding/Point_Interpolation.html#sphx-glr-examples-gridding-point-interpolation-py。我的问题是如何获得给定点的插值温度值,在这种情况下来自纽约的图像?所以,我得到了纬度和经度,我得到了那个时候的温度值。 在此处输入图像描述
问问题
299 次
2 回答
0
在示例代码中,数据被投影到使用以下方法创建的 Albers 等面积投影上的网格:
import cartopy.crs as ccrs
to_proj = ccrs.AlbersEqualArea(central_longitude=-97.0000, central_latitude=38.0000)
您可以使用to_proj
以下方法将纬度/经度转换为投影坐标:
pt_x, pt_y = to_proj.transform_point(lon, lat, ccrs.Geodetic())
然后,您可以使用pt_x
and查找and数组(在原始示例代码中创建)中pt_y
最接近的索引,以将数据值拉出数组。gx
gy
img
如果您真的只关心特定位置的值,您可能需要查看 MetPy 的interpolate_to_points
函数。
于 2019-01-17T22:07:20.057 回答
0
好的,我使用此命令解决了问题:
proj = ccrs.PlateCarree()
to_proj = ccrs.Mercator()
back_to_lon = precx.ravel()
back_to_lat = precy.ravel()
back_to_prec = prec_p.ravel()
pt_x = proj.transform_points(to_proj,back_to_lon,back_to_lat,back_to_prec)
于 2019-01-19T20:02:32.240 回答