home / github / issues

Menu
  • GraphQL API
  • Search all tables

issues: 314241348

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
314241348 MDU6SXNzdWUzMTQyNDEzNDg= 2056 Warning on supplying a Dataset to the Dataset constructor 5635139 closed 0     3 2018-04-13T20:31:12Z 2018-11-07T15:40:49Z 2018-11-07T15:40:49Z MEMBER      

```python

In [1]: import xarray as xr

In [3]: ds=xr.Dataset({'a':xr.DataArray([1,2,3])})

In [4]: xr.Dataset(ds) /Users/maximilian/drive/workspace/xarray/xarray/core/dataset.py:373: FutureWarning: iteration over an xarray.Dataset will change in xarray v0.11 to only include data variables, not coordinates. Iterate over the Dataset.variables property instead to preserve existing behavior in a forwards compatible manner. both_data_and_coords = [k for k in data_vars if k in coords] Out[4]: <xarray.Dataset> Dimensions: (dim_0: 3) Dimensions without coordinates: dim_0 Data variables: a (dim_0) int64 1 2 3 ```

Problem description

Currently we run both_data_and_coords = [k for k in data_vars if k in coords], where data_vars is the first arg to the constructor. So, when data_vars is a Dataset, we'll raise a warning.

More importantly: this raises the question of how we should handle xr.Dataset(ds) Currently we retain the coords, but discard attrs. That seems arbitrary? I'd have to check, but when we change __iter__ to only reference data_vars, we may also discard coords

I don't have a strong view. If you think that Foo(foo) should always return foo (which is often the case in pandas), then we should retain the full object. If you think that foo is supplied to the data_vars arg, then retaining only the data_vars seems reasonable

Expected Output

Output of xr.show_versions()

INSTALLED VERSIONS ------------------ commit: a9d1f3a36229636f0d519eb36a8d4a7c91f6e1cd python: 3.6.5.final.0 python-bits: 64 OS: Darwin OS-release: 17.4.0 machine: x86_64 processor: i386 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: en_US.UTF-8 xarray: 0.10.2+dev31.g0a24429 pandas: 0.22.0 numpy: 1.14.2 scipy: 1.0.0 netCDF4: None h5netcdf: None h5py: None Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.17.2 distributed: None matplotlib: 2.1.2 cartopy: None seaborn: 0.8.1 setuptools: 39.0.1 pip: 9.0.3 conda: None pytest: 3.5.0 IPython: 6.3.0 sphinx: None
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/2056/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

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