Closed
Description
Slicing a Dataset with a slice object includes the upper bound, which is different from python, numpy etc.
python 2.7.12, xarray 0.9.6. #1492 (comment) may be relevant, a quick search didn't reveal other issues:
The following illustrates the issue:
import numpy as np
import xarray as xr
time = xr.DataArray(np.arange(50), dims=['time'], coords={'time' : np.arange(50)})
data = xr.DataArray(np.arange(1000), dims=['row'], coords={'row' : np.arange(1000)})
ds = xr.Dataset({"time" : time, "data" : data})
print ds.sel(time=slice(0,10), row=slice(0,100))
print ds.sel(time=slice(0,10-1), row=slice(0,100-1))
produces
<xarray.Dataset>
Dimensions: (row: 101, time: 11)
Coordinates:
* row (row) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
* time (time) int64 0 1 2 3 4 5 6 7 8 9 10
Data variables:
data (row) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
<xarray.Dataset>
Dimensions: (row: 100, time: 10)
Coordinates:
* row (row) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
* time (time) int64 0 1 2 3 4 5 6 7 8 9
Data variables:
data (row) int64 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 ...
Metadata
Metadata
Assignees
Labels
No labels