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
1323734180,I_kwDOAMm_X85O5pSk,6854,test_open_nczarr uses too much memory,302469,closed,0,,,8,2022-08-01T03:02:27Z,2023-05-08T09:42:09Z,2023-05-08T09:42:08Z,CONTRIBUTOR,,,,"### What happened?
I'm updating builds for Fedora to 2022.06.0, and running tests, the process runs out of memory and is OOM-killed. Running all the steps manually, this gets to the `to_netcdf` call in `createTestNCZarr._create_nczarr`. At that point, memory usage rises to 8.9G resident / 17.7G virtual, and the process is killed (actually, the entire SSH session is killed).
### What did you expect to happen?
Tests pass without issue.
### Minimal Complete Verifiable Example
```Python
import xarray as xr
from xarray.tests.test_dataset import create_test_data
ds = create_test_data()
ds = ds.drop_vars(""dim3"")
ds.to_netcdf(f""file://foo.zarr#mode=nczarr,noxarray"")
```
### 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
Jul 31 22:56:07 hostnmme systemd-oomd[805]: Killed /user.slice/user-1000.slice/session-131.scope due to memory used (15294935040) / total (15569043456) and swap used (15308353536) / total (16978534400) being more than 90.00%
Jul 31 22:56:07 hostname systemd[1]: session-131.scope: systemd-oomd killed 6 process(es) in this unit.
```
### Anything else we need to know?
_No response_
### Environment
INSTALLED VERSIONS
------------------
commit: None
python: 3.11.0b5 (main, Jul 26 2022, 00:00:00) [GCC 12.1.1 20220628 (Red Hat 12.1.1-3)]
python-bits: 64
OS: Linux
OS-release: 5.17.13-300.fc36.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.1
libnetcdf: 4.9.0
xarray: 2022.6.0
pandas: 1.3.5
numpy: 1.22.0
scipy: 1.8.1
netCDF4: 1.6.0
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.11.3
cftime: 1.6.0
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.2.10
cfgrib: None
iris: None
bottleneck: None
dask: 2022.7.1
distributed: None
matplotlib: 3.5.2
cartopy: None
seaborn: 0.11.2
numbagg: None
fsspec: 2022.5.0
cupy: None
pint: 0.16.1
sparse: None
flox: None
numpy_groupies: None
setuptools: 62.6.0
pip: 22.2
conda: None
pytest: 7.1.2
IPython: None
sphinx: 5.0.2
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/6854/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
936536548,MDExOlB1bGxSZXF1ZXN0NjgzMjM0MjQ1,5574,Fix type inference for dask push.,302469,closed,0,,,2,2021-07-04T20:43:23Z,2021-07-05T20:05:02Z,2021-07-05T17:24:27Z,CONTRIBUTOR,,0,pydata/xarray/pulls/5574,"- [x] Closes #5342
- [ ] Tests added
- [x] Passes `pre-commit run --all-files`
- [n/a] User visible changes (including notable bug fixes) are documented in `whats-new.rst`
- [n/a] New functions/methods are listed in `api.rst`","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5574/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull
895202415,MDU6SXNzdWU4OTUyMDI0MTU=,5342,test_push_dask fails type inference,302469,closed,0,,,7,2021-05-19T09:20:24Z,2021-07-05T17:24:27Z,2021-07-05T17:24:27Z,CONTRIBUTOR,,,,"**What happened**:
When building the Fedora package of xarray 0.18.0/0.18.1, `test_push_dask` failed. This did not happen in previous versions (or the test did not exist then.)
**Minimal Complete Verifiable Example**:
```pytb
________________________________ test_push_dask ________________________________
[gw2] linux -- Python 3.9.5 /usr/bin/python3
@requires_dask
@requires_bottleneck
def test_push_dask():
import bottleneck
import dask.array
array = np.array([np.nan, np.nan, np.nan, 1, 2, 3, np.nan, np.nan, 4, 5, np.nan, 6])
expected = bottleneck.push(array, axis=0)
for c in range(1, 11):
with raise_if_dask_computes():
> actual = push(dask.array.from_array(array, chunks=c), axis=0, n=None)
/builddir/build/BUILDROOT/python-xarray-0.18.1-1.fc35.x86_64/usr/lib/python3.9/site-packages/xarray/tests/test_duck_array_ops.py:886:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
/builddir/build/BUILDROOT/python-xarray-0.18.1-1.fc35.x86_64/usr/lib/python3.9/site-packages/xarray/core/duck_array_ops.py:663: in push
return dask_array_ops.push(array, n, axis)
/builddir/build/BUILDROOT/python-xarray-0.18.1-1.fc35.x86_64/usr/lib/python3.9/site-packages/xarray/core/dask_array_ops.py:69: in push
pushed = array.map_blocks(push, axis=axis, n=n)
/usr/lib/python3.9/site-packages/dask/array/core.py:2333: in map_blocks
return map_blocks(func, self, *args, **kwargs)
/usr/lib/python3.9/site-packages/dask/array/core.py:683: in map_blocks
dtype = apply_infer_dtype(func, args, original_kwargs, ""map_blocks"")
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
func = , args = [array([1.])]
kwargs = {'axis': 0, 'n': None}, funcname = 'map_blocks'
suggest_dtype = 'dtype', nout = None
def apply_infer_dtype(func, args, kwargs, funcname, suggest_dtype=""dtype"", nout=None):
""""""
Tries to infer output dtype of ``func`` for a small set of input arguments.
Parameters
----------
func: Callable
Function for which output dtype is to be determined
args: List of array like
Arguments to the function, which would usually be used. Only attributes
``ndim`` and ``dtype`` are used.
kwargs: dict
Additional ``kwargs`` to the ``func``
funcname: String
Name of calling function to improve potential error messages
suggest_dtype: None/False or String
If not ``None`` adds suggestion to potential error message to specify a dtype
via the specified kwarg. Defaults to ``'dtype'``.
nout: None or Int
``None`` if function returns single output, integer if many.
Deafults to ``None``.
Returns
-------
: dtype or List of dtype
One or many dtypes (depending on ``nout``)
""""""
args = [
np.ones((1,) * x.ndim, dtype=x.dtype) if isinstance(x, Array) else x
for x in args
]
try:
with np.errstate(all=""ignore""):
o = func(*args, **kwargs)
except Exception as e:
exc_type, exc_value, exc_traceback = sys.exc_info()
tb = """".join(traceback.format_tb(exc_traceback))
suggest = (
(
""Please specify the dtype explicitly using the ""
""`{dtype}` kwarg.\n\n"".format(dtype=suggest_dtype)
)
if suggest_dtype
else """"
)
msg = (
""`dtype` inference failed in `{0}`.\n\n""
""{1}""
""Original error is below:\n""
""------------------------\n""
""{2}\n\n""
""Traceback:\n""
""---------\n""
""{3}""
).format(funcname, suggest, repr(e), tb)
else:
msg = None
if msg is not None:
> raise ValueError(msg)
E ValueError: `dtype` inference failed in `map_blocks`.
E
E Please specify the dtype explicitly using the `dtype` kwarg.
E
E Original error is below:
E ------------------------
E TypeError('`n` must be an integer')
E
E Traceback:
E ---------
E File ""/usr/lib/python3.9/site-packages/dask/array/core.py"", line 383, in apply_infer_dtype
E o = func(*args, **kwargs)
/usr/lib/python3.9/site-packages/dask/array/core.py:408: ValueError
```
**Anything else we need to know?**:
**Environment**:
Output of xr.show_versions()
```
INSTALLED VERSIONS
------------------
commit: None
python: 3.9.5 (default, May 4 2021, 00:00:00)
[GCC 11.1.1 20210428 (Red Hat 11.1.1-1)]
python-bits: 64
OS: Linux
OS-release: 5.11.19-300.fc34.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: C
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.10.6
libnetcdf: 4.7.3
xarray: 0.18.1
pandas: 1.2.1
numpy: 1.20.1
scipy: 1.6.2
netCDF4: 1.5.6
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.8.1
cftime: 1.4.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.2.1
cfgrib: None
iris: None
bottleneck: 1.2.1
dask: 2021.04.1
distributed: None
matplotlib: 3.4.2
cartopy: None
seaborn: None
numbagg: None
pint: 0.16.1
setuptools: 56.1.0
pip: None
conda: None
pytest: 6.2.4
IPython: None
sphinx: None
```
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/5342/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
644465420,MDU6SXNzdWU2NDQ0NjU0MjA=,4172,test_aggregation fails on aarch64/ppc64le/s390x,302469,closed,0,,,0,2020-06-24T09:31:14Z,2020-06-24T18:24:55Z,2020-06-24T18:24:55Z,CONTRIBUTOR,,,,"**What happened**:
When building happens on any of the above architectures, the `test_aggregation` test fails. This appears to be due to some small precision errors:
```
_______________ TestVariable.test_aggregation[float-method_std] ________________
[gw4] linux -- Python 3.9.0 /usr/bin/python3
self =
func = method_std, dtype =
@pytest.mark.parametrize(
""func"",
(
method(""all""),
method(""any""),
method(""argmax""),
method(""argmin""),
method(""argsort""),
method(""cumprod""),
method(""cumsum""),
method(""max""),
method(""mean""),
method(""median""),
method(""min""),
pytest.param(
method(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
method(""std""),
method(""sum""),
method(""var""),
),
ids=repr,
)
def test_aggregation(self, func, dtype):
array = np.linspace(0, 1, 10).astype(dtype) * (
unit_registry.m if func.name != ""cumprod"" else unit_registry.dimensionless
)
variable = xr.Variable(""x"", array)
units = extract_units(func(array))
expected = attach_units(func(strip_units(variable)), units)
actual = func(variable)
assert_units_equal(expected, actual)
> xr.testing.assert_identical(expected, actual)
E AssertionError: Left and right Variable objects are not identical
E
E Differing values:
E L
E array(0.319142)
E R
E array(0.319142)
../../BUILDROOT/python-xarray-0.15.1-3.fc33.aarch64/usr/lib/python3.9/site-packages/xarray/tests/test_units.py:1451: AssertionError
_______________ TestVariable.test_aggregation[float-method_var] ________________
[gw4] linux -- Python 3.9.0 /usr/bin/python3
self =
func = method_var, dtype =
@pytest.mark.parametrize(
""func"",
(
method(""all""),
method(""any""),
method(""argmax""),
method(""argmin""),
method(""argsort""),
method(""cumprod""),
method(""cumsum""),
method(""max""),
method(""mean""),
method(""median""),
method(""min""),
pytest.param(
method(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
method(""std""),
method(""sum""),
method(""var""),
),
ids=repr,
)
def test_aggregation(self, func, dtype):
array = np.linspace(0, 1, 10).astype(dtype) * (
unit_registry.m if func.name != ""cumprod"" else unit_registry.dimensionless
)
variable = xr.Variable(""x"", array)
units = extract_units(func(array))
expected = attach_units(func(strip_units(variable)), units)
actual = func(variable)
assert_units_equal(expected, actual)
> xr.testing.assert_identical(expected, actual)
E AssertionError: Left and right Variable objects are not identical
E
E Differing values:
E L
E array(0.101852)
E R
E array(0.101852)
../../BUILDROOT/python-xarray-0.15.1-3.fc33.aarch64/usr/lib/python3.9/site-packages/xarray/tests/test_units.py:1451: AssertionError
_______________ TestDataset.test_aggregation[float-function_std] _______________
[gw0] linux -- Python 3.9.0 /usr/bin/python3
self =
func = function_std, dtype =
@pytest.mark.parametrize(
""func"",
(
pytest.param(
function(""all""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
pytest.param(
function(""any""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
function(""argmax""),
function(""argmin""),
function(""max""),
function(""min""),
function(""mean""),
pytest.param(
function(""median""),
marks=pytest.mark.xfail(
reason=""np.median does not work with dataset yet""
),
),
function(""sum""),
pytest.param(
function(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
function(""std""),
function(""var""),
function(""cumsum""),
pytest.param(
function(""cumprod""),
marks=pytest.mark.xfail(reason=""fails within xarray""),
),
pytest.param(
method(""all""), marks=pytest.mark.xfail(reason=""not implemented by pint"")
),
pytest.param(
method(""any""), marks=pytest.mark.xfail(reason=""not implemented by pint"")
),
method(""argmax""),
method(""argmin""),
method(""max""),
method(""min""),
method(""mean""),
method(""median""),
method(""sum""),
pytest.param(
method(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
method(""std""),
method(""var""),
method(""cumsum""),
pytest.param(
method(""cumprod""), marks=pytest.mark.xfail(reason=""fails within xarray"")
),
),
ids=repr,
)
def test_aggregation(self, func, dtype):
unit_a = (
unit_registry.Pa if func.name != ""cumprod"" else unit_registry.dimensionless
)
unit_b = (
unit_registry.kg / unit_registry.m ** 3
if func.name != ""cumprod""
else unit_registry.dimensionless
)
a = xr.DataArray(data=np.linspace(0, 1, 10).astype(dtype) * unit_a, dims=""x"")
b = xr.DataArray(data=np.linspace(-1, 0, 10).astype(dtype) * unit_b, dims=""x"")
x = xr.DataArray(data=np.arange(10).astype(dtype) * unit_registry.m, dims=""x"")
y = xr.DataArray(
data=np.arange(10, 20).astype(dtype) * unit_registry.s, dims=""x""
)
ds = xr.Dataset(data_vars={""a"": a, ""b"": b}, coords={""x"": x, ""y"": y})
actual = func(ds)
expected = attach_units(
func(strip_units(ds)),
{
""a"": extract_units(func(a)).get(None),
""b"": extract_units(func(b)).get(None),
},
)
> assert_equal_with_units(actual, expected)
E AssertionError: Left and right Dataset objects are not equal
E
E
E Differing data variables:
E L a float64
E R a float64
E L b float64
E R b float64
E assert False
E + where False = \nDimensions: ()\nData variables:\n a float64 0.3191\n b float64 0.3191>(\nDimensions: ()\nData variables:\n a float64 0.3191\n b float64 0.3191)
E + where \nDimensions: ()\nData variables:\n a float64 0.3191\n b float64 0.3191> = \nDimensions: ()\nData variables:\n a float64 0.3191\n b float64 0.3191.equals
../../BUILDROOT/python-xarray-0.15.1-3.fc33.aarch64/usr/lib/python3.9/site-packages/xarray/tests/test_units.py:3812: AssertionError
_______________ TestDataset.test_aggregation[float-function_var] _______________
[gw0] linux -- Python 3.9.0 /usr/bin/python3
self =
func = function_var, dtype =
@pytest.mark.parametrize(
""func"",
(
pytest.param(
function(""all""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
pytest.param(
function(""any""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
function(""argmax""),
function(""argmin""),
function(""max""),
function(""min""),
function(""mean""),
pytest.param(
function(""median""),
marks=pytest.mark.xfail(
reason=""np.median does not work with dataset yet""
),
),
function(""sum""),
pytest.param(
function(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
function(""std""),
function(""var""),
function(""cumsum""),
pytest.param(
function(""cumprod""),
marks=pytest.mark.xfail(reason=""fails within xarray""),
),
pytest.param(
method(""all""), marks=pytest.mark.xfail(reason=""not implemented by pint"")
),
pytest.param(
method(""any""), marks=pytest.mark.xfail(reason=""not implemented by pint"")
),
method(""argmax""),
method(""argmin""),
method(""max""),
method(""min""),
method(""mean""),
method(""median""),
method(""sum""),
pytest.param(
method(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
method(""std""),
method(""var""),
method(""cumsum""),
pytest.param(
method(""cumprod""), marks=pytest.mark.xfail(reason=""fails within xarray"")
),
),
ids=repr,
)
def test_aggregation(self, func, dtype):
unit_a = (
unit_registry.Pa if func.name != ""cumprod"" else unit_registry.dimensionless
)
unit_b = (
unit_registry.kg / unit_registry.m ** 3
if func.name != ""cumprod""
else unit_registry.dimensionless
)
a = xr.DataArray(data=np.linspace(0, 1, 10).astype(dtype) * unit_a, dims=""x"")
b = xr.DataArray(data=np.linspace(-1, 0, 10).astype(dtype) * unit_b, dims=""x"")
x = xr.DataArray(data=np.arange(10).astype(dtype) * unit_registry.m, dims=""x"")
y = xr.DataArray(
data=np.arange(10, 20).astype(dtype) * unit_registry.s, dims=""x""
)
ds = xr.Dataset(data_vars={""a"": a, ""b"": b}, coords={""x"": x, ""y"": y})
actual = func(ds)
expected = attach_units(
func(strip_units(ds)),
{
""a"": extract_units(func(a)).get(None),
""b"": extract_units(func(b)).get(None),
},
)
> assert_equal_with_units(actual, expected)
E AssertionError: Left and right Dataset objects are not equal
E
E
E Differing data variables:
E L a float64
E R a float64
E L b float64 \nDimensions: ()\nData variables:\n a float64 0.1019\n b float64 0.1019>(\nDimensions: ()\nData variables:\n a float64 0.1019\n b float64 0.1019)
E + where \nDimensions: ()\nData variables:\n a float64 0.1019\n b float64 0.1019> = \nDimensions: ()\nData variables:\n a float64 0.1019\n b float64 0.1019.equals
../../BUILDROOT/python-xarray-0.15.1-3.fc33.aarch64/usr/lib/python3.9/site-packages/xarray/tests/test_units.py:3812: AssertionError
________________ TestDataset.test_aggregation[float-method_std] ________________
[gw0] linux -- Python 3.9.0 /usr/bin/python3
self =
func = method_std, dtype =
@pytest.mark.parametrize(
""func"",
(
pytest.param(
function(""all""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
pytest.param(
function(""any""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
function(""argmax""),
function(""argmin""),
function(""max""),
function(""min""),
function(""mean""),
pytest.param(
function(""median""),
marks=pytest.mark.xfail(
reason=""np.median does not work with dataset yet""
),
),
function(""sum""),
pytest.param(
function(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
function(""std""),
function(""var""),
function(""cumsum""),
pytest.param(
function(""cumprod""),
marks=pytest.mark.xfail(reason=""fails within xarray""),
),
pytest.param(
method(""all""), marks=pytest.mark.xfail(reason=""not implemented by pint"")
),
pytest.param(
method(""any""), marks=pytest.mark.xfail(reason=""not implemented by pint"")
),
method(""argmax""),
method(""argmin""),
method(""max""),
method(""min""),
method(""mean""),
method(""median""),
method(""sum""),
pytest.param(
method(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
method(""std""),
method(""var""),
method(""cumsum""),
pytest.param(
method(""cumprod""), marks=pytest.mark.xfail(reason=""fails within xarray"")
),
),
ids=repr,
)
def test_aggregation(self, func, dtype):
unit_a = (
unit_registry.Pa if func.name != ""cumprod"" else unit_registry.dimensionless
)
unit_b = (
unit_registry.kg / unit_registry.m ** 3
if func.name != ""cumprod""
else unit_registry.dimensionless
)
a = xr.DataArray(data=np.linspace(0, 1, 10).astype(dtype) * unit_a, dims=""x"")
b = xr.DataArray(data=np.linspace(-1, 0, 10).astype(dtype) * unit_b, dims=""x"")
x = xr.DataArray(data=np.arange(10).astype(dtype) * unit_registry.m, dims=""x"")
y = xr.DataArray(
data=np.arange(10, 20).astype(dtype) * unit_registry.s, dims=""x""
)
ds = xr.Dataset(data_vars={""a"": a, ""b"": b}, coords={""x"": x, ""y"": y})
actual = func(ds)
expected = attach_units(
func(strip_units(ds)),
{
""a"": extract_units(func(a)).get(None),
""b"": extract_units(func(b)).get(None),
},
)
> assert_equal_with_units(actual, expected)
E AssertionError: Left and right Dataset objects are not equal
E
E
E Differing data variables:
E L a float64
E R a float64
E L b float64
E R b float64
E assert False
E + where False = \nDimensions: ()\nData variables:\n a float64 0.3191\n b float64 0.3191>(\nDimensions: ()\nData variables:\n a float64 0.3191\n b float64 0.3191)
E + where \nDimensions: ()\nData variables:\n a float64 0.3191\n b float64 0.3191> = \nDimensions: ()\nData variables:\n a float64 0.3191\n b float64 0.3191.equals
../../BUILDROOT/python-xarray-0.15.1-3.fc33.aarch64/usr/lib/python3.9/site-packages/xarray/tests/test_units.py:3812: AssertionError
________________ TestDataset.test_aggregation[float-method_var] ________________
[gw0] linux -- Python 3.9.0 /usr/bin/python3
self =
func = method_var, dtype =
@pytest.mark.parametrize(
""func"",
(
pytest.param(
function(""all""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
pytest.param(
function(""any""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
function(""argmax""),
function(""argmin""),
function(""max""),
function(""min""),
function(""mean""),
pytest.param(
function(""median""),
marks=pytest.mark.xfail(
reason=""np.median does not work with dataset yet""
),
),
function(""sum""),
pytest.param(
function(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
function(""std""),
function(""var""),
function(""cumsum""),
pytest.param(
function(""cumprod""),
marks=pytest.mark.xfail(reason=""fails within xarray""),
),
pytest.param(
method(""all""), marks=pytest.mark.xfail(reason=""not implemented by pint"")
),
pytest.param(
method(""any""), marks=pytest.mark.xfail(reason=""not implemented by pint"")
),
method(""argmax""),
method(""argmin""),
method(""max""),
method(""min""),
method(""mean""),
method(""median""),
method(""sum""),
pytest.param(
method(""prod""),
marks=pytest.mark.xfail(reason=""not implemented by pint""),
),
method(""std""),
method(""var""),
method(""cumsum""),
pytest.param(
method(""cumprod""), marks=pytest.mark.xfail(reason=""fails within xarray"")
),
),
ids=repr,
)
def test_aggregation(self, func, dtype):
unit_a = (
unit_registry.Pa if func.name != ""cumprod"" else unit_registry.dimensionless
)
unit_b = (
unit_registry.kg / unit_registry.m ** 3
if func.name != ""cumprod""
else unit_registry.dimensionless
)
a = xr.DataArray(data=np.linspace(0, 1, 10).astype(dtype) * unit_a, dims=""x"")
b = xr.DataArray(data=np.linspace(-1, 0, 10).astype(dtype) * unit_b, dims=""x"")
x = xr.DataArray(data=np.arange(10).astype(dtype) * unit_registry.m, dims=""x"")
y = xr.DataArray(
data=np.arange(10, 20).astype(dtype) * unit_registry.s, dims=""x""
)
ds = xr.Dataset(data_vars={""a"": a, ""b"": b}, coords={""x"": x, ""y"": y})
actual = func(ds)
expected = attach_units(
func(strip_units(ds)),
{
""a"": extract_units(func(a)).get(None),
""b"": extract_units(func(b)).get(None),
},
)
> assert_equal_with_units(actual, expected)
E AssertionError: Left and right Dataset objects are not equal
E
E
E Differing data variables:
E L a float64
E R a float64
E L b float64 \nDimensions: ()\nData variables:\n a float64 0.1019\n b float64 0.1019>(\nDimensions: ()\nData variables:\n a float64 0.1019\n b float64 0.1019)
E + where \nDimensions: ()\nData variables:\n a float64 0.1019\n b float64 0.1019> = \nDimensions: ()\nData variables:\n a float64 0.1019\n b float64 0.1019.equals
../../BUILDROOT/python-xarray-0.15.1-3.fc33.aarch64/usr/lib/python3.9/site-packages/xarray/tests/test_units.py:3812: AssertionError
```
**What you expected to happen**:
Tests pass, no matter the architecture.
**Minimal Complete Verifiable Example**:
`pytest -ra -n auto -m 'not network' --pyargs xarray`
**Environment**:
All builds are run [here](https://koji.fedoraproject.org/koji/taskinfo?taskID=46030946); you can look at the individual architectures to see actual failures in `build.log` (though they're the same as above.) Note, other architectures not listed here fail only because this package is supposed to be noarch, but I disabled that here to test all arches.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/4172/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
487746465,MDExOlB1bGxSZXF1ZXN0MzEyOTQwMzgw,3274,Use drawstyle instead of linestyle in plot.step.,302469,closed,0,,,13,2019-08-31T08:33:54Z,2020-03-26T00:57:02Z,2020-03-26T00:47:43Z,CONTRIBUTOR,,0,pydata/xarray/pulls/3274,"Mixing the two is deprecated in Matplotlib 3.1, and breaks the doc build
if warnings are set to errors (which they are in new IPython sphinx
extensions.)
- [x] See #3266
- [x] Tests added
- [x] Passes `black . && mypy . && flake8`
- [x] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3274/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull
487745268,MDExOlB1bGxSZXF1ZXN0MzEyOTM5NzA1,3273,Don't set box-forced in Cartopy example.,302469,closed,0,,,1,2019-08-31T08:20:12Z,2019-08-31T09:19:20Z,2019-08-31T09:18:22Z,CONTRIBUTOR,,0,pydata/xarray/pulls/3273,"It is deprecated in Matplotlib 2.2, removed in 3.1, and appears to have no effect on the result.
- [x] Closes #3219
- [N/A] Tests added
- [x] Passes `black . && mypy . && flake8`
- [N/A] Fully documented, including `whats-new.rst` for all changes and `api.rst` for new API
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3273/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull
480871729,MDU6SXNzdWU0ODA4NzE3Mjk=,3219,box-forced is removed in Matplotlib 3.1,302469,closed,0,,,0,2019-08-14T20:24:52Z,2019-08-31T09:18:22Z,2019-08-31T09:18:22Z,CONTRIBUTOR,,,,"When [building](https://apps.fedoraproject.org/koschei/build/6802202) against Matplotlib 3.1, the docs fail (see [log](https://kojipkgs.fedoraproject.org/work/tasks/5093/37005093/build.log)) because `box-forced` is no longer accepted in Matplotlib.
#### Problem Description
Docs fail on `plot_cartopy_facetgrid.py`:
```
WARNING: /builddir/build/BUILD/xarray-0.12.3/doc/gallery/plot_cartopy_facetgrid.py failed to execute correctly: Traceback (most recent call last):
File ""/usr/lib/python3.7/site-packages/sphinx_gallery/gen_rst.py"", line 394, in _memory_usage
out = func()
File ""/usr/lib/python3.7/site-packages/sphinx_gallery/gen_rst.py"", line 382, in __call__
exec(self.code, self.globals)
File ""/builddir/build/BUILD/xarray-0.12.3/doc/gallery/plot_cartopy_facetgrid.py"", line 42, in
ax.set_aspect('equal', 'box-forced')
File ""/usr/lib/python3.7/site-packages/matplotlib/axes/_base.py"", line 1295, in set_aspect
self.set_adjustable(adjustable, share=share) # Handle sharing.
File ""/usr/lib/python3.7/site-packages/matplotlib/axes/_base.py"", line 1335, in set_adjustable
cbook._check_in_list([""box"", ""datalim""], adjustable=adjustable)
File ""/usr/lib/python3.7/site-packages/matplotlib/cbook/__init__.py"", line 2164, in _check_in_list
.format(v, k, ', '.join(map(repr, values))))
ValueError: 'box-forced' is not a valid value for adjustable; supported values are 'box', 'datalim'
```
#### Output of ``xr.show_versions()``
I can't run this; it's an automated build. But I can get any relevant versions out of the [root.log](https://kojipkgs.fedoraproject.org/work/tasks/5093/37005093/root.log):
* xarray 0.12.3
* python3-pandas 0.24.1-4.fc31
* python3-numpy 1:1.17.0-2.fc31
* python3-scipy 1.2.1-5.fc31
* python3-netcdf4 1.5.1.2-2.fc31
* python3-zarr 2.3.2-3.fc31
* python3-cftime 1.0.3.4-3.fc31
* python3-rasterio 1.0.24-2.fc31
* python3-Bottleneck 1.2.1-10.fc31
* python3-dask 2.1.0-2.fc31~bootstrap
* python3-matplotlib 3.1.1-1.fc31
* python3-cartopy 0.17.0-6.fc31
* python3-seaborn 0.9.0-6.fc31
* python3-setuptools 41.0.1-4.fc31
* python3-pytest 4.6.4-3.fc31
* python3-ipython 7.6.1-2.fc31
* python3-sphinx 1:2.1.2-2.fc31
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/3219/reactions"", ""total_count"": 3, ""+1"": 3, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,completed,13221727,issue
421751511,MDU6SXNzdWU0MjE3NTE1MTE=,2815,Cache datasets in XDG directories,302469,open,0,,,2,2019-03-16T01:01:52Z,2019-03-16T01:30:46Z,,CONTRIBUTOR,,,,"#### Problem description
The default directory for caching datasets is currently `~/.xarray_tutorial_data`:
https://github.com/pydata/xarray/blob/225868d232219440b188956531d5764ff4cd1b53/xarray/tutorial.py#L15
This doesn't follow the XDG standard on Linux, and AFAIK isn't actually invisible on Windows.
#### Expected Output
It would be better if this followed the XDG standard, i.e., `~/.cache/xarray_tutorial_data` (or some other places if you've set some environment variables) and something like `%LOCALAPPDATA%` on Windows. There are packages like [appdirs](https://pypi.org/project/appdirs/) that handle all this for you.","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/2815/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,issue
212388758,MDExOlB1bGxSZXF1ZXN0MTA5NDQ3Mjc1,1298,netcdf4/h5netcdf cross engine test broken on Python 2,302469,closed,0,,,6,2017-03-07T10:21:54Z,2017-04-07T04:21:10Z,2017-04-07T03:41:17Z,CONTRIBUTOR,,0,pydata/xarray/pulls/1298,"This is not really a bugfix or enhancement. In fact, it's just a bug report right now. I'm having trouble running tests on Python 2 with both netcdf4 and h5netcdf installed due to the cross engine test (
`H5NetCDFDataTest.test_cross_engine_read_write_netcdf4`).
I noticed that the requirements list `netcdf4` twice; I assume this was a typo and the second one should be `h5netcdf`. By switching the duplicate out, I'm hoping to trigger the problem on CI as a way to report this bug.
- [ ] closes #xxxx
- [ ] tests added / passed
- [ ] passes ``git diff upstream/master | flake8 --diff``
- [ ] whatsnew entry
","{""url"": ""https://api.github.com/repos/pydata/xarray/issues/1298/reactions"", ""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,,13221727,pull