Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

extract values at nearest point with multidimensional latitude and longitude field #1325

Closed
jinhuanz opened this issue Mar 24, 2017 · 2 comments
Labels

Comments

@jinhuanz
Copy link

How do I extract values at a specific latitude and longitude point when latitude/longitude values are 2-D array?

I have a dataset with the following coordinates:

Dimensions: (x: 6165, y: 5801)
Coordinates:

  • y (y) float64 0.0 3e+03 6e+03 9e+03 1.2e+04 1.5e+04 ...
  • x (x) float64 0.0 3e+03 6e+03 9e+03 1.2e+04 1.5e+04 ...
    latitude (y, x) float64 10.16 10.17 10.17 10.18 10.19 10.19 ...
    longitude (y, x) float64 78.99 79.01 79.03 79.05 79.08 79.1 ...

I want to extract value for at a specific latitude and longitude point and the exact latitude/longitude value is not in the coordinates. Then I started with calculate the distance between two point on Earth, and then get the (x_idx, y_idx) by minimize the distance. However, CPU and time costing is a result because of the large size of data.

I'm wondering is there any other ways could make it less costing?

@shoyer
Copy link
Member

shoyer commented Mar 24, 2017

The right solution is to use a KDTree. We've discussed possible syntax for this in #475 but nobody has implemented it yet. Russ Rew wrote a nice overview article on using KDTree in http://www.unidata.ucar.edu/blogs/developer/entry/accessing_netcdf_data_by_coordinates

@stale
Copy link

stale bot commented Feb 22, 2019

In order to maintain a list of currently relevant issues, we mark issues as stale after a period of inactivity

If this issue remains relevant, please comment here or remove the stale label; otherwise it will be marked as closed automatically

@stale stale bot added the stale label Feb 22, 2019
@shoyer shoyer closed this as completed Feb 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants