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 1579956621,I_kwDOAMm_X85eLDmN,7519,Selecting variables from Dataset with view on dict keys is of type DataArray,25172489,closed,0,,,7,2023-02-10T16:02:19Z,2024-04-28T21:01:28Z,2024-04-28T21:01:27Z,NONE,,,,"### What happened? When selecting variables from a Dataset using a view on dict keys, the type returned is a DataArray, whereas the same using a list is a Dataset. ### What did you expect to happen? The type returned should be a Dataset. ### Minimal Complete Verifiable Example ```Python import xarray as xr d = {""a"": (""dim"", range(1, 4)), ""b"": (""dim"", range(2, 5))} data = xr.Dataset(d) select_dict = data[d.keys()] select_list = data[list(d)] reveal_type(select_dict) reveal_type(select_list) ``` ### MVCE confirmation - [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray. - [X] Complete example — the example is self-contained, including all data and the text of any traceback. - [x] Verifiable example — the example copy & pastes into an IPython prompt or [Binder notebook](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/blank_template.ipynb), returning the result. - [X] New issue — a search of GitHub Issues suggests this is not a duplicate. ### Relevant log output ```Python $ mypy test.py test.py:9: note: Revealed type is ""xarray.core.dataarray.DataArray"" test.py:10: note: Revealed type is ""xarray.core.dataset.Dataset"" Success: no issues found in 1 source file ``` ### Anything else we need to know? _No response_ ### Environment
INSTALLED VERSIONS ------------------ commit: None python: 3.9.10 (main, Mar 15 2022, 15:56:56) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 3.10.0-1160.49.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.2 libnetcdf: 4.9.0 xarray: 2022.12.0 pandas: 1.5.2 numpy: 1.23.5 scipy: 1.10.0 netCDF4: 1.6.2 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.6.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.6.3 cartopy: None seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 58.1.0 pip: 23.0 conda: None pytest: 7.2.1 mypy: 0.991 IPython: 8.8.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7519/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 1461346911,I_kwDOAMm_X85XGmJf,7313,Using scatter with unfilled marker raises matplotlib UserWarning,25172489,closed,0,,,1,2022-11-23T09:17:17Z,2023-02-09T12:56:05Z,2023-02-09T12:56:05Z,NONE,,,,"### What is your issue? If plotting a scatter plot with an unfilled marker, matplotlib raises a UserWarning. Consider this MWE: ```python import warnings import numpy as np import xarray as xr warnings.filterwarnings(""error"") ds = xr.Dataset({""a"": (""dim"", np.arange(3, 10))}, {""dim"": np.arange(7)}) ds.plot.scatter(x=""dim"", y=""a"", marker=""x"") ``` Running this with matplotlib 3.6.2 yields: ``` Traceback (most recent call last): File ""/my/path/test.py"", line 9, in ds.plot.scatter(x=""dim"", y=""a"", marker=""x"") File ""/my/path/.venv/lib/python3.9/site-packages/xarray/plot/accessor.py"", line 1071, in scatter return dataset_plot.scatter(self._ds, *args, **kwargs) File ""/my/path/.venv/lib/python3.9/site-packages/xarray/plot/dataset_plot.py"", line 916, in scatter return da.plot.scatter(*locals_.pop(""args"", ()), **locals_) File ""/my/path/.venv/lib/python3.9/site-packages/xarray/plot/accessor.py"", line 305, in scatter return dataarray_plot.scatter(self._da, *args, **kwargs) File ""/my/path/.venv/lib/python3.9/site-packages/xarray/plot/dataarray_plot.py"", line 1002, in newplotfunc primitive = plotfunc( File ""/my/path/.venv/lib/python3.9/site-packages/xarray/plot/dataarray_plot.py"", line 1277, in scatter primitive = ax.scatter(*[p.to_numpy().ravel() for p in plts], **kwargs) File ""/my/path/.venv/lib/python3.9/site-packages/matplotlib/__init__.py"", line 1423, in inner return func(ax, *map(sanitize_sequence, args), **kwargs) File ""/my/path/.venv/lib/python3.9/site-packages/matplotlib/axes/_axes.py"", line 4571, in scatter _api.warn_external( File ""/my/path/.venv/lib/python3.9/site-packages/matplotlib/_api/__init__.py"", line 363, in warn_external warnings.warn(message, category, stacklevel) UserWarning: You passed a edgecolor/edgecolors ('w') for an unfilled marker ('x'). Matplotlib is ignoring the edgecolor in favor of the facecolor. This behavior may change in the future. ``` Environment: ``` INSTALLED VERSIONS ------------------ commit: None python: 3.9.10 (main, Mar 15 2022, 15:56:56) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 3.10.0-1160.49.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.2 libnetcdf: 4.9.0 xarray: 2022.11.0 pandas: 1.5.1 numpy: 1.23.5 scipy: 1.9.3 netCDF4: 1.6.2 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.6.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.6.2 cartopy: None seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 65.6.0 pip: 22.3.1 conda: None pytest: 7.2.0 IPython: 8.6.0 sphinx: None ```","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7313/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 1461231016,I_kwDOAMm_X85XGJ2o,7312,polyval doesn't bind the output type,25172489,closed,0,,,3,2022-11-23T07:55:45Z,2022-11-26T15:42:52Z,2022-11-26T15:42:52Z,NONE,,,,"### What happened? We recently updated our package requirements to current xarray, and while some typing things got better for us, `xarray.polyval` seems to not allow mypy to correctly infer its output type. ### What did you expect to happen? Output type should depend on the input types. ### Minimal Complete Verifiable Example ```Python from __future__ import annotations import numpy as np import xarray as xr coeffs = xr.DataArray([1, 1]) xvals = xr.DataArray(np.arange(10)) result = xr.polyval(xvals, coeffs=coeffs) reveal_type(result) ``` ### MVCE confirmation - [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray. - [X] Complete example — the example is self-contained, including all data and the text of any traceback. - [ ] Verifiable example — the example copy & pastes into an IPython prompt or [Binder notebook](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/blank_template.ipynb), returning the result. - [X] New issue — a search of GitHub Issues suggests this is not a duplicate. ### Relevant log output ```Python test.py:11: note: Revealed type is ""Union[xarray.core.dataset.Dataset, xarray.core.dataarray.DataArray]"" ``` ### Anything else we need to know? _No response_ ### Environment
INSTALLED VERSIONS ------------------ commit: None python: 3.9.10 (main, Mar 15 2022, 15:56:56) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 3.10.0-1160.49.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.2 libnetcdf: 4.9.0 xarray: 2022.11.0 pandas: 1.5.1 numpy: 1.23.5 scipy: 1.9.3 netCDF4: 1.6.2 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.6.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.6.2 cartopy: None seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 65.6.0 pip: 22.3.1 conda: None pytest: 7.2.0 IPython: 8.6.0 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7312/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue 1405752975,I_kwDOAMm_X85TyhaP,7156,Plotting empty DataArray oddly raises ImportError,25172489,closed,0,43316012,,7,2022-10-12T08:00:13Z,2022-10-28T16:44:32Z,2022-10-28T16:44:32Z,NONE,,,,"### What happened? When calling the `xarray.DataArray.plot()` method on empty DataArrays raises an `ImportError` about a required, but missing, `nc-time-axis` package. This is at least confusing. ### What did you expect to happen? Either a more appropriate exception (to the effect of ""don't try to plot nothing plz""). Or just get an empty plot returned. ### Minimal Complete Verifiable Example ```Python >>> import xarray as xr >>> xr.DataArray([]) array([], dtype=float64) Dimensions without coordinates: dim_0 >>> xr.DataArray([]).plot() Traceback (most recent call last): File """", line 1, in File ""foo/env/lib/python3.9/site-packages/xarray/plot/plot.py"", line 866, in __call__ return plot(self._da, **kwargs) File ""foo/env/lib/python3.9/site-packages/xarray/plot/plot.py"", line 332, in plot return plotfunc(darray, **kwargs) File ""foo/env/lib/python3.9/site-packages/xarray/plot/plot.py"", line 438, in line _ensure_plottable(xplt_val, yplt_val) File ""foo/env/lib/python3.9/site-packages/xarray/plot/utils.py"", line 648, in _ensure_plottable raise ImportError( ImportError: Plotting of arrays of cftime.datetime objects or arrays indexed by cftime.datetime objects requires the optional `nc-time-axis` (v1.2.0 or later) package. ``` ### MVCE confirmation - [X] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray. - [X] Complete example — the example is self-contained, including all data and the text of any traceback. - [ ] Verifiable example — the example copy & pastes into an IPython prompt or [Binder notebook](https://mybinder.org/v2/gh/pydata/xarray/main?urlpath=lab/tree/doc/examples/blank_template.ipynb), returning the result. - [X] New issue — a search of GitHub Issues suggests this is not a duplicate. ### Relevant log output _No response_ ### Anything else we need to know? _No response_ ### Environment
INSTALLED VERSIONS ------------------ commit: None python: 3.9.10 (main, Mar 15 2022, 15:56:56) [GCC 7.5.0] python-bits: 64 OS: Linux OS-release: 3.10.0-1160.49.1.el7.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_US.UTF-8 LOCALE: ('en_US', 'UTF-8') libhdf5: 1.12.0 libnetcdf: 4.7.4 xarray: 0.21.1 pandas: 1.4.0 numpy: 1.21.5 scipy: 1.8.1 netCDF4: 1.5.8 pydap: None h5netcdf: None h5py: None Nio: None zarr: None cftime: 1.5.2 nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: None dask: None distributed: None matplotlib: 3.5.1 cartopy: None seaborn: None numbagg: None fsspec: None cupy: None pint: None sparse: None setuptools: 49.2.1 pip: 22.2.2 conda: None pytest: 7.1.2 IPython: 8.0.1 sphinx: None
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7156/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue