I use this Metpy interpolation methods https://unidata.github.io/MetPy/latest/examples/gridding/Point_Interpolation.html#sphx-glr-examples-gridding-point-interpolation-py. My question is how do I get the interpolated temperature value for the given point, in this case from the image for the New York? So, I'm getting lat and lon and I get the temperature value at that point. enter image description here
In the example code, the data are being projected to a grid on an Albers Equal Area projection created with:
import cartopy.crs as ccrs
to_proj = ccrs.AlbersEqualArea(central_longitude=-97.0000, central_latitude=38.0000)
You can use to_proj
to convert your lat/lon into projected coordinates using:
pt_x, pt_y = to_proj.transform_point(lon, lat, ccrs.Geodetic())
You can then use pt_x
and pt_y
to find the closest indices in the gx
and gy
arrays (created in the original example code) to pull the data value out of the img
array.
If you really only care about the value at a particular location, you might want to look at MetPy's interpolate_to_points
function.