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

Use a tree algorithm for finding closest point to extract time series #4

Open
rsignell-usgs opened this issue Apr 23, 2019 · 0 comments

Comments

@rsignell-usgs
Copy link
Member

Part of the workflow here is: Given a specific (lon,lat) location, how do we find the nearest cell to extract the time series from?

If lon,lat are 1D arrays, xarray already can do this for us. But if lon,lat are 2d arrays, currently xarray cannot.

Currently we are just calculating the distance between all the grid points and the specified point, and doing this again for each point selected. This works okay for small grids, but is inefficient and will be slow on large grids.

Instead, we should generate a tree (e.g. kdtree), and use the tree each time we need to extract a time series.

There are numerous ways approaches/tools that could be used. One of the more promising is to use pyresample.

Of course it would be nice if xarray could just handle this case natively. There has been some discussion on: pydata/xarray#475 (comment), and it was mentioned on a recent Pangeo.io call that work was underway on xarray to make coordinates more flexible. @rabernat, is this issue what you were referring to? Do you have any suggestions for @hdsingh on how to engage?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant