issues: 232726778
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
232726778 | MDU6SXNzdWUyMzI3MjY3Nzg= | 1436 | Wrong dimension referenced in boolean indexing with .loc | 11671536 | closed | 0 | 3 | 2017-05-31T23:35:08Z | 2017-10-19T23:54:03Z | 2017-10-19T23:54:03Z | NONE | I am using Ubuntu 16, python 3.6, and xarary 0.9.5. ```python import numpy as np import xarray as xr setup for a simple gridDX = 50 X = np.arange(0, 2010, DX) Y = np.arange(0, 2010, DX) Z = np.arange(0, 2010, DX) grid_shape = (len(X), len(Y), len(Z)) Create data arraydims = 'X Y Z'.split() coords = {'X': X, 'Y': Y, 'Z': Z} dar = xr.DataArray(np.ones(grid_shape), dims=dims, coords=coords) slice the data array so that all Z values are greater than 1000dar2 = dar.loc[dar.Z > 1000] assert np.all(dar2.Z > 1000) # fails becase dar is sliced along X, not Z ``` Since the object returned from dar.Z > 1000 is a data array with "Z" as the only dim I would expect this to slice the "Z" dim rather than X. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1436/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |