Closed
Description
I am using Ubuntu 16, python 3.6, and xarary 0.9.5.
import numpy as np
import xarray as xr
# setup for a simple grid
DX = 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 array
dims = '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 1000
dar2 = 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.