issues: 206028154
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 |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
206028154 | MDU6SXNzdWUyMDYwMjgxNTQ= | 1253 | Slice on netcdf dataset has transient lazy indexing problem | 5498387 | closed | 0 | 4 | 2017-02-07T21:55:10Z | 2017-02-07T23:17:28Z | 2017-02-07T23:17:28Z | NONE | I am trying to open a netcdf dataset off an ERDDAP server, slice out a subset of times, and run further manipulations on the result. This snippet: ``` import xarray as xr remote_ds=xr.open_dataset("http://sfbaynutrients.sfei.org/erddap/tabledap/usgs_sfb_nutrients") Doesn't break if the slice is [10:20], [10:9000], [183039:183049]Only get the behavior when the slice is large-ish and far from the beginningsliced_ds=remote_ds.isel(s=slice(183039, 191509, None)) print(sliced_ds['s.Distance_from_station_36'][:10]) print(sliced_ds['s.Distance_from_station_36'][:10]) print(remote_ds['s.Distance_from_station_36'][:10]) print(xr.version.version) ``` Yields the following output:
(I've omitted attributes for brevity - the printed attributes are identical for all 3). The issue is that the first time I print or copy data from sliced_ds, it ignores the slice and displays the un-sliced data. The exact same print statement, a second time, gives the correct values. For reference, I've also printed the first 10 elements of the unsliced data, to show that they agree with the first, erroneous, print result. The behavior is not limited to print statements -- a deep copy sliced_ds will also show this issue. System: linux, kubuntu. python=anaconda 3.5.1. numpy=1.10.4, xarray 0.9.1. As a workaround, I can call sliced_ds.copy(deep=True) twice and the second time around it's okay. |
{ "url": "https://api.github.com/repos/pydata/xarray/issues/1253/reactions", "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
completed | 13221727 | issue |