Get point from HRRR grid nearest a latitude/longitude location #6
Replies: 1 comment
-
Here is a short about this same issue, and another link to the github issue that will make this type of indexing possible.
<script async |
Beta Was this translation helpful? Give feedback.
-
One question I get asked often (and still don't know the best answer to), is "How do I get the grid point nearest a specific latitude/longitude location?"
As far as I understand, there still isn't a method to select a point in a grid nearest a latitude/longitude from an xarray.Dataset with curvilinear grid (like HRRR, which is in a Lambert Conformal projection).
I have devised a straightforward (at least to me) method to pluck out a point from a grid in a few lines of python described in this notebook.
This method is used in my function pluck_points for an xarray.Dataset that has coordinates 'latitude' and 'longitude'.
There is some additional discussion of this topic at StackOverflow. One alternative method is to transform the lat/lon grid and point to the projection coordinates and do a ds.sel on that (idea from Karl Schneider).
There is work in progress on the xarray front to make it possible to select nearest lat/lon points along multidimensional indecies. Check out the discussion in xarray's "Explicit Index" project: https://github.com/pydata/xarray/projects/1
Beta Was this translation helpful? Give feedback.
All reactions