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 377356113,MDU6SXNzdWUzNzczNTYxMTM=,2542,"full_like, ones_like, zeros_like should retain subclasses",500246,closed,0,,,4,2018-11-05T11:22:49Z,2023-11-05T06:27:31Z,2023-11-05T06:27:31Z,CONTRIBUTOR,,,,"#### Code Sample, ```python # Your code here import numpy import xarray class MyDataArray(xarray.DataArray): pass da = MyDataArray(numpy.arange(5)) da2 = xarray.zeros_like(da) print(type(da), type(da2)) ``` #### Problem description I would expect that `type(da2) is type(da)`, but this is not the case. The type of `da` is always ``. Rather, the output of this script is: ``` ``` #### Expected Output I would hope as an output: ``` ``` In principle changing this could break people's code, so if a change is implemented it should probably be through an optional keyword argument to the `full_like`/`ones_like`/`zeros_like` family. #### Output of ``xr.show_versions()``
INSTALLED VERSIONS ------------------ commit: None python: 3.7.0.final.0 python-bits: 64 OS: Linux OS-release: 2.6.32-754.el6.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 xarray: 0.10.7 pandas: 0.23.2 numpy: 1.15.2 scipy: 1.1.0 netCDF4: 1.4.0 h5netcdf: 0.6.1 h5py: 2.8.0 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.18.1 distributed: 1.22.0 matplotlib: 3.0.0 cartopy: 0.16.0 seaborn: 0.9.0 setuptools: 39.2.0 pip: 18.0 conda: None pytest: 3.2.2 IPython: 6.4.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2542/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,not_planned,13221727,issue 371990138,MDU6SXNzdWUzNzE5OTAxMzg=,2495,Confusing error message when using a set to pass coordinates,500246,closed,0,,,4,2018-10-19T14:48:04Z,2018-10-22T21:43:01Z,2018-10-22T20:32:48Z,CONTRIBUTOR,,,,"#### Code Sample, a copy-pastable example if possible ```python xarray.DataArray(numpy.arange(3), dims=(""x"",), coords={""x"": {""a"", ""b"", ""c""}}) ``` #### Problem description This results in a `MissingDimensionsError`, which really isn't the correct exception to raise here. ``` In [57]: xarray.DataArray(numpy.arange(3), dims=(""x"",), coords={""x"": {""a"", ""b"", ""c""}}) --------------------------------------------------------------------------- MissingDimensionsError Traceback (most recent call last) in () ----> 1 xarray.DataArray(numpy.arange(3), dims=(""x"",), coords={""x"": {""a"", ""b"", ""c""}}) /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs/FCDR37a/lib/python3.7/site-packages/xarray/core/dataarray.py in __init__(self, data, coords, dims, name, attrs, encoding, fastpath) 225 226 data = as_compatible_data(data) --> 227 coords, dims = _infer_coords_and_dims(data.shape, coords, dims) 228 variable = Variable(dims, data, attrs, encoding, fastpath=True) 229 /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs/FCDR37a/lib/python3.7/site-packages/xarray/core/dataarray.py in _infer_coords_and_dims(shape, coords, dims) 62 if utils.is_dict_like(coords): 63 for k, v in coords.items(): ---> 64 new_coords[k] = as_variable(v, name=k) 65 elif coords is not None: 66 for dim, coord in zip(dims, coords): /group_workspaces/cems2/fiduceo/Users/gholl/anaconda3/envs/FCDR37a/lib/python3.7/site-packages/xarray/core/variable.py in as_variable(obj, name) 99 'cannot set variable %r with %r-dimensional data ' 100 'without explicit dimension names. Pass a tuple of ' --> 101 '(dims, data) instead.' % (name, data.ndim)) 102 obj = Variable(name, obj, fastpath=True) 103 else: MissingDimensionsError: cannot set variable 'x' with 0-dimensional data without explicit dimension names. Pass a tuple of (dims, data) instead. ``` #### Expected Output It should probably raise a `TypeError`, because the values of the `coords` mapping must be ordered, and a set is an unordered type. If there comes a day that sets are ordered like dictionaries, then it should probably accept the values as they are. In fact, an ordered set would be even more appropriate than a list or array, seeing as coordinate values should be unique :) #### Output of ``xr.show_versions()``
INSTALLED VERSIONS ------------------ commit: None python: 3.7.0.final.0 python-bits: 64 OS: Linux OS-release: 2.6.32-754.el6.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.UTF-8 LOCALE: en_GB.UTF-8 xarray: 0.10.7 pandas: 0.23.2 numpy: 1.15.2 scipy: 1.1.0 netCDF4: 1.4.0 h5netcdf: 0.6.1 h5py: 2.8.0 Nio: None zarr: None bottleneck: 1.2.1 cyordereddict: None dask: 0.18.1 distributed: 1.22.0 matplotlib: 3.0.0 cartopy: 0.16.0 seaborn: 0.9.0 setuptools: 39.2.0 pip: 18.0 conda: None pytest: 3.2.2 IPython: 6.4.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2495/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 281552158,MDExOlB1bGxSZXF1ZXN0MTU3OTUwMzcy,1777,Respect PEP 440,500246,closed,0,,,4,2017-12-12T21:59:18Z,2017-12-15T07:26:33Z,2017-12-15T07:26:24Z,CONTRIBUTOR,,0,pydata/xarray/pulls/1777,"Change unreleased version numbers as to respect PEP 440. Rather than `0.10.0-9-g89a1a98` we will have `0.10.0+dev9.g89a1a98`. This means automated setuptools requirements can be respected. Closes #1300. - [x] Closes #1300 (remove if there is no corresponding issue, which should only be the case for minor changes) - [ ] Tests added (for all bug fixes or enhancements) - [ ] Tests passed (for all non-documentation changes) - [x] Passes ``git diff upstream/master **/*py | flake8 --diff`` (remove if you did not edit any Python files) - [ ] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API (remove if this change should not be visible to users, e.g., if it is an internal clean-up, or if this is part of a larger project that will be documented later) ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/1777/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull