home / github / issue_comments

Menu
  • GraphQL API
  • Search all tables

issue_comments: 125349079

This data as json

html_url issue_url id node_id user created_at updated_at author_association body reactions performed_via_github_app issue
https://github.com/pydata/xarray/issues/475#issuecomment-125349079 https://api.github.com/repos/pydata/xarray/issues/475 125349079 MDEyOklzc3VlQ29tbWVudDEyNTM0OTA3OQ== 1217238 2015-07-27T21:34:42Z 2015-07-27T21:34:42Z MEMBER

I would start with the easiest case -- lookups of 1d orthogonal arrays, e.g., grid.sel(latitude=stations.latitude, longitude=stations.longitude, method='nearest'). This would very straightforwardly leverage our current machinery.

For 2D lookups, we need a KDTree. Here are some API ideas, just tossing things around...

```

ds <xray.Dataset> Dimensions: (x: 4, y: 5) Coordinates: latitude (x, y) float64 0.49 0.5682 -0.3541 -0.9305 -0.9669 0.01558 ... longitude (x, y) float64 0.3758 1.429 -1.698 -1.344 0.5237 0.6152 ... * x (x) int64 0 1 2 3 * y (y) int64 0 1 2 3 4 Data variables: temperature (x, y) float64 0.5735 -0.4871 0.4708 0.4907 -0.3318 0.2883 ...

perhaps set_ndindex is a better name?

ds = ds.set_kdtree(['latitude', 'longitude'], name='latlon_index', method='spherical') ds <xray.Dataset> Dimensions: (x: 4, y: 5) Coordinates: latitude (x, y) float64 0.49 0.5682 -0.3541 -0.9305 -0.9669 0.01558 ... longitude (x, y) float64 0.3758 1.429 -1.698 -1.344 0.5237 0.6152 ... * latlon_index (x, y) float64 (0.49, 0.3758) (0.5682, 1.429) ... * x (x) int64 0 1 2 3 * y (y) int64 0 1 2 3 4 Data variables: temperature (x, y) float64 0.5735 -0.4871 0.4708 0.4907 -0.3318 0.2883 ...

result = ds.sel_points(latitude=other.latitude, longitude=other.longitude, method='nearest') ```

{
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  95114700
Powered by Datasette · Queries took 0.928ms · About: xarray-datasette