home / github / issues

Menu
  • Search all tables
  • GraphQL API

issues: 245893358

This data as json

id node_id number title user state locked assignee milestone comments created_at updated_at closed_at author_association active_lock_reason draft pull_request body reactions performed_via_github_app state_reason repo type
245893358 MDU6SXNzdWUyNDU4OTMzNTg= 1493 ENH: points coord from isel/sel_points should be a MultiIndex 2443309 closed 0     1 2017-07-27T00:33:42Z 2017-09-07T15:25:40Z 2017-09-07T15:25:40Z MEMBER      

We implemented the pointwise indexing methods (isel_points and sel_points) before we had MultiIndex support. Would it make sense to update these methods to return objects with coordinates defined as a MultiIndex?

Current behavior:

```Python print('original --> \n', ds)

lons = [-88, -85.9] lats = [34.2, 31.9]

subset = ds.sel_points(lon=lons, lat=lats, method='nearest') print('subset --> \n', subset) ``` yields:

original --> <xarray.Dataset> Dimensions: (lat: 224, lon: 464, time: 19709) Coordinates: * lat (lat) float64 25.06 25.19 25.31 25.44 25.56 25.69 25.81 25.94 ... * lon (lon) float64 -124.9 -124.8 -124.7 -124.6 -124.4 -124.3 -124.2 ... * time (time) float64 5.548e+04 5.548e+04 5.548e+04 5.548e+04 ... Data variables: pcp (time, lat, lon) float64 nan nan nan nan nan nan nan nan nan ... subset --> <xarray.Dataset> Dimensions: (points: 2, time: 19709) Coordinates: lat (points) float64 34.19 31.94 lon (points) float64 -87.94 -85.94 * time (time) float64 5.548e+04 5.548e+04 5.548e+04 5.548e+04 ... Dimensions without coordinates: points Data variables: pcp (points, time) float64 0.0 5.698 0.0 0.0 14.66 0.0 0.0 0.0 0.0 ...

Maybe it makes sense to return an object with a MultiIndex like:

Python new = pd.MultiIndex.from_arrays([subset.lon.to_index(), subset.lat.to_index()], names=['lon', 'lat']) print(new) MultiIndex(levels=[[-87.9375, -85.9375], [31.9375, 34.1875]], labels=[[0, 1], [1, 0]], names=['lon', 'lat'])

xref: #214, #475, #507

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/1493/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed 13221727 issue

Links from other tables

  • 3 rows from issues_id in issues_labels
  • 1 row from issue in issue_comments
Powered by Datasette · Queries took 0.641ms · About: xarray-datasette