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 2034500760,PR_kwDOAMm_X85hnplA,8536,Speed up localize,14371165,open,0,,,2,2023-12-10T19:24:40Z,2024-05-04T20:20:01Z,,MEMBER,,1,pydata/xarray/pulls/8536," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8536/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 2240600694,PR_kwDOAMm_X85shCWz,8933,Use array_api compliant dtype,14371165,open,0,,,0,2024-04-12T17:30:51Z,2024-04-30T03:57:57Z,,MEMBER,,1,pydata/xarray/pulls/8933," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` Notes: * For duckarrays, use _dtype[_generic] * For actual np.ndarrays, use np.dtype[np.generic] * np.dtype is too specific in general and it's probably not needed in most of their array_api functions. * _DTypeBase-class in np? * Mixing dtypes from np and xp is discouraged: https://github.com/data-apis/array-api/issues/582 * Using asarray seems to be the recommended way. ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8933/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1680031454,I_kwDOAMm_X85kIz7e,7780,mypy does not understand output of binary operations,14371165,open,0,,,8,2023-04-23T13:38:55Z,2024-04-28T20:07:04Z,,MEMBER,,,,"### What happened? When doing operations on numpy arrays and xarray variables mypy does not understand that the output is always a xarray variable regardless of the order. See example. ### What did you expect to happen? mypy to pass for the example code. ### Minimal Complete Verifiable Example ```Python import numpy as np import xarray as xr x = np.array([1, 2, 4]) v = xr.Variable([""x""], x) # numpy first: xv = x * v xv.values # error: ""ndarray[Any, dtype[bool_]]"" has no attribute ""values"" [attr-defined] if isinstance(xv, xr.Variable): xv.values # variable first: vx = v * x vx.values if isinstance(vx, xr.Variable): vx.values ``` ### 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 _No response_ ### Anything else we need to know? Seen in #7741 ### Environment
xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.9.16 (main, Mar 8 2023, 10:39:24) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: en libhdf5: 1.10.6 libnetcdf: None xarray: 2023.4.2 pandas: 2.0.0 numpy: 1.23.5 scipy: 1.10.1 netCDF4: None pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None iris: None bottleneck: None dask: 2023.4.0 distributed: 2023.4.0 matplotlib: 3.5.3 cartopy: None seaborn: 0.12.2 numbagg: None fsspec: 2023.4.0 cupy: None pint: None sparse: None flox: None numpy_groupies: None setuptools: 67.7.1 pip: 23.1.1 conda: 23.3.1 pytest: 7.3.1 mypy: 1.2.0 IPython: 8.12.0 sphinx: 6.1.3
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7780/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 2241095068,PR_kwDOAMm_X85sixE5,8935,Use Variable.stack instead of np.ravel,14371165,open,0,,,1,2024-04-12T23:04:35Z,2024-04-13T08:27:13Z,,MEMBER,,1,pydata/xarray/pulls/8935," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8935/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1410608825,PR_kwDOAMm_X85A4RjC,7173,Add LineCollection plot,14371165,open,0,,,1,2022-10-16T20:16:28Z,2024-04-07T20:26:44Z,,MEMBER,,1,pydata/xarray/pulls/7173,"This adds a line plotter based on `LineCollections`, called `.lines` at the moment. I wanted to replace `darray.plot()` with using LineCollection instead. But unfortunately due to how many cases are supported (and tested in xarray) `darray.plot()` will continue using `plt.plot`. xref: #4820 #5622","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7173/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 2215603817,I_kwDOAMm_X86ED25p,8892,ffill's tolerance argument can be strings,14371165,open,0,,,1,2024-03-29T15:49:40Z,2024-04-02T01:50:34Z,,MEMBER,,,,"### What happened? `ffill`, `bfill` `reindex` etc. have tolerance arguments that also supports strings. And we test for it here: https://github.com/pydata/xarray/blob/2120808bbe45f3d4f0b6a01cd43bac4df4039092/xarray/tests/test_groupby.py#L2016-L2025 But our typing assumes it's floats only: https://github.com/pydata/xarray/blob/2120808bbe45f3d4f0b6a01cd43bac4df4039092/xarray/core/resample.py#L69-L94 ### What did you expect to happen? Since our pytests pass, mypy should pass as well. ### Minimal Complete Verifiable Example ```python import numpy as np import pandas as pd import xarray as xr # https://github.com/pydata/xarray/blob/2120808bbe45f3d4f0b6a01cd43bac4df4039092/xarray/tests/test_groupby.py#L2016 # Test tolerance keyword for upsample methods bfill, pad, nearest times = pd.date_range(""2000-01-01"", freq=""1D"", periods=2) times_upsampled = pd.date_range(""2000-01-01"", freq=""6h"", periods=5) array = xr.DataArray(np.arange(2), [(""time"", times)]) # Forward fill actual = array.resample(time=""6h"").ffill(tolerance=""12h"") expected = xr.DataArray([0.0, 0.0, 0.0, np.nan, 1.0], [(""time"", times_upsampled)]) xr.testing.assert_identical(expected, actual) ``` ### Environment master ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8892/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 2184947713,PR_kwDOAMm_X85pjnvS,8831,Fix datetime in colorbar,14371165,open,0,,,0,2024-03-13T21:48:44Z,2024-03-27T06:39:13Z,,MEMBER,,1,pydata/xarray/pulls/8831," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ```python import xarray as xr airtemps = xr.tutorial.open_dataset(""air_temperature"") airtemps.air[:200].isel(lat=10, lon=10).plot.scatter(x=""time"", hue=""time"") ``` Before: ![image](https://github.com/pydata/xarray/assets/14371165/3c5fa76c-8cc9-4af5-a20a-ae8e4874bdd9) ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8831/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1746734270,PR_kwDOAMm_X85SdWic,7902,Test array api protocol,14371165,open,0,,,2,2023-06-07T21:50:55Z,2024-01-28T10:36:37Z,,MEMBER,,1,pydata/xarray/pulls/7902," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7902/reactions"", ""total_count"": 1, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 1}",,,13221727,pull 1953053810,PR_kwDOAMm_X85dURGi,8344,Add mean to NamedArray._array_api,14371165,open,0,,,8,2023-10-19T21:05:06Z,2023-12-19T17:49:22Z,,MEMBER,,1,pydata/xarray/pulls/8344," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8344/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1903465587,PR_kwDOAMm_X85atB8W,8211,Add T_DuckArray to DataArray,14371165,open,0,,,0,2023-09-19T17:48:11Z,2023-10-03T17:45:40Z,,MEMBER,,1,pydata/xarray/pulls/8211," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8211/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1903622707,PR_kwDOAMm_X85atj9b,8214,Bind T_DuckArray to Variable,14371165,open,0,,,0,2023-09-19T19:42:34Z,2023-10-03T17:40:26Z,,MEMBER,,1,pydata/xarray/pulls/8214," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8214/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1826978659,I_kwDOAMm_X85s5Xtj,8028,Setting datarrays with non-dimension coordinates errors,14371165,open,0,,,6,2023-07-28T19:20:31Z,2023-08-10T15:25:23Z,,MEMBER,,,,"### What happened? I'm not sure if this is a bug or a feature but I was expecting this example to work since the new coord is just a slight rewrite of the original dimension coordinate: ```python import xarray as xr ds = xr.tutorial.open_dataset(""air_temperature"") # Change the first time value: ds[""air_new""] = ds.air.copy() air_new_changed = ds.air_new[{""time"": 0}] * 3 ds.air_new.loc[air_new_changed.coords] = air_new_changed # Works! :) # Add a another coord along time axis and change # the first time value: ds[""air_new""] = ds.air.copy().assign_coords( {""time_float"": ds.time.astype(float)} ) air_new_changed = ds.air_new[{""time"": 0}] * 4 ds.air_new.loc[air_new_changed.coords] = air_new_changed # Error! :( Traceback (most recent call last): Cell In[25], line 5 ds.air_new.loc[air_new_changed.coords] = air_new_changed File ~\AppData\Local\mambaforge\envs\jw\lib\site-packages\xarray\core\dataarray.py:222 in __setitem__ dim_indexers = map_index_queries(self.data_array, key).dim_indexers File ~\AppData\Local\mambaforge\envs\jw\lib\site-packages\xarray\core\indexing.py:182 in map_index_queries grouped_indexers = group_indexers_by_index(obj, indexers, options) File ~\AppData\Local\mambaforge\envs\jw\lib\site-packages\xarray\core\indexing.py:144 in group_indexers_by_index raise KeyError(f""no index found for coordinate {key!r}"") KeyError: ""no index found for coordinate 'time_float'"" ``` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/8028/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 1549889322,PR_kwDOAMm_X85IKePm,7460,Add abstractmethods to backend classes,14371165,open,0,,,1,2023-01-19T20:19:36Z,2023-07-29T11:42:33Z,,MEMBER,,1,pydata/xarray/pulls/7460,"It's been unclear to me what methods are necessary to implement or not. I think decorating with `@abstractmethod` will help with that. It's a breaking change though and it could be disruptive. - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7460/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1797533374,PR_kwDOAMm_X85VIIy4,7975,Test using asv compare,14371165,open,0,,,0,2023-07-10T20:27:31Z,2023-07-13T21:47:05Z,,MEMBER,,1,pydata/xarray/pulls/7975," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` References: https://github.com/cvxpy/cvxpy/pull/1810 ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7975/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1410618081,PR_kwDOAMm_X85A4TS_,7174,Move .line to plot1d,14371165,open,0,,,0,2022-10-16T20:51:23Z,2023-06-19T20:37:30Z,,MEMBER,,1,pydata/xarray/pulls/7174," - [ ] Closes #xxxx - [ ] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7174/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 970245117,MDExOlB1bGxSZXF1ZXN0NzEyMjIzNzc2,5704,Allow in-memory arrays with open_mfdataset,14371165,open,0,,,8,2021-08-13T09:50:26Z,2023-04-29T06:58:26Z,,MEMBER,,0,pydata/xarray/pulls/5704,"The docstring seems to imply that it's possible to get in-memory arrays: https://github.com/pydata/xarray/blob/4bb9d9c6df77137f05e85c7cc6508fe7a93dc0e4/xarray/backends/api.py#L732 But it doesn't seem possible because of: https://github.com/pydata/xarray/blob/4bb9d9c6df77137f05e85c7cc6508fe7a93dc0e4/xarray/backends/api.py#L899 This PR removes that `or` check, changes the default to `chunk={}`, and fixes the failing tests. - [x] Noticed in #5689 - [ ] Closes #7792 - [x] Tests added - [x] Passes `pre-commit run --all-files` - [x] User visible changes (including notable bug fixes) are documented in `whats-new.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5704/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1522810384,PR_kwDOAMm_X85G1P52,7424,array api - Add tests for aggregations,14371165,open,0,,,3,2023-01-06T16:10:05Z,2023-04-20T13:37:13Z,,MEMBER,,1,pydata/xarray/pulls/7424," - [ ] Closes #7243 - [x] Tests added - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7424/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1537068105,I_kwDOAMm_X85bncxJ,7450,Backend array documentation typo,14371165,open,0,,,0,2023-01-17T21:37:26Z,2023-01-17T21:56:12Z,,MEMBER,,,,"### What happened? https://docs.xarray.dev/en/stable/internals/how-to-add-new-backend.html#indexing-examples I believe there's a typo in the BASIC indexing support example: ```python # shall support integers backend_array._raw_indexing_method(1, 1) ``` Should be: ```python # shall support integers backend_array._raw_indexing_method((1, 1)) ``` Suggestion of possible fixes: * Make sure it is a typo. * Create a valid custom MyBackendArray and initialize it. So it is easier to tell if it's a typo. * Add type hinting so mypy can easier catch these errors. ### What did you expect to happen? _No response_ ### Minimal Complete Verifiable Example _No response_ ### MVCE confirmation - [ ] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray. - [ ] 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. - [ ] 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
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7450/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 1410534774,I_kwDOAMm_X85UEw12,7170,Scatter plots overlap in facetgrid in 3d,14371165,open,0,,,0,2022-10-16T16:06:56Z,2022-10-16T16:08:55Z,,MEMBER,,,,"### What happened? Any matplotlib gurus have any ideas how to nicely fit 3d plots in facetgrid? ```python ds = xr.tutorial.scatter_example_dataset(seed=42) fg = ds.plot.scatter(x=""A"", y=""B"", z=""z"", hue=""y"", markersize=""x"", row=""x"", col=""w"") ``` ![image](https://user-images.githubusercontent.com/14371165/196045673-ad6322d4-63f4-4f94-aca6-a4cfdc682fea.png) 2d looks fine: ```python fg = ds.plot.scatter(x=""A"", y=""B"", hue=""y"", markersize=""x"", row=""x"", col=""w"") ``` ![image](https://user-images.githubusercontent.com/14371165/196045774-5d850317-c58a-4fac-ae4b-04660a140fd1.png) ### What did you expect to happen? No plots overlapping each other, even if rotating the plots. ### Minimal Complete Verifiable Example _No response_ ### 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 _No response_ ### Anything else we need to know? _No response_ ### Environment
xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.10.6 | packaged by conda-forge | (main, Aug 22 2022, 20:30:19) [MSC v.1929 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: en LOCALE: ('Swedish_Sweden', '1252') libhdf5: 1.12.2 libnetcdf: 4.8.1 xarray: 2022.9.1.dev266+gbd01f9cc.d20221006 pandas: 1.5.0 numpy: 1.23.3 scipy: 1.9.1 netCDF4: 1.6.1 pydap: installed h5netcdf: 1.0.2 h5py: 3.7.0 Nio: None zarr: 2.13.2 cftime: 1.6.2 nc_time_axis: 1.4.1 PseudoNetCDF: 3.2.2 rasterio: 1.3.2 cfgrib: None iris: 3.3.0 bottleneck: 1.3.5 dask: 2022.9.2 distributed: 2022.9.2 matplotlib: 3.6.0 cartopy: 0.21.0 seaborn: 0.12.0 numbagg: 0.2.1 fsspec: 2022.8.2 cupy: None pint: 0.19.2 sparse: 0.13.0 flox: 0.5.10.dev21+g91b6e19 numpy_groupies: 0.9.19 setuptools: 65.4.1 pip: 22.2.2 conda: None pytest: 7.1.3 IPython: 7.33.0 sphinx: 5.2.3 C:\Users\J.W\anaconda3\envs\xarray-tests\lib\site-packages\_distutils_hack\__init__.py:33: UserWarning: Setuptools is replacing distutils. warnings.warn(""Setuptools is replacing distutils."")
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7170/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 948049609,MDExOlB1bGxSZXF1ZXN0NjkyOTQzMTYy,5622,Replace dataset scatter with the dataarray version,14371165,open,0,,,12,2021-07-19T21:39:23Z,2022-10-15T20:11:34Z,,MEMBER,,1,pydata/xarray/pulls/5622," - [ ] Requires #4820 - [ ] Tests added - [ ] Passes `pre-commit run --all-files` - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5622/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 931016490,MDExOlB1bGxSZXF1ZXN0Njc4NTc5MjIx,5542,Do not transpose 1d arrays during interpolation,14371165,open,0,,,8,2021-06-27T20:56:13Z,2022-10-12T20:12:11Z,,MEMBER,,0,pydata/xarray/pulls/5542,"Seems a waste of time to transpose 1d arrays. - [ ] Closes #xxxx - [ ] Tests added - [ ] Passes `pre-commit run --all-files` - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5542/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 958878760,MDExOlB1bGxSZXF1ZXN0NzAyMDgwMTg2,5667,Allow .attrs to support any dict-likes,14371165,open,0,,,10,2021-08-03T08:43:19Z,2022-10-12T18:08:25Z,,MEMBER,,1,pydata/xarray/pulls/5667," - [x] Closes #5655 - [ ] Tests added - [ ] Passes `pre-commit run --all-files` - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5667/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 1377088142,I_kwDOAMm_X85SFLKO,7050,Type annotation guidelines,14371165,open,0,,,2,2022-09-18T15:04:54Z,2022-09-23T01:55:19Z,,MEMBER,,,,"Dask has a pretty nice guideline for type hinting, see https://github.com/dask/community/issues/255. Notable for us is to avoid adding typing in docstrings to avoid duplicating information.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/7050/reactions"", ""total_count"": 4, ""+1"": 4, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 930918574,MDExOlB1bGxSZXF1ZXN0Njc4NTA3NDMw,5540,Cache some properties,14371165,open,0,,,4,2021-06-27T12:22:16Z,2022-07-10T14:34:34Z,,MEMBER,,1,pydata/xarray/pulls/5540,"Cache some small properties that are rather slow to calculate but doesn't change that often. Questions that needs to be resolved: - [ ] Can these properties change during the lifetime of the class? If so the cache needs to be reset when that happens. - [ ] Related to #3514 - [ ] Tests added - [ ] Passes `pre-commit run --all-files` - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` Notes * Mixin classes makes it difficult to cache properties. For example `ndim` in `NdimSizeLenMixin` cannot be easily be replaced with `cache_readonly`.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5540/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 787732195,MDExOlB1bGxSZXF1ZXN0NTU2MzY2NTcx,4820,Add dataset line plot,14371165,open,0,,,10,2021-01-17T15:40:39Z,2022-06-09T14:50:17Z,,MEMBER,,1,pydata/xarray/pulls/4820," - [x] Closes #4235 - [x] Tests added - [x] Passes `pre-commit run --all-files` - [ ] User visible changes (including notable bug fixes) are documented in `whats-new.rst` - [ ] New functions/methods are listed in `api.rst` TODO: * markersize/linewidth should work, easy if linewidth is only defined. But the hue/linewidth combo is trickier. * Possible, see post further down for details. Should be done in dataarray version in a future PR. * hue only works with coordinates. Should it work with variables? How to do that? groupby? * Leave it for coordinates only for now. * Should lines always be sorted to avoid weird lines? * Handled in dataarray version * linewidth not shown anywhere * line plots doesn't have the nice `legend_elements` function that scatter has which makes it a little bit more tricky. It can still be shown in the legend though. Adds `ds.plot.line`. The function wraps `ax.plot` which should feel pretty homely for most matplotlib users. It was a mess getting the colorbar to work because scatter returns a mappable that colorbar can handle but plot returns a list of line2ds that it can't handle. You also can't add cmaps directly to ax.plot, so to avoid for loops I changed the default color settings instead. Feel free to break it. Example: ![bild](https://user-images.githubusercontent.com/14371165/104847719-244fe100-58e2-11eb-815c-46940b7fc40e.png) ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4820/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull 597785475,MDU6SXNzdWU1OTc3ODU0NzU=,3962,"Interpolation - Support extrapolation method ""clip""",14371165,open,0,,,4,2020-04-10T09:07:13Z,2022-05-02T13:42:24Z,,MEMBER,,,,"Hello, I would like an option in `da.interp() `that instead of returning NaNs during extrapolation returns the data corresponding to the end of the breakpoint data set range. One way to do this is to limit the new coordinates to the array coordinates minimum and maximum value, I did a simple example with this solution down below. I think this is a rather safe way as we are just modifying the inputs to all the various interpolation classes that xarray is using at the moment. But it does look a little weird when printing the extrapolated value, the coordinates shows the limited value instead of the requested coordinates. Maybe this can be handled elegantly somewhere in the source code? MATLAB uses this quite frequently in their interpolation functions: * https://mathworks.com/help/simulink/ug/methods-for-estimating-missing-points.html * https://mathworks.com/help/simulink/slref/2dlookuptable.html #### MCVE Code Sample ```python import numpy as np import xarray as xr def interp(da, coords, extrapolation='clip'): """""" Linear interpolation that clips the inputs to the coords min and max value. Parameters ---------- da : DataArray DataArray to interpolate. coords : dict Coordinates for the interpolated value. """""" if extrapolation == 'clip': for k, v in da.coords.items(): coords[k] = np.maximum(coords[k], np.min(v.values)) coords[k] = np.minimum(coords[k], np.max(v.values)) return da.interp(coords) # Create coordinates: x = np.linspace(1000, 6000, 4) y = np.linspace(100, 1200, 3) # Create data: X = np.meshgrid(*[x, y], indexing='ij') data = X[0] * X[1] # Create DataArray: da = xr.DataArray(data=data, coords=[('x', x), ('y', y)], name='data') # Attempt to extrapolate: datai = interp(da, {'x': 7000, 'y': 375}) ``` #### Expected Output ````python print(datai) array(2250000.) Coordinates: x float64 6e+03 y float64 375.0 ```` #### Versions
Output of `xr.show_versions()` INSTALLED VERSIONS ------------------ commit: None python: 3.7.7 (default, Mar 23 2020, 23:19:08) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 58 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: en LOCALE: None.None libhdf5: 1.10.4 libnetcdf: None xarray: 0.15.0 pandas: 1.0.3 numpy: 1.18.1 scipy: 1.4.1 netCDF4: None pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: 2.13.0 distributed: 2.13.0 matplotlib: 3.1.3 cartopy: None seaborn: 0.10.0 numbagg: None setuptools: 46.1.3.post20200330 pip: 20.0.2 conda: 4.8.3 pytest: 5.4.1 IPython: 7.13.0 sphinx: 2.4.4
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3962/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 957201551,MDU6SXNzdWU5NTcyMDE1NTE=,5655,Allow .attrs to use dict-likes,14371165,open,0,,,2,2021-07-31T08:31:55Z,2022-01-09T03:32:04Z,,MEMBER,,,," **Is your feature request related to a problem? Please describe.** Reading attributes from h5py-files is rather slow. So instead of retrieving it immediately I wanted to create a lazy dict-class that only retrieves the attribute values when necessary. But this is difficult to achieve since xarray keeps forcing the attrs to dicts in a lot of places. **Describe the solution you'd like** * Replace in https://github.com/pydata/xarray/blob/dddac11b01330791ffab4dfc72d226e71821973e/xarray/core/variable.py#L865 and https://github.com/pydata/xarray/blob/dddac11b01330791ffab4dfc72d226e71821973e/xarray/core/dataset.py#L798 with a `asdict(value)` function that checks if the input is a valid dict-like, if not convert to dict. Things that might be good to check: * `MutableMapping` * `hasattr(dict_like, ""copy"")` * `isinstance(dict_like, dict) == True` * Remove unneccessary conversions to dict. For example https://github.com/pydata/xarray/blob/dddac11b01330791ffab4dfc72d226e71821973e/xarray/core/merge.py#L523 should not be necessary as attrs from variables/dataarrays/datasets have already been forced to dicts when they were initialized. **Describe alternatives you've considered** * One could lazify with dicts as well, for example by replacing the value with a function. This however won't look good in reprs, that's why having a convienence class is nice. * `dict(LazyDict)` always forces to dict, it does not let it pass through unchanged even if `isinstance(LazyDict, dict) == True`. Interesting reading: https://stackoverflow.com/questions/16669367/setup-dictionary-lazily https://stackoverflow.com/questions/3387691/how-to-perfectly-override-a-dict ","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5655/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue 779938616,MDU6SXNzdWU3Nzk5Mzg2MTY=,4770,Interpolation always returns floats,14371165,open,0,,,1,2021-01-06T03:16:43Z,2021-01-12T16:30:54Z,,MEMBER,,,," **What happened**: When interpolating datasets integer arrays are forced to floats. **What you expected to happen**: To retain the same dtype after interpolation. **Minimal Complete Verifiable Example**: ```python import numpy as np import dask.array as da a = np.arange(0, 2) b = np.core.defchararray.add(""long_variable_name"", a.astype(str)) coords = dict(time=da.array([0, 1])) data_vars = dict() for v in b: data_vars[v] = xr.DataArray( name=v, data=da.array([0, 1], dtype=int), dims=[""time""], coords=coords, ) ds1 = xr.Dataset(data_vars) print(ds1) Out[35]: Dimensions: (time: 4) Coordinates: * time (time) float64 0.0 0.5 1.0 2.0 Data variables: long_variable_name0 (time) int32 dask.array long_variable_name1 (time) int32 dask.array # Interpolate: ds1 = ds1.interp( time=da.array([0, 0.5, 1, 2]), assume_sorted=True, method=""linear"", kwargs=dict(fill_value=""extrapolate""), ) # dask array thinks it's an integer array: print(ds1.long_variable_name0) Out[55]: dask.array Coordinates: * time (time) float64 0.0 0.5 1.0 2.0 # But once computed it turns out is a float: print(ds1.long_variable_name0.compute()) Out[38]: array([0. , 0.5, 1. , 2. ]) Coordinates: * time (time) float64 0.0 0.5 1.0 2.0 ``` **Anything else we need to know?**: An easy first step is to also force `np.float_` in `da.blockwise` in `missing.interp_func`. The more difficult way is to somehow be able to change back the dataarrays into the old dtype without affecting performance. I did a test simply adding `.astype() `to the returned value in `missing.interp` and it doubled the calculation time. I was thinking the conversion to floats in scipy could be avoided altogether by adding a (non-)public option to ignore any dtype checks and just let the user handle the ""unsafe"" interpolations. Related: https://github.com/scipy/scipy/issues/11093 **Environment**:
Output of xr.show_versions() xr.show_versions() INSTALLED VERSIONS ------------------ commit: None python: 3.8.5 (default, Sep 3 2020, 21:29:08) [MSC v.1916 64 bit (AMD64)] python-bits: 64 OS: Windows libhdf5: 1.10.4 libnetcdf: None xarray: 0.16.2 pandas: 1.1.5 numpy: 1.17.5 scipy: 1.4.1 netCDF4: None pydap: None h5netcdf: None h5py: 2.10.0 Nio: None zarr: None cftime: None nc_time_axis: None PseudoNetCDF: None rasterio: None cfgrib: None iris: None bottleneck: 1.3.2 dask: 2020.12.0 distributed: 2020.12.0 matplotlib: 3.3.2 cartopy: None seaborn: 0.11.1 numbagg: None pint: None setuptools: 51.0.0.post20201207 pip: 20.3.3 conda: 4.9.2 pytest: 6.2.1 IPython: 7.19.0 sphinx: 3.4.0
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4770/reactions"", ""total_count"": 1, ""+1"": 1, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue