我使用这种Metpy插值方法https://unidata.github.io/MetPy/latest/examples/gridding/Point_Interpolation.html#sphx-glr-examples-gridding-point-interpolation-py。我的问题是如何获得给定点的插值温度值,在本例中是从纽约的图像中获得的。所以,我越来越晚了,我得到了那个点的温度值。enter image description here
发布于 2019-01-18 06:07:20
在示例代码中,数据将投影到使用以下命令创建的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和pt_y在gx和gy数组(在原始示例代码中创建)中找到最接近的索引,以便从img数组中提取数据值。
如果你真的只关心某个特定位置的值,你可能想看看MetPy的interpolate_to_points函数。
发布于 2019-01-20 04:02:32
好的,我用这个命令解决了这个问题:
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)https://stackoverflow.com/questions/54241869
复制相似问题