Skip to content

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

Description

@rsignell-usgs

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions