home / github

Menu
  • GraphQL API
  • Search all tables

issues

Table actions
  • GraphQL API for issues

495 rows where user = 2448579 sorted by updated_at descending

✎ View and edit SQL

This data as json, CSV (advanced)

Suggested facets: comments, draft, created_at (date), closed_at (date)

type 2

  • pull 308
  • issue 187

state 2

  • closed 425
  • open 70

repo 1

  • xarray 495
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
2278499376 PR_kwDOAMm_X85uhFke 8997 Zarr: Optimize `region="auto"` detection dcherian 2448579 open 0     1 2024-05-03T22:13:18Z 2024-05-04T21:47:39Z   MEMBER   0 pydata/xarray/pulls/8997
  1. This moves the region detection code into ZarrStore so we only open the store once.
  2. Instead of opening the store as a dataset, construct a pd.Index directly to "auto"-infer the region.

The diff is large mostly because a bunch of code moved from backends/api.py to backends/zarr.py

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8997/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2278510478 PR_kwDOAMm_X85uhIGP 8998 Zarr: Optimize appending dcherian 2448579 open 0     0 2024-05-03T22:21:44Z 2024-05-03T22:23:34Z   MEMBER   1 pydata/xarray/pulls/8998

Builds on #8997

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8998/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1915997507 I_kwDOAMm_X85yM81D 8238 NamedArray tracking issue dcherian 2448579 open 0     12 2023-09-27T17:07:58Z 2024-04-30T12:49:17Z   MEMBER      

@andersy005 I think it would be good to keep a running list of NamedArray tasks. I'll start with a rough sketch, please update/edit as you like.

  • [x] Refactor out NamedArray base class (#8075)
  • [x] publicize design doc: Scientific Python | Pangeo | NumPy Mailist
  • [ ] Migrate VariableArithmetic to NamedArrayArithmetic (#8244)
  • [ ] Migrate ExplicitlyIndexed array classes to array protocols
  • [x] MIgrate from *Indexer objects to .oindex and .vindex on ExplicitlyIndexed array classes
  • [ ] https://github.com/pydata/xarray/pull/8870
  • [ ] Migrate unary ops
  • [ ] Migrate binary ops
  • [ ] Migrate nanops.py
  • [x] Avoid "injecting" reduce methods potentially by using generate_reductions.py? (#8304)
  • [ ] reprs and formatting.py
  • [x] parallelcompat.py
  • [ ] pycompat.py (#8244)
  • [ ] https://github.com/pydata/xarray/pull/8276
  • [ ] have test_variable.py test both NamedArray and Variable
  • [x] Arrays with unknown shape #8291
  • [ ] https://github.com/pydata/xarray/issues/8306
  • [ ] https://github.com/pydata/xarray/issues/8310
  • [ ] https://github.com/pydata/xarray/issues/8333
  • [ ] Try to preserve imports from xarray.core/* by importing namedarray functionality into xarray.core/*

xref #3981

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8238/reactions",
    "total_count": 3,
    "+1": 3,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2259316341 I_kwDOAMm_X86Gqm51 8965 Support concurrent loading of variables dcherian 2448579 open 0     4 2024-04-23T16:41:24Z 2024-04-29T22:21:51Z   MEMBER      

Is your feature request related to a problem?

Today if users have to concurrently load multiple variables in a DataArray or Dataset, they have to use dask.

It struck me that it'd be pretty easy for .load to gain an executor kwarg that accepts anything that follows the concurrent.futures executor interface, and parallelize this loop.

https://github.com/pydata/xarray/blob/b0036749542145794244dee4c4869f3750ff2dee/xarray/core/dataset.py#L853-L857

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8965/reactions",
    "total_count": 3,
    "+1": 3,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2261855627 PR_kwDOAMm_X85togwQ 8969 CI: python 3.12 by default. dcherian 2448579 closed 0     2 2024-04-24T17:49:25Z 2024-04-29T16:21:20Z 2024-04-29T16:21:08Z MEMBER   0 pydata/xarray/pulls/8969
  1. Now that numba supports 3.12.
  2. Disabled pint on the main environment since it doesn't work. Pint is still installed in the all-but-dask env, which is still runs python 3.11 for this reason.
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8969/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1574694462 I_kwDOAMm_X85d2-4- 7513 intermittent failures with h5netcdf, h5py on macos dcherian 2448579 closed 0     5 2023-02-07T16:58:43Z 2024-04-28T23:35:21Z 2024-04-28T23:35:21Z MEMBER      

What is your issue?

cc @hmaarrfk @kmuehlbauer

Passed: https://github.com/pydata/xarray/actions/runs/4115923717/jobs/7105298426 Failed: https://github.com/pydata/xarray/actions/runs/4115946392/jobs/7105345290

Versions: h5netcdf 1.1.0 pyhd8ed1ab_0 conda-forge h5py 3.8.0 nompi_py310h5555e59_100 conda-forge hdf4 4.2.15 h7aa5921_5 conda-forge hdf5 1.12.2 nompi_h48135f9_101 conda-forge

``` =================================== FAILURES =================================== ___ test_open_mfdataset_manyfiles[h5netcdf-20-True-5-5] ______ [gw1] darwin -- Python 3.10.9 /Users/runner/micromamba-root/envs/xarray-tests/bin/python

readengine = 'h5netcdf', nfiles = 20, parallel = True, chunks = 5 file_cache_maxsize = 5

@requires_dask
@pytest.mark.filterwarnings("ignore:use make_scale(name) instead")
def test_open_mfdataset_manyfiles(
    readengine, nfiles, parallel, chunks, file_cache_maxsize
):
    # skip certain combinations
    skip_if_not_engine(readengine)

    if ON_WINDOWS:
        pytest.skip("Skipping on Windows")

    randdata = np.random.randn(nfiles)
    original = Dataset({"foo": ("x", randdata)})
    # test standard open_mfdataset approach with too many files
    with create_tmp_files(nfiles) as tmpfiles:
        writeengine = readengine if readengine != "pynio" else "netcdf4"
        # split into multiple sets of temp files
        for ii in original.x.values:
            subds = original.isel(x=slice(ii, ii + 1))
            if writeengine != "zarr":
                subds.to_netcdf(tmpfiles[ii], engine=writeengine)
            else:  # if writeengine == "zarr":
                subds.to_zarr(store=tmpfiles[ii])

        # check that calculation on opened datasets works properly
      with open_mfdataset(
            tmpfiles,
            combine="nested",
            concat_dim="x",
            engine=readengine,
            parallel=parallel,
            chunks=chunks if (not chunks and readengine != "zarr") else "auto",
        ) as actual:

/Users/runner/work/xarray/xarray/xarray/tests/test_backends.py:3267:


/Users/runner/work/xarray/xarray/xarray/backends/api.py:991: in open_mfdataset datasets, closers = dask.compute(datasets, closers) /Users/runner/micromamba-root/envs/xarray-tests/lib/python3.10/site-packages/dask/base.py:599: in compute results = schedule(dsk, keys, kwargs) /Users/runner/micromamba-root/envs/xarray-tests/lib/python3.10/site-packages/dask/threaded.py:89: in get results = get_async( /Users/runner/micromamba-root/envs/xarray-tests/lib/python3.10/site-packages/dask/local.py:511: in get_async raise_exception(exc, tb) /Users/runner/micromamba-root/envs/xarray-tests/lib/python3.10/site-packages/dask/local.py:319: in reraise raise exc /Users/runner/micromamba-root/envs/xarray-tests/lib/python3.10/site-packages/dask/local.py:224: in execute_task result = _execute_task(task, data) /Users/runner/micromamba-root/envs/xarray-tests/lib/python3.10/site-packages/dask/core.py:119: in _execute_task return func((_execute_task(a, cache) for a in args)) /Users/runner/micromamba-root/envs/xarray-tests/lib/python3.10/site-packages/dask/utils.py:72: in apply return func(args, kwargs) /Users/runner/work/xarray/xarray/xarray/backends/api.py:526: in open_dataset backend_ds = backend.open_dataset( /Users/runner/work/xarray/xarray/xarray/backends/h5netcdf_.py:417: in open_dataset ds = store_entrypoint.open_dataset( /Users/runner/work/xarray/xarray/xarray/backends/store.py:32: in open_dataset vars, attrs = store.load() /Users/runner/work/xarray/xarray/xarray/backends/common.py:129: in load (decode_variable_name(k), v) for k, v in self.get_variables().items() /Users/runner/work/xarray/xarray/xarray/backends/h5netcdf.py:220: in get_variables return FrozenDict( /Users/runner/work/xarray/xarray/xarray/core/utils.py:471: in FrozenDict return Frozen(dict(args, *kwargs)) /Users/runner/work/xarray/xarray/xarray/backends/h5netcdf_.py:221: in <genexpr> (k, self.open_store_variable(k, v)) for k, v in self.ds.variables.items() /Users/runner/work/xarray/xarray/xarray/backends/h5netcdf_.py:200: in open_store_variable elif var.compression is not None: /Users/runner/micromamba-root/envs/xarray-tests/lib/python3.10/site-packages/h5netcdf/core.py:394: in compression return self._h5ds.compression


self = <[AttributeError("'NoneType' object has no attribute '_root'") raised in repr()] Variable object at 0x151378970>

@property
def _h5ds(self):
    # Always refer to the root file and store not h5py object
    # subclasses:
  return self._root._h5file[self._h5path]

E AttributeError: 'NoneType' object has no attribute '_h5file'

```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7513/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2261844699 PR_kwDOAMm_X85toeXT 8968 Bump dependencies incl `pandas>=2` dcherian 2448579 closed 0     0 2024-04-24T17:42:19Z 2024-04-27T14:17:16Z 2024-04-27T14:17:16Z MEMBER   0 pydata/xarray/pulls/8968
  • [ ] 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/8968/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2261917442 PR_kwDOAMm_X85touYl 8971 Delete pynio backend. dcherian 2448579 closed 0     2 2024-04-24T18:25:26Z 2024-04-25T14:38:23Z 2024-04-25T14:23:59Z MEMBER   0 pydata/xarray/pulls/8971
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8971/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2187743087 PR_kwDOAMm_X85ptH1f 8840 Grouper, Resampler as public api dcherian 2448579 open 0     0 2024-03-15T05:16:05Z 2024-04-21T16:21:34Z   MEMBER   1 pydata/xarray/pulls/8840

Expose Grouper and Resampler as public API

TODO: - [ ] Consider avoiding IndexVariable


  • [x] Tests added
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [x] New functions/methods are listed in api.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8840/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2248614324 I_kwDOAMm_X86GByG0 8952 `isel(multi_index_level_name = MultiIndex.level)` corrupts the MultiIndex dcherian 2448579 open 0     1 2024-04-17T15:41:39Z 2024-04-18T13:14:46Z   MEMBER      

What happened?

From https://github.com/pydata/xarray/discussions/8951

if d is a MultiIndex-ed dataset with levels (x, y, z), and m is a dataset with a single coord x m.isel(x=d.x) builds a dataset with a MultiIndex with levels (y, z). This seems like it should work.

cc @benbovy

What did you expect to happen?

No response

Minimal Complete Verifiable Example

```Python import pandas as pd, xarray as xr, numpy as np

xr.set_options(use_flox=True)

test = pd.DataFrame() test["x"] = np.arange(100) % 10 test["y"] = np.arange(100) test["z"] = np.arange(100) test["v"] = np.arange(100)

d = xr.Dataset.from_dataframe(test) d = d.set_index(index = ["x", "y", "z"]) print(d)

m = d.groupby("x").mean() print(m)

print(d.xindexes) print(m.isel(x=d.x).xindexes)

xr.align(d, m.isel(x=d.x))

res = d.groupby("x") - m

print(res)

```

<xarray.Dataset> Dimensions: (index: 100) Coordinates: * index (index) object MultiIndex * x (index) int64 0 1 2 3 4 5 6 7 8 9 0 1 2 ... 8 9 0 1 2 3 4 5 6 7 8 9 * y (index) int64 0 1 2 3 4 5 6 7 8 9 ... 90 91 92 93 94 95 96 97 98 99 * z (index) int64 0 1 2 3 4 5 6 7 8 9 ... 90 91 92 93 94 95 96 97 98 99 Data variables: v (index) int64 0 1 2 3 4 5 6 7 8 9 ... 90 91 92 93 94 95 96 97 98 99 <xarray.Dataset> Dimensions: (x: 10) Coordinates: * x (x) int64 0 1 2 3 4 5 6 7 8 9 Data variables: v (x) float64 45.0 46.0 47.0 48.0 49.0 50.0 51.0 52.0 53.0 54.0 Indexes: ┌ index PandasMultiIndex │ x │ y └ z Indexes: ┌ index PandasMultiIndex │ y └ z ValueError...

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, returning the result.
  • [x] New issue — a search of GitHub Issues suggests this is not a duplicate.
  • [x] Recent environment — the issue occurs with the latest version of xarray and its dependencies.

Relevant log output

No response

Anything else we need to know?

No response

Environment

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8952/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2215762637 PR_kwDOAMm_X85rMHpN 8893 Avoid extra read from disk when creating Pandas Index. dcherian 2448579 open 0     1 2024-03-29T17:44:52Z 2024-04-08T18:55:09Z   MEMBER   0 pydata/xarray/pulls/8893
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8893/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2228266052 PR_kwDOAMm_X85r24hE 8913 Update hypothesis action to always save the cache dcherian 2448579 closed 0     0 2024-04-05T15:09:35Z 2024-04-05T16:51:05Z 2024-04-05T16:51:03Z MEMBER   0 pydata/xarray/pulls/8913

Update the cache always.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8913/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2228319306 I_kwDOAMm_X86E0XRK 8914 swap_dims does not propagate indexes properly dcherian 2448579 open 0     0 2024-04-05T15:36:26Z 2024-04-05T15:36:27Z   MEMBER      

What happened?

Found by hypothesis ``` import xarray as xr import numpy as np

var = xr.Variable(dims="2", data=np.array(['1970-01-01T00:00:00.000000000', '1970-01-01T00:00:00.000000002', '1970-01-01T00:00:00.000000001'], dtype='datetime64[ns]')) var1 = xr.Variable(data=np.array([0], dtype=np.uint32), dims=['1'], attrs={})

state = xr.Dataset() state['2'] = var state = state.stack({"0": ["2"]}) state['1'] = var1 state['1_'] = var1#.copy(deep=True) state = state.swap_dims({"1": "1_"}) xr.testing.assertions._assert_internal_invariants(state, False) ```

This swaps simple pandas indexed dims, but the multi-index that is in the dataset and not affected by the swap_dims op ends up broken.

cc @benbovy

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, returning the result.
  • [ ] New issue — a search of GitHub Issues suggests this is not a duplicate.
  • [ ] Recent environment — the issue occurs with the latest version of xarray and its dependencies.

Relevant log output

No response

Anything else we need to know?

No response

Environment

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8914/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2224297504 PR_kwDOAMm_X85rpGUH 8906 Add invariant check for IndexVariable.name dcherian 2448579 open 0     1 2024-04-04T02:13:33Z 2024-04-05T07:12:54Z   MEMBER   1 pydata/xarray/pulls/8906

@benbovy this seems to be the root cause of #8646, the variable name in Dataset._variables does not match IndexVariable.name.

A good number of tests seem to fail though, so not sure if this is a good chck.

  • [ ] 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/8906/reactions",
    "total_count": 2,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 2,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2136709010 I_kwDOAMm_X85_W5eS 8753 Lazy Loading with `DataArray` vs. `Variable` dcherian 2448579 closed 0     0 2024-02-15T14:42:24Z 2024-04-04T16:46:54Z 2024-04-04T16:46:54Z MEMBER      

Discussed in https://github.com/pydata/xarray/discussions/8751

<sup>Originally posted by **ilan-gold** February 15, 2024</sup> My goal is to get a dataset from [custom io-zarr backend lazy-loaded](https://docs.xarray.dev/en/stable/internals/how-to-add-new-backend.html#how-to-support-lazy-loading). But when I declare a `DataArray` based on the `Variable` which uses `LazilyIndexedArray`, everything is read in. Is this expected? I specifically don't want to have to use dask if possible. I have seen https://github.com/aurghs/xarray-backend-tutorial/blob/main/2.Backend_with_Lazy_Loading.ipynb but it's a little bit different. While I have a custom backend array inheriting from `ZarrArrayWrapper`, this example using `ZarrArrayWrapper` directly still highlights the same unexpected behavior of everything being read in. ```python import zarr import xarray as xr from tempfile import mkdtemp import numpy as np from pathlib import Path from collections import defaultdict class AccessTrackingStore(zarr.DirectoryStore): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self._access_count = {} self._accessed = defaultdict(set) def __getitem__(self, key): for tracked in self._access_count: if tracked in key: self._access_count[tracked] += 1 self._accessed[tracked].add(key) return super().__getitem__(key) def get_access_count(self, key): return self._access_count[key] def set_key_trackers(self, keys_to_track): if isinstance(keys_to_track, str): keys_to_track = [keys_to_track] for k in keys_to_track: self._access_count[k] = 0 def get_subkeys_accessed(self, key): return self._accessed[key] orig_path = Path(mkdtemp()) z = zarr.group(orig_path / "foo.zarr") z['array'] = np.random.randn(1000, 1000) store = AccessTrackingStore(orig_path / "foo.zarr") store.set_key_trackers(['array']) z = zarr.group(store) arr = xr.backends.zarr.ZarrArrayWrapper(z['array']) lazy_arr = xr.core.indexing.LazilyIndexedArray(arr) # just `.zarray` var = xr.Variable(('x', 'y'), lazy_arr) print('Variable read in ', store.get_subkeys_accessed('array')) # now everything is read in da = xr.DataArray(var) print('DataArray read in ', store.get_subkeys_accessed('array')) ```
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8753/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2136724736 PR_kwDOAMm_X85m_MtN 8754 Don't access data when creating DataArray from Variable. dcherian 2448579 closed 0     2 2024-02-15T14:48:32Z 2024-04-04T16:46:54Z 2024-04-04T16:46:53Z MEMBER   0 pydata/xarray/pulls/8754
  • [x] Closes #8753

This seems to have been around since 2016-ish, so presumably our backend code path is passing arrays around, not Variables.

cc @ilan-gold

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8754/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2224300175 PR_kwDOAMm_X85rpG4S 8907 Trigger hypothesis stateful tests nightly dcherian 2448579 closed 0     0 2024-04-04T02:16:59Z 2024-04-04T02:17:49Z 2024-04-04T02:17:47Z MEMBER   0 pydata/xarray/pulls/8907
  • [ ] 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/8907/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2098659175 PR_kwDOAMm_X85k-T6b 8658 Stateful tests with Dataset dcherian 2448579 closed 0     8 2024-01-24T16:34:59Z 2024-04-03T21:29:38Z 2024-04-03T21:29:36Z MEMBER   0 pydata/xarray/pulls/8658

I was curious to see if the hypothesis stateful testing would catch an inconsistent sequence of index manipulation operations like #8646. Turns out rename_vars is basically broken? (filed #8659) :P

PS: this blog post is amazing. E state = DatasetStateMachine() E state.assert_invariants() E > === E E <xarray.Dataset> E Dimensions: () E Data variables: E *empty* E === E E E > vars: ('1', '1_') E state.add_dim_coord(var=<xarray.Variable (1: 1)> E array([0], dtype=uint32)) E state.assert_invariants() E > === E E <xarray.Dataset> E Dimensions: (1: 1) E Coordinates: E * 1 (1) uint32 0 E Data variables: E 1_ (1) uint32 0 E === E E E > renaming 1 to 0 E state.rename_vars(newname='0') E state.assert_invariants() E > === E E <xarray.Dataset> E Dimensions: (1: 1) E Coordinates: E * 0 (1) uint32 0 E Dimensions without coordinates: 1 E Data variables: E 1_ (1) uint32 0 E === E E E state.teardown()

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8658/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2000205407 PR_kwDOAMm_X85fzupc 8467 [skip-ci] dev whats-new dcherian 2448579 closed 0     0 2023-11-18T03:59:29Z 2024-04-03T21:08:45Z 2023-11-18T15:20:37Z MEMBER   0 pydata/xarray/pulls/8467
  • [ ] 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/8467/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1989233637 PR_kwDOAMm_X85fOdAk 8446 Remove PseudoNetCDF dcherian 2448579 closed 0     0 2023-11-12T04:29:50Z 2024-04-03T21:08:44Z 2023-11-13T21:53:56Z MEMBER   0 pydata/xarray/pulls/8446

joining the party - [x] User visible changes (including notable bug fixes) are documented in whats-new.rst

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8446/reactions",
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 1,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2064698904 PR_kwDOAMm_X85jLHsQ 8584 Silence a bunch of CachingFileManager warnings dcherian 2448579 closed 0     1 2024-01-03T21:57:07Z 2024-04-03T21:08:27Z 2024-01-03T22:52:58Z MEMBER   0 pydata/xarray/pulls/8584  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8584/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2102850331 PR_kwDOAMm_X85lMW8k 8674 Fix negative slicing of Zarr arrays dcherian 2448579 closed 0     0 2024-01-26T20:22:21Z 2024-04-03T21:08:26Z 2024-02-10T02:57:32Z MEMBER   0 pydata/xarray/pulls/8674

Closes #8252 Closes #3921

  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8674/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2148245262 PR_kwDOAMm_X85nmmqX 8777 Return a dataclass from Grouper.factorize dcherian 2448579 closed 0     0 2024-02-22T05:41:29Z 2024-04-03T21:08:25Z 2024-03-15T04:47:30Z MEMBER   0 pydata/xarray/pulls/8777

Toward #8510, builds on #8776

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8777/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2148164557 PR_kwDOAMm_X85nmU5w 8775 [skip-ci] NamedArray: Add lazy indexing array refactoring plan dcherian 2448579 closed 0     0 2024-02-22T04:25:49Z 2024-04-03T21:08:21Z 2024-02-23T22:20:09Z MEMBER   0 pydata/xarray/pulls/8775

This adds a proposal for decoupling the lazy indexing array machinery, indexing adapter machinery, and Variable's setitem and getitem methods, so that the latter can be migrated to NamedArray.

cc @andersy005

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8775/reactions",
    "total_count": 2,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 2,
    "eyes": 0
}
    xarray 13221727 pull
2198991054 PR_kwDOAMm_X85qTNFP 8861 upstream-dev CI: Fix interp and cumtrapz dcherian 2448579 closed 0     0 2024-03-21T02:49:40Z 2024-04-03T21:08:17Z 2024-03-21T04:16:45Z MEMBER   0 pydata/xarray/pulls/8861
  • [x] xref #8844
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8861/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1997636679 PR_kwDOAMm_X85frAC_ 8460 Add initialize_zarr dcherian 2448579 open 0     8 2023-11-16T19:45:05Z 2024-04-02T15:08:01Z   MEMBER   1 pydata/xarray/pulls/8460
  • [x] Closes #8343
  • [x] Tests added
  • [ ] User visible changes (including notable bug fixes) are documented in whats-new.rst
  • [x] New functions/methods are listed in api.rst

The intended pattern is: ```python

after_init = initialize_zarr(store, ds, region_dims=("x",))
for i in range(ds.sizes["x"]):
    after_init.isel(x=[i]).to_zarr(store, region={"x": slice(i, i + 1)})

```

cc @slevang

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8460/reactions",
    "total_count": 5,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 3,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 2
}
    xarray 13221727 pull
2215539648 PR_kwDOAMm_X85rLW_p 8891 2024.03.0: Add whats-new dcherian 2448579 closed 0     0 2024-03-29T15:01:35Z 2024-03-29T17:07:19Z 2024-03-29T17:07:17Z MEMBER   0 pydata/xarray/pulls/8891  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8891/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2206047573 PR_kwDOAMm_X85qrHyn 8875 Optimize writes to existing Zarr stores. dcherian 2448579 closed 0     0 2024-03-25T15:32:47Z 2024-03-29T14:35:30Z 2024-03-29T14:35:29Z MEMBER   0 pydata/xarray/pulls/8875

We need to read existing variables to make sure we append or write to a region with the right encoding. Currently we decode all arrays in a Zarr group. Instead only decode those arrays for which we require encoding information.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8875/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2213636579 I_kwDOAMm_X86D8Wnj 8887 resetting multiindex may be buggy dcherian 2448579 open 0     1 2024-03-28T16:23:38Z 2024-03-29T07:59:22Z   MEMBER      

What happened?

Resetting a MultiIndex dim coordinate preserves the MultiIndex levels as IndexVariables. We should either reset the indexes for the multiindex level variables, or warn asking the users to do so

This seems to be the root cause exposed by https://github.com/pydata/xarray/pull/8809

cc @benbovy

What did you expect to happen?

No response

Minimal Complete Verifiable Example

```Python import numpy as np import xarray as xr

ND DataArray that gets stacked along a multiindex

da = xr.DataArray(np.ones((3, 3)), coords={"dim1": [1, 2, 3], "dim2": [4, 5, 6]}) da = da.stack(feature=["dim1", "dim2"])

Extract just the stacked coordinates for saving in a dataset

ds = xr.Dataset(data_vars={"feature": da.feature}) xr.testing.assertions._assert_internal_invariants(ds.reset_index(["feature", "dim1", "dim2"]), check_default_indexes=False) # succeeds xr.testing.assertions._assert_internal_invariants(ds.reset_index(["feature"]), check_default_indexes=False) # fails, but no warning either ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8887/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2066510805 I_kwDOAMm_X857LHPV 8589 Don't overwrite indexes for region writes, always dcherian 2448579 closed 0     2 2024-01-04T23:52:18Z 2024-03-27T16:24:37Z 2024-03-27T16:24:36Z MEMBER      

What happened?

Currently we don't overwrite indexes when region="auto" https://github.com/pydata/xarray/blob/e6ccedb56ed4bc8d0b7c1f16ab325795330fb19a/xarray/backends/api.py#L1769-L1770

I propose we do this for all region writes and completely disallow modifying indexes with a region write.

This would match the map_blocks model, where all indexes are specified in the template and no changes by the mapped function are allowed.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8589/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2206385638 PR_kwDOAMm_X85qsSKm 8877 Don't allow overwriting indexes with region writes dcherian 2448579 closed 0     0 2024-03-25T18:13:19Z 2024-03-27T16:24:37Z 2024-03-27T16:24:35Z MEMBER   0 pydata/xarray/pulls/8877
  • [x] Closes #8589
  • [x] Tests added
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst

cc @slevang

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8877/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1471685307 I_kwDOAMm_X85XuCK7 7344 Disable bottleneck by default? dcherian 2448579 open 0     11 2022-12-01T17:26:11Z 2024-03-27T00:22:41Z   MEMBER      

What is your issue?

Our choice to enable bottleneck by default results in quite a few issues about numerical stability and funny dtype behaviour: #7336, #7128, #2370, #1346 (and probably more)

Shall we disable it by default?

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7344/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2123950388 PR_kwDOAMm_X85mT6XD 8720 groupby: Dispatch quantile to flox. dcherian 2448579 closed 0     7 2024-02-07T21:42:42Z 2024-03-26T15:08:32Z 2024-03-26T15:08:30Z MEMBER   0 pydata/xarray/pulls/8720
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst

@aulemahal would you be able to test against xclim's test suite. I imagine you're doing a bunch of grouped quantiles.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8720/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2184830377 PR_kwDOAMm_X85pjN8A 8829 Revert "Do not attempt to broadcast when global option ``arithmetic_b… dcherian 2448579 closed 0     7 2024-03-13T20:27:12Z 2024-03-20T15:30:12Z 2024-03-15T03:59:07Z MEMBER   0 pydata/xarray/pulls/8829

…roadcast=False`` (#8784)"

This reverts commit 11f89ecdd41226cf93da8d1e720d2710849cd23e.

Reverting #8784

Sadly that PR broke a lot of tests by breaking create_test_data with from xarray.tests import create_test_data create_test_data()

```

AssertionError Traceback (most recent call last) Cell In[3], line 2 1 from xarray.tests import create_test_data ----> 2 create_test_data()

File ~/repos/xarray/xarray/tests/init.py:329, in create_test_data(seed, add_attrs, dim_sizes) 327 obj.coords["numbers"] = ("dim3", numbers_values) 328 obj.encoding = {"foo": "bar"} --> 329 assert all(var.values.flags.writeable for var in obj.variables.values()) 330 return obj

AssertionError: ```

Somehow that code changes whether IndexVariable.values returns a writeable numpy array. I spent some time debugging but couldn't figure it out.

cc @etienneschalk

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8829/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2189750364 PR_kwDOAMm_X85p0Epw 8847 pandas 3 MultiIndex fixes dcherian 2448579 closed 0     0 2024-03-16T03:51:06Z 2024-03-20T15:00:20Z 2024-03-20T15:00:18Z MEMBER   0 pydata/xarray/pulls/8847

xref #8844 Closes https://github.com/xarray-contrib/flox/issues/342

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8847/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2189738090 PR_kwDOAMm_X85p0CKq 8846 Support pandas copy-on-write behaviour dcherian 2448579 closed 0     2 2024-03-16T03:14:46Z 2024-03-18T16:00:15Z 2024-03-18T16:00:12Z MEMBER   0 pydata/xarray/pulls/8846
  • [x] Closes #8843
  • [x] Tests added

```python import numpy as np import pandas as pd

pd.set_option("mode.copy_on_write", True)

from xarray.core.variable import _possibly_convert_objects

string_var = np.array(["a", "bc", "def"], dtype=object) datetime_var = np.array( ["2019-01-01", "2019-01-02", "2019-01-03"], dtype="datetime64[ns]" ) assert _possibly_convert_objects(string_var).flags.writeable assert _possibly_convert_objects(datetime_var).flags.writeable ```

The core issue is that we now get read-only arrays back from pandas here: https://github.com/pydata/xarray/blob/fbcac7611bf9a16750678f93483d3dbe0e261a0a/xarray/core/variable.py#L197-L212

@phofl is this expected?

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8846/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2188936276 I_kwDOAMm_X86CeIRU 8843 Get ready for pandas 3 copy-on-write dcherian 2448579 closed 0     2 2024-03-15T15:51:36Z 2024-03-18T16:00:14Z 2024-03-18T16:00:14Z MEMBER      

What is your issue?

This line fails with pd.set_options("mode.copy_on_write", True) https://github.com/pydata/xarray/blob/c9d3084e98d38a7a9488380789a8d0acfde3256f/xarray/tests/init.py#L329

We'll need to fix this before Pandas 3 is released in April: https://github.com/pydata/xarray/blob/c9d3084e98d38a7a9488380789a8d0acfde3256f/xarray/tests/init.py#L329

Here's a test ```python def example(): obj = Dataset() obj["dim2"] = ("dim2", 0.5 * np.arange(9)) obj["time"] = ("time", pd.date_range("2000-01-01", periods=20) print({k: v.data.flags for k, v in obj.variables.items()}) return obj

example() pd.set_options("mode.copy_on_write", True) example() ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8843/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2098659703 I_kwDOAMm_X859FwF3 8659 renaming index variables with `rename_vars` seems buggy dcherian 2448579 closed 0     1 2024-01-24T16:35:18Z 2024-03-15T19:21:51Z 2024-03-15T19:21:51Z MEMBER      

What happened?

(xref #8658)

I'm not sure what the expected behaviour is here:

```python import xarray as xr import numpy as np from xarray.testing import _assert_internal_invariants

ds = xr.Dataset() ds.coords["1"] = ("1", np.array([1], dtype=np.uint32)) ds["1_"] = ("1", np.array([1], dtype=np.uint32)) ds = ds.rename_vars({"1": "0"}) ds ```

It looks like this sequence of operations creates a default index

But then ```python from xarray.testing import _assert_internal_invariants

_assert_internal_invariants(ds, check_default_indexes=True) fails with ... File ~/repos/xarray/xarray/testing/assertions.py:301, in _assert_indexes_invariants_checks(indexes, possible_coord_variables, dims, check_default) 299 if check_default: 300 defaults = default_indexes(possible_coord_variables, dims) --> 301 assert indexes.keys() == defaults.keys(), (set(indexes), set(defaults)) 302 assert all(v.equals(defaults[k]) for k, v in indexes.items()), ( 303 indexes, 304 defaults, 305 )

AssertionError: ({'0'}, set()) ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8659/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2187659148 I_kwDOAMm_X86CZQeM 8838 remove xfail from `test_dataarray.test_to_dask_dataframe()` dcherian 2448579 open 0     2 2024-03-15T03:43:02Z 2024-03-15T15:33:31Z   MEMBER      

What is your issue?

when dask-expr is fixed. Added in https://github.com/pydata/xarray/pull/8837

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8838/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2021856935 PR_kwDOAMm_X85g81gb 8509 Proof of concept - public Grouper objects dcherian 2448579 open 0     0 2023-12-02T04:52:27Z 2024-03-15T05:18:18Z   MEMBER   1 pydata/xarray/pulls/8509

Not for merging, just proof that it can be done nicely :)

Now builds on #8840 ~Builds on an older version of #8507~

Try it out!

```python import xarray as xr from xarray.core.groupers import SeasonGrouper, SeasonResampler

ds = xr.tutorial.open_dataset("air_temperature")

custom seasons!

ds.air.groupby(time=SeasonGrouper(["JF", "MAM", "JJAS", "OND"])).mean()

ds.air.resample(time=SeasonResampler(["DJF", "MAM", "JJAS", "ON"])).count() ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8509/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2187682227 PR_kwDOAMm_X85ps6tB 8839 [skip-ci] Fix upstream-dev env dcherian 2448579 closed 0     0 2024-03-15T04:08:58Z 2024-03-15T04:37:59Z 2024-03-15T04:37:58Z MEMBER   0 pydata/xarray/pulls/8839

upstream-dev env is broken

  • [x] Closes #8623
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8839/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2187646833 PR_kwDOAMm_X85psy9g 8837 Add dask-expr for windows envs dcherian 2448579 closed 0     0 2024-03-15T03:27:48Z 2024-03-15T04:06:05Z 2024-03-15T04:06:03Z MEMBER   0 pydata/xarray/pulls/8837
  • [x] Closes #8830
  • [ ] 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/8837/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2184871888 I_kwDOAMm_X86COn_Q 8830 failing tests, all envs dcherian 2448579 closed 0     1 2024-03-13T20:56:34Z 2024-03-15T04:06:04Z 2024-03-15T04:06:04Z MEMBER      

What happened?

All tests are failing because of an error in create_test_data

from xarray.tests import create_test_data create_test_data()

```

AssertionError Traceback (most recent call last) Cell In[3], line 2 1 from xarray.tests import create_test_data ----> 2 create_test_data()

File ~/repos/xarray/xarray/tests/init.py:329, in create_test_data(seed, add_attrs, dim_sizes) 327 obj.coords["numbers"] = ("dim3", numbers_values) 328 obj.encoding = {"foo": "bar"} --> 329 assert all(var.values.flags.writeable for var in obj.variables.values()) 330 return obj

AssertionError: ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8830/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2184606202 PR_kwDOAMm_X85picsD 8827 Add `dask-expr` to environment-3.12.yml dcherian 2448579 closed 0     0 2024-03-13T18:07:27Z 2024-03-13T20:20:46Z 2024-03-13T20:20:45Z MEMBER   0 pydata/xarray/pulls/8827

xref https://github.com/pydata/xarray/actions/runs/8269168819/job/22623800305?pr=8777

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8827/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1308371056 I_kwDOAMm_X85N_Chw 6806 New alignment option: "exact" without broadcasting OR Turn off automatic broadcasting dcherian 2448579 closed 0     9 2022-07-18T18:43:31Z 2024-03-13T15:36:35Z 2024-03-13T15:36:35Z MEMBER      

Is your feature request related to a problem?

If we have two objects with dims x and x1, then xr.align(..., join="exact") will pass because these dimensions are broadcastable.

I'd like a stricter option (join="strict"?) that disallows broadcasting.

Describe the solution you'd like

python xr.align( xr.DataArray([1], dims="x"), xr.DataArray([1], dims="x1"), join="strict", ) would raise an error.

It'd be nice to have this as a built-in option so we can use python with xr.set_options(arithmetic_join="strict"): ...

Describe alternatives you've considered

An alternative would be to allow control over automatic broadcasting through the set_options context manager., but that seems like it would be more complicated to implement.

Additional context

This turns up in staggered grid calculations with xgcm where it is easy to mistakenly construct very high-dimensional arrays because of automatic broadcasting.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/6806/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2148242023 PR_kwDOAMm_X85nml9d 8776 Refactor Grouper objects dcherian 2448579 closed 0     0 2024-02-22T05:38:09Z 2024-03-07T21:50:07Z 2024-03-07T21:50:04Z MEMBER   0 pydata/xarray/pulls/8776

Some refactoring towards the Grouper refactor described in #8510

  1. Rename to Resampler from ResampleGrouper
  2. Refactor to a single "ResolvedGrouper" object that encapsulates the underling Grouper/Resampler object: UniqueGrouper, BinGrouper, or TimeResampler.
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8776/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2021858121 PR_kwDOAMm_X85g81wJ 8510 Grouper object design doc dcherian 2448579 closed 0     6 2023-12-02T04:56:54Z 2024-03-06T02:27:07Z 2024-03-06T02:27:04Z MEMBER   0 pydata/xarray/pulls/8510

xref #8509, #6610

Rendered version here


@pydata/xarray I've been poking at this on and off for a year now and finally figured out how to do it cleanly (#8509).

I wrote up a design doc for Grouper objects that allow custom conversion of DataArrays to integer group codes, following the NEP template (which is absolutely great!). Such Grouper objects allow us to generalize the GroupBy interface to a much larger class of problems, and eventually provide a nice path to grouping by multiple variables (#6610)

8509 implements two custom Groupers for you to try out :)

```python import xarray as xr from xarray.core.groupers import SeasonGrouper, SeasonResampler

ds = xr.tutorial.open_dataset("air_temperature")

custom seasons!

ds.air.groupby(time=SeasonGrouper(["JF", "MAM", "JJAS", "OND"])).mean()

ds.air.resample(time=SeasonResampler(["DJF", "MAM", "JJAS", "ON"])).count() ```

All comments are welcome, 1. there are a couple of specific API and design decisions to be made. I'll make some comments pointing these out. 2. I'm also curious about what Grouper objects we should provide in Xarray.


cc @ilan-gold @ivirshup @aulemahal @tomvothecoder @jbusecke @katiedagon - it would be good to hear what "Groupers" would be useful for your work / projects. I bet you already have examples that fit this proposal

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8510/reactions",
    "total_count": 8,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 8,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2149485914 I_kwDOAMm_X86AHo1a 8778 Stricter defaults for concat, combine, open_mfdataset dcherian 2448579 open 0     2 2024-02-22T16:43:38Z 2024-02-23T04:17:40Z   MEMBER      

Is your feature request related to a problem?

The defaults for concat are excessively permissive: data_vars="all", coords="different", compat="no_conflicts", join="outer". This comment illustrates why this can be hard to predict or understand: a seemingly unrelated option decode_cf controls whether a variable is in data_vars or coords, and can result in wildly different concatenation behaviour.

  1. This always concatenates data_vars along concat_dim even if they did not have that dimension to begin with.
  2. If the same coordinate var exists in different datasets/files, they will be sequentially compared for equality to decide whether they get concatenated.
  3. The outer join (applied along all dimensions that are not concat_dim) can result in very large datasets due to small floating points differences in the indexes, and also questionable behaviour with staggered grid datasets.
  4. "no_conflicts" basically picks the first not-NaN value after aligning all datasets, but is quite slow (we should be using duck_array_ops.nanfirst here I think).

While "convenient" this really just makes the default experience quite bad with hard-to-understand slowdowns.

Describe the solution you'd like

I propose we migrate to data_vars="minimal", coords="minimal", join="exact", compat="override". This should 1. only concatenate data_vars and coords variables when they already have concat_dim. 2. For any variables that do not have concat_dim, it will blindly pick them from the first file. 3. join="exact" will prevent ballooning of dimension sizes due to floating point inequalities. 4. These options will totally avoid any data reads unless explicitly requested by the user.

Unfortunately, this has a pretty big blast radius so we'd need a long deprecation cycle.

Describe alternatives you've considered

No response

Additional context

xref https://github.com/pydata/xarray/issues/4824 xref https://github.com/pydata/xarray/issues/1385 xref https://github.com/pydata/xarray/issues/8231 xref https://github.com/pydata/xarray/issues/5381 xref https://github.com/pydata/xarray/issues/2064 xref https://github.com/pydata/xarray/issues/2217

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8778/reactions",
    "total_count": 3,
    "+1": 3,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2135011804 I_kwDOAMm_X85_QbHc 8748 release v2024.02.0 dcherian 2448579 closed 0 keewis 14808389   0 2024-02-14T19:08:38Z 2024-02-18T22:52:15Z 2024-02-18T22:52:15Z MEMBER      

What is your issue?

Thanks to @keewis for volunteering at today's meeting :()

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8748/reactions",
    "total_count": 3,
    "+1": 0,
    "-1": 0,
    "laugh": 1,
    "hooray": 0,
    "confused": 0,
    "heart": 2,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2102852029 PR_kwDOAMm_X85lMXU0 8675 Fix NetCDF4 C version detection dcherian 2448579 closed 0     1 2024-01-26T20:23:54Z 2024-01-27T01:28:51Z 2024-01-27T01:28:49Z MEMBER   0 pydata/xarray/pulls/8675

This fixes the failure locally for me.

cc @max-sixty

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8675/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2098626592 PR_kwDOAMm_X85k-Mnt 8657 groupby: Don't set `method` by default on flox>=0.9 dcherian 2448579 closed 0     0 2024-01-24T16:20:57Z 2024-01-26T16:54:25Z 2024-01-26T16:54:23Z MEMBER   0 pydata/xarray/pulls/8657
  • [x] Tests added
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8657/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2064313690 I_kwDOAMm_X857Cu1a 8580 add py3.12 CI and update pyproject.toml dcherian 2448579 closed 0     2 2024-01-03T16:26:47Z 2024-01-17T21:54:13Z 2024-01-17T21:54:13Z MEMBER      

What is your issue?

We haven't done this yet! https://github.com/pydata/xarray/blob/d87ba61c957fc3af77251ca6db0f6bccca1acb82/pyproject.toml#L11-L15

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8580/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2086607437 I_kwDOAMm_X858XxpN 8616 new release 2024.01.0 dcherian 2448579 closed 0     0 2024-01-17T17:03:20Z 2024-01-17T19:21:12Z 2024-01-17T19:21:12Z MEMBER      

What is your issue?

Thanks @TomNicholas for volunteering to drive this release!

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8616/reactions",
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 1,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
638947370 MDU6SXNzdWU2Mzg5NDczNzA= 4156 writing sparse to netCDF dcherian 2448579 open 0     7 2020-06-15T15:33:23Z 2024-01-09T10:14:00Z   MEMBER      

I haven't looked at this too closely but it appears that this is a way to save MultiIndexed datasets to netCDF. So we may be able to do sparse -> multiindex -> netCDF

http://cfconventions.org/Data/cf-conventions/cf-conventions-1.8/cf-conventions.html#compression-by-gathering

cc @fujiisoup

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/4156/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2021763059 PR_kwDOAMm_X85g8iNJ 8507 Deprecate `squeeze` in GroupBy. dcherian 2448579 closed 0     2 2023-12-02T00:21:43Z 2024-01-08T03:08:47Z 2024-01-08T01:05:23Z MEMBER   0 pydata/xarray/pulls/8507
  • [x] xref #2157, xref #1460
  • [x] Closes #8518, closes #8263
  • [x] Tests added
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8507/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2065788086 PR_kwDOAMm_X85jOw74 8585 Enable Zarr V3 tests in all CI runs. dcherian 2448579 closed 0     0 2024-01-04T14:45:44Z 2024-01-05T17:53:08Z 2024-01-05T17:53:06Z MEMBER   0 pydata/xarray/pulls/8585

🤦🏾‍♂️

Spotted in https://github.com/pydata/xarray/pull/8460

Builds on #8586

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8585/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2064420057 I_kwDOAMm_X857DIzZ 8581 bump min versions dcherian 2448579 closed 0     0 2024-01-03T17:45:10Z 2024-01-05T16:13:16Z 2024-01-05T16:13:15Z MEMBER      

What is your issue?

Looks like we can bump a number of min versions: ``` Package Required Policy Status


cartopy 0.20 (2021-09-17) 0.21 (2022-09-10) < dask-core 2022.7 (2022-07-08) 2022.12 (2022-12-02) < distributed 2022.7 (2022-07-08) 2022.12 (2022-12-02) < flox 0.5 (2022-05-03) 0.6 (2022-10-12) < iris 3.2 (2022-02-15) 3.4 (2022-12-01) < matplotlib-base 3.5 (2021-11-18) 3.6 (2022-09-16) < numba 0.55 (2022-01-14) 0.56 (2022-09-28) < numpy 1.22 (2022-01-03) 1.23 (2022-06-23) < packaging 21.3 (2021-11-18) 22.0 (2022-12-08) < pandas 1.4 (2022-01-22) 1.5 (2022-09-19) < scipy 1.8 (2022-02-06) 1.9 (2022-07-30) < seaborn 0.11 (2020-09-08) 0.12 (2022-09-06) < typing_extensions 4.3 (2022-07-01) 4.4 (2022-10-07) < zarr 2.12 (2022-06-23) 2.13 (2022-09-27) < ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8581/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2065809896 PR_kwDOAMm_X85jO1oX 8586 Bump min deps. dcherian 2448579 closed 0     0 2024-01-04T14:59:05Z 2024-01-05T16:13:16Z 2024-01-05T16:13:14Z MEMBER   0 pydata/xarray/pulls/8586
  • [x] Closes #8581
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8586/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2066129022 PR_kwDOAMm_X85jP678 8587 Silence another warning in test_backends.py dcherian 2448579 closed 0     1 2024-01-04T18:20:49Z 2024-01-05T16:13:05Z 2024-01-05T16:13:03Z MEMBER   0 pydata/xarray/pulls/8587

Using 255 as fillvalue for int8 arrays will not be allowed any more. Previously this overflowed to -1. Now specify that instead.

On numpy 1.24.4 ```

np.array([255], dtype="i1") DeprecationWarning: NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future.

array([-1], dtype=int8) ```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8587/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2052694433 PR_kwDOAMm_X85ilhQm 8565 Faster encoding functions. dcherian 2448579 closed 0     1 2023-12-21T16:05:02Z 2024-01-04T14:25:45Z 2024-01-04T14:25:43Z MEMBER   0 pydata/xarray/pulls/8565

Spotted when profiling some write workloads. 1. Speeds up the check for multi-index 2. Speeds up one string encoder by not re-creating variables when not necessary.

@benbovy is there a better way?

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8565/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2064480451 I_kwDOAMm_X857DXjD 8582 Adopt SPEC 0 instead of NEP-29 dcherian 2448579 open 0     1 2024-01-03T18:36:24Z 2024-01-03T20:12:05Z   MEMBER      

What is your issue?

https://docs.xarray.dev/en/stable/getting-started-guide/installing.html#minimum-dependency-versions says that we follow NEP-29, and I think our min versions script also does that.

I propose we follow https://scientific-python.org/specs/spec-0000/

In practice, I think this means we mostly drop Python versions earlier.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8582/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
1976752481 PR_kwDOAMm_X85ekPdj 8412 Minimize duplication in `map_blocks` task graph dcherian 2448579 closed 0     7 2023-11-03T18:30:02Z 2024-01-03T04:10:17Z 2024-01-03T04:10:15Z MEMBER   0 pydata/xarray/pulls/8412

Builds on #8560

  • [x] Closes #8409
  • [x] Tests added
  • [ ] User visible changes (including notable bug fixes) are documented in whats-new.rst

cc @max-sixty

``` print(len(cloudpickle.dumps(da.chunk(lat=1, lon=1).map_blocks(lambda x: x))))

779354739 -> 47699827

print(len(cloudpickle.dumps(da.chunk(lat=1, lon=1).drop_vars(da.indexes).map_blocks(lambda x: x))))

15981508

```

This is a quick attempt. I think we can generalize this to minimize duplication.

The downside is that the graphs are not totally embarrassingly parallel any more. This PR:

vs main:

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8412/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2052952379 I_kwDOAMm_X856XZE7 8568 Raise when assigning attrs to virtual variables (default coordinate arrays) dcherian 2448579 open 0     0 2023-12-21T19:24:11Z 2023-12-21T19:24:19Z   MEMBER      

Discussed in https://github.com/pydata/xarray/discussions/8567

<sup>Originally posted by **matthew-brett** December 21, 2023</sup> Sorry for the introductory question, but we (@ivanov and I) ran into this behavior while experimenting: ```python import numpy as np data = np.zeros((3, 4, 5)) ds = xr.DataArray(data, dims=('i', 'j', 'k')) print(ds['k'].attrs) ``` This shows `{}` as we might reasonably expect. But then: ```python ds['k'].attrs['foo'] = 'bar' print(ds['k'].attrs) ``` This also gives `{}`, which we found surprising. We worked out why that was, after a little experimentation (the default coordinate arrays seems to get created on the fly and garbage collected immediately). But it took us a little while. Is that as intended? Is there a way of making this less confusing? Thanks for any help.
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8568/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2052610515 PR_kwDOAMm_X85ilOq9 8564 Fix mypy type ignore dcherian 2448579 closed 0     1 2023-12-21T15:15:26Z 2023-12-21T15:41:13Z 2023-12-21T15:24:52Z MEMBER   0 pydata/xarray/pulls/8564  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8564/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2047617215 PR_kwDOAMm_X85iUJ7y 8560 Adapt map_blocks to use new Coordinates API dcherian 2448579 closed 0     0 2023-12-18T23:11:55Z 2023-12-20T17:11:18Z 2023-12-20T17:11:16Z MEMBER   0 pydata/xarray/pulls/8560

Fixes roundtripping of string dtype indexes

  • [x] Tests added
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8560/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1954809370 I_kwDOAMm_X850hAYa 8353 Update benchmark suite for asv 0.6.1 dcherian 2448579 open 0     0 2023-10-20T18:13:22Z 2023-12-19T05:53:21Z   MEMBER      

The new asv version comes with decorators for parameterizing and skipping, and the ability to use mamba to create environments.

https://github.com/airspeed-velocity/asv/releases

https://asv.readthedocs.io/en/v0.6.1/writing_benchmarks.html#skipping-benchmarks

This might help us reduce benchmark times a bit, or at least simplify the code some.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8353/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2027147099 I_kwDOAMm_X854089b 8523 tree-reduce the combine for `open_mfdataset(..., parallel=True, combine="nested")` dcherian 2448579 open 0     4 2023-12-05T21:24:51Z 2023-12-18T19:32:39Z   MEMBER      

Is your feature request related to a problem?

When parallel=True and a distributed client is active, Xarray reads every file in parallel, constructs a Dataset per file with indexed coordinates loaded, and then sends all of that back to the "head node" for the combine.

Instead we can tree-reduce the combine (example) by switching to dask.bag instead of dask.delayed and skip the overhead of shipping 1000s of copies of an indexed coordinate back to the head node.

  1. The downside is the dask graph is "worse" but perhaps that shouldn't stop us.
  2. I think this is only feasible for combine="nested"

cc @TomNicholas

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8523/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
2033054792 PR_kwDOAMm_X85hi5U2 8532 Whats-new for 2023.12.0 dcherian 2448579 closed 0     0 2023-12-08T17:29:47Z 2023-12-08T19:36:28Z 2023-12-08T19:36:26Z MEMBER   0 pydata/xarray/pulls/8532
  • [ ] 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/8532/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2021754904 PR_kwDOAMm_X85g8gnU 8506 Deprecate `squeeze` in GroupBy. dcherian 2448579 closed 0     1 2023-12-02T00:08:50Z 2023-12-02T00:13:36Z 2023-12-02T00:13:36Z MEMBER   0 pydata/xarray/pulls/8506
  • [x] Closes #2157
  • [ ] Tests added
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst

Could use a close-ish review.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8506/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1989588884 I_kwDOAMm_X852lreU 8448 mypy 1.7.0 raising errors dcherian 2448579 closed 0     0 2023-11-12T21:41:43Z 2023-12-01T22:02:22Z 2023-12-01T22:02:22Z MEMBER      

What happened?

xarray/namedarray/core.py:758: error: Value of type Never is not indexable [index] xarray/core/alignment.py:684: error: Unused "type: ignore" comment [unused-ignore] xarray/core/alignment.py:1156: error: Unused "type: ignore" comment [unused-ignore] xarray/core/dataset.py: note: In member "sortby" of class "Dataset": xarray/core/dataset.py:7967: error: Incompatible types in assignment (expression has type "tuple[Alignable, ...]", variable has type "tuple[DataArray, ...]") [assignment] xarray/core/dataset.py:7979: error: "Alignable" has no attribute "isel" [attr-defined]

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8448/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
2003229011 PR_kwDOAMm_X85f9xPG 8472 Avoid duplicate Zarr array read dcherian 2448579 closed 0     0 2023-11-21T00:16:34Z 2023-12-01T02:58:22Z 2023-12-01T02:47:03Z MEMBER   0 pydata/xarray/pulls/8472

We already get the underlying Zarr array in https://github.com/pydata/xarray/blob/bb8511e0894020e180d95d2edb29ed4036ac6447/xarray/backends/zarr.py#L529-L531

and then pass it to open_store_variable. Just pass that array down to ZarrArrayWrapper instead of reading it from the datastore again.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8472/reactions",
    "total_count": 2,
    "+1": 2,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
2015530249 PR_kwDOAMm_X85gnO8L 8489 Minor to_zarr optimizations dcherian 2448579 closed 0     0 2023-11-28T23:56:32Z 2023-12-01T02:20:19Z 2023-12-01T02:18:18Z MEMBER   0 pydata/xarray/pulls/8489

Avoid repeatedly pinging a remote store by requesting keys at one go.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8489/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1615596004 I_kwDOAMm_X85gTAnk 7596 illustrate time offset arithmetic dcherian 2448579 closed 0     2 2023-03-08T16:54:15Z 2023-11-29T01:31:45Z 2023-11-29T01:31:45Z MEMBER      

Is your feature request related to a problem?

We should document changing the time vector using pandas date offsets here

This is particularly useful for centering the time stamps after a resampling operation.

Related: - CFTime offsets: https://github.com/pydata/xarray/issues/5687 - loffset deprecation: https://github.com/pydata/xarray/pull/7444

Describe the solution you'd like

No response

Describe alternatives you've considered

No response

Additional context

No response

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7596/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
1997656427 PR_kwDOAMm_X85frEdb 8461 2023.11.0 Whats-new dcherian 2448579 closed 0     0 2023-11-16T19:55:12Z 2023-11-17T21:02:22Z 2023-11-17T21:02:20Z MEMBER   0 pydata/xarray/pulls/8461  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8461/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1997136566 PR_kwDOAMm_X85fpRL3 8458 Pin mypy < 1.7 dcherian 2448579 closed 0     0 2023-11-16T15:31:26Z 2023-11-16T17:29:04Z 2023-11-16T17:29:03Z MEMBER   0 pydata/xarray/pulls/8458

xref #8448 get back to green checks for now.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8458/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1995186323 PR_kwDOAMm_X85finmE 8452 [skip-ci] Small updates to IO docs. dcherian 2448579 closed 0     0 2023-11-15T17:05:47Z 2023-11-16T15:19:59Z 2023-11-16T15:19:57Z MEMBER   0 pydata/xarray/pulls/8452

Also fixes the RTD failure on main

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8452/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1989227042 PR_kwDOAMm_X85fObtL 8445 Pin pint to >=0.22 dcherian 2448579 closed 0     3 2023-11-12T03:58:40Z 2023-11-13T19:39:54Z 2023-11-13T19:39:53Z MEMBER   0 pydata/xarray/pulls/8445
  • [x] Closes https://github.com/pydata/xarray/issues/7971
  • [x] Closes https://github.com/pydata/xarray/issues/8437.

We were previously pinned to <0.21 Removing the pin didn't change the env but with >=0.21 we get 0.22 which works.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8445/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1989212292 PR_kwDOAMm_X85fOYwT 8444 Remove keep_attrs from resample signature dcherian 2448579 closed 0     1 2023-11-12T02:57:59Z 2023-11-12T22:53:36Z 2023-11-12T22:53:35Z MEMBER   0 pydata/xarray/pulls/8444
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8444/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1635949876 PR_kwDOAMm_X85MpxlL 7659 Redo whats-new for 2023.03.0 dcherian 2448579 closed 0     0 2023-03-22T15:02:38Z 2023-11-06T04:25:54Z 2023-03-22T15:42:49Z MEMBER   0 pydata/xarray/pulls/7659  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7659/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1630533356 PR_kwDOAMm_X85MXo4e 7643 Whats-new for release 2023.03.0 dcherian 2448579 closed 0     0 2023-03-18T19:14:55Z 2023-11-06T04:25:53Z 2023-03-20T15:57:36Z MEMBER   0 pydata/xarray/pulls/7643  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7643/reactions",
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 1,
    "eyes": 0
}
    xarray 13221727 pull
1471673992 PR_kwDOAMm_X85EFDiU 7343 Fix mypy failures dcherian 2448579 closed 0     1 2022-12-01T17:16:44Z 2023-11-06T04:25:52Z 2022-12-01T18:25:07Z MEMBER   0 pydata/xarray/pulls/7343  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7343/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1533942791 PR_kwDOAMm_X85HahUq 7440 v2023.01.0 whats-new dcherian 2448579 closed 0     0 2023-01-15T18:20:28Z 2023-11-06T04:25:52Z 2023-01-18T21:18:49Z MEMBER   0 pydata/xarray/pulls/7440

Should update the date and delete empty sections before merging

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7440/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1942666419 PR_kwDOAMm_X85cxojc 8304 Move Variable aggregations to NamedArray dcherian 2448579 closed 0     6 2023-10-13T21:31:01Z 2023-11-06T04:25:43Z 2023-10-17T19:14:12Z MEMBER   0 pydata/xarray/pulls/8304
  • [x] fix breaking attrs test
  • [x] Look at numeric_only in NAMED_ARRAY_OBJECT
  • xref #8238
  • [ ] Tests added
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8304/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1689364566 PR_kwDOAMm_X85PbeOv 7796 Speed up .dt accessor by preserving Index objects. dcherian 2448579 closed 0     1 2023-04-29T04:22:10Z 2023-11-06T04:25:42Z 2023-05-16T17:55:48Z MEMBER   0 pydata/xarray/pulls/7796
  • [ ] 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/7796/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1973472421 PR_kwDOAMm_X85eZF4x 8400 Better attr diff for `testing.assert_identical` dcherian 2448579 closed 0     2 2023-11-02T04:15:09Z 2023-11-04T20:25:37Z 2023-11-04T20:25:36Z MEMBER   0 pydata/xarray/pulls/8400
  • [ ] User visible changes (including notable bug fixes) are documented in whats-new.rst

This gives us better reprs where only differing attributes are shown in the diff.

On main: ... Differing coordinates: L * x (x) <U1 'a' 'b' foo: bar same: same R * x (x) <U1 'a' 'c' source: 0 foo: baz same: same ...

With this PR: ``` Differing coordinates: L * x (x) %cU1 'a' 'b' Differing variable attributes: foo: bar R * x (x) %cU1 'a' 'c' Differing variable attributes: source: 0 foo: baz

```

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8400/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1975400777 PR_kwDOAMm_X85efqSl 8408 Generalize explicit_indexing_adapter dcherian 2448579 open 0     0 2023-11-03T03:29:40Z 2023-11-03T03:53:25Z   MEMBER   1 pydata/xarray/pulls/8408

Use as_indexable instead of NumpyIndexingAdapter

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8408/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1950211465 I_kwDOAMm_X850Pd2J 8333 Should NamedArray be interchangeable with other array types? or Should we support the `axis` kwarg? dcherian 2448579 open 0     17 2023-10-18T16:46:37Z 2023-10-31T22:26:33Z   MEMBER      

What is your issue?

Raising @Illviljan's comment from https://github.com/pydata/xarray/pull/8304#discussion_r1363196597.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8333/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
1962040911 PR_kwDOAMm_X85dyZBT 8373 Use `opt_einsum` by default if installed. dcherian 2448579 closed 0     2 2023-10-25T18:59:38Z 2023-10-28T03:31:07Z 2023-10-28T03:31:05Z MEMBER   0 pydata/xarray/pulls/8373
  • [x] Closes #7764
  • [x] Closes #8017
  • [x] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8373/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1672288892 I_kwDOAMm_X85jrRp8 7764 Support opt_einsum in xr.dot dcherian 2448579 closed 0     7 2023-04-18T03:29:48Z 2023-10-28T03:31:06Z 2023-10-28T03:31:06Z MEMBER      

Is your feature request related to a problem?

Shall we support opt_einsum as an optional backend for xr.dot?

opt_einsum.contract is a drop-in replacement for np.einsum so this monkey-patch works today xr.core.duck_array_ops.einsum = opt_einsum.contract

Describe the solution you'd like

Add a backend kwarg with options "numpy" and "opt_einsum", with the default being "numpy"

Describe alternatives you've considered

We could create a new package but it seems a bit silly.

Additional context

No response

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/7764/reactions",
    "total_count": 3,
    "+1": 3,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
  completed xarray 13221727 issue
1952621896 I_kwDOAMm_X850YqVI 8337 Support rolling with numbagg dcherian 2448579 open 0     3 2023-10-19T16:11:40Z 2023-10-23T15:46:36Z   MEMBER      

Is your feature request related to a problem?

We can do plain reductions, and groupby reductions with numbagg. Rolling is the last one left!

I don't think coarsen will benefit since it's basically a reshape and reduce on that view, so it should already be accelerated. There may be small gains in handling the boundary conditions but that's probably it.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8337/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
1954445639 I_kwDOAMm_X850fnlH 8350 optimize align for scalars at least dcherian 2448579 open 0     5 2023-10-20T14:48:25Z 2023-10-20T19:17:39Z   MEMBER      

What happened?

Here's a simple rescaling calculation: ```python import numpy as np import xarray as xr

ds = xr.Dataset( {"a": (("x", "y"), np.ones((300, 400))), "b": (("x", "y"), np.ones((300, 400)))} ) mean = ds.mean() # scalar std = ds.std() # scalar rescaled = (ds - mean) / std ```

The profile for the last line shows 30% (!!!) time spent in align (really reindex_like) except there's nothing to reindex when only scalars are involved!

This is a small example inspired by a ML pipeline where this normalization is happening very many times in a tight loop.

cc @benbovy

What did you expect to happen?

A fast path for when no reindexing needs to happen.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8350/reactions",
    "total_count": 1,
    "+1": 1,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
1954535213 PR_kwDOAMm_X85dZT47 8351 [skip-ci] Add benchmarks for Dataset binary ops, chunk dcherian 2448579 closed 0     1 2023-10-20T15:31:36Z 2023-10-20T18:08:40Z 2023-10-20T18:08:38Z MEMBER   0 pydata/xarray/pulls/8351

xref #8339 xref #8350

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8351/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1954360112 PR_kwDOAMm_X85dYtpz 8349 [skip-ci] dev whats-new dcherian 2448579 closed 0     1 2023-10-20T14:02:07Z 2023-10-20T17:28:19Z 2023-10-20T14:54:30Z MEMBER   0 pydata/xarray/pulls/8349
  • [ ] 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/8349/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1950480317 PR_kwDOAMm_X85dLkAj 8334 Whats-new: 2023.10.0 dcherian 2448579 closed 0     1 2023-10-18T19:22:06Z 2023-10-19T16:00:00Z 2023-10-19T15:59:58Z MEMBER   0 pydata/xarray/pulls/8334  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8334/reactions",
    "total_count": 1,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 1,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1944347086 PR_kwDOAMm_X85c2nyz 8316 Enable numbagg for reductions dcherian 2448579 closed 0     3 2023-10-16T04:46:10Z 2023-10-18T14:54:48Z 2023-10-18T10:39:30Z MEMBER   0 pydata/xarray/pulls/8316
  • [ ] Tests added - check bottleneck tests
  • [ ] User visible changes (including notable bug fixes) are documented in whats-new.rst
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8316/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1861954973 PR_kwDOAMm_X85YhnBZ 8100 Remove np.asarray in formatting.py dcherian 2448579 closed 0     2 2023-08-22T18:08:33Z 2023-10-18T13:31:25Z 2023-10-18T10:40:38Z MEMBER   0 pydata/xarray/pulls/8100  
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8100/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1943543755 I_kwDOAMm_X85z2B_L 8310 pydata/xarray as monorepo for Xarray and NamedArray dcherian 2448579 open 0     1 2023-10-14T20:34:51Z 2023-10-14T21:29:11Z   MEMBER      

What is your issue?

As we work through refactoring for NamedArray, it's pretty clear that Xarray will depend pretty closely on many files in namedarray/. For example various utils.py, pycompat.py, *ops.py, formatting.py, formatting_html.py at least. This promises to be quite painful if we did break NamedArray out in to its own repo (particularly around typing, e.g. https://github.com/pydata/xarray/pull/8309)

I propose we use pydata/xarray as a monorepo that serves two packages: NamedArray and Xarray. - We can move as much as is needed to have NamedArray be independent of Xarray, but Xarray will depend quite closely on many utility functions in NamedArray. - We can release both at the same time similar to dask and distributed. - We can re-evaluate if and when NamedArray grows its own community.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8310/reactions",
    "total_count": 4,
    "+1": 4,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
1942673099 PR_kwDOAMm_X85cxp-D 8305 Update labeler.yml to add NamedArray dcherian 2448579 closed 0     0 2023-10-13T21:39:56Z 2023-10-14T06:47:08Z 2023-10-14T06:47:07Z MEMBER   0 pydata/xarray/pulls/8305
  • [ ] 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/8305/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 pull
1942893480 I_kwDOAMm_X85zzjOo 8306 keep_attrs for NamedArray dcherian 2448579 open 0     0 2023-10-14T02:29:54Z 2023-10-14T02:31:35Z   MEMBER      

What is your issue?

Copying over @max-sixty's comment from https://github.com/pydata/xarray/pull/8304#discussion_r1358873522

I haven't been in touch with the NameArray discussions so forgive a glib comment — but re https://github.com/pydata/xarray/issues/3891 — this would be a "once-in-a-library" opportunity to always retain attrs in aggregations, removing the keep_attrs option in methods.

(Xarray could still handle them as it wished, so xarray's external interface wouldn't need to change immediately...)

@pydata/xarray Should we just delete the keep_attrs kwarg completely for NamedArray and always propagate attrs? obj.attrs.clear() seems just as easy to type.

{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8306/reactions",
    "total_count": 4,
    "+1": 4,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue
1916012703 I_kwDOAMm_X85yNAif 8239 Address repo-review suggestions dcherian 2448579 open 0     7 2023-09-27T17:18:40Z 2023-10-02T20:24:34Z   MEMBER      

What is your issue?

Here's the output from the Scientific Python Repo Review tool.

There's an online version here.

On mac I run pipx run 'sp-repo-review[cli]' --format html --show err gh:pydata/xarray@main | pbcopy

A lot of these seem fairly easy to fix. I'll note that there's a large number of mypy config suggestions.

General

  • Detected build backend: setuptools.build_meta
  • Detected license(s): Apache Software License
<table> <tr><th>?</th><th>Name</th><th>Description</th></tr> <tr style="color: red;"> <td>❌</td> <td>PY007</td> <td> Supports an easy task runner (nox or tox)

Projects must have a noxfile.py or tox.ini to encourage new contributors.

</td> </tr> </table>

PyProject

See https://github.com/pydata/xarray/issues/8239#issuecomment-1739363809

<table> <tr><th>?</th><th>Name</th><th>Description</th></tr> <tr style="color: red;"> <td>❌</td> <td>PP305</td> <td> Specifies xfail_strict

xfail_strict should be set. You can manually specify if a check should be strict when setting each xfail.

[tool.pytest.ini_options]
xfail_strict = true
</td> </tr> <tr style="color: red;"> <td>❌</td> <td>PP308</td> <td> Specifies useful pytest summary

-ra should be in addopts = [...] (print summary of all fails/errors).

[tool.pytest.ini_options]
addops = ["-ra", "--strict-config", "--strict-markers"]
</td> </tr> </table>

Pre-commit

<table> <tr><th>?</th><th>Name</th><th>Description</th></tr> <tr style="color: red;"> <td>❌</td> <td>PC110</td> <td> Uses black

Use https://github.com/psf/black-pre-commit-mirror instead of https://github.com/psf/black in .pre-commit-config.yaml

</td> </tr> <tr style="color: red;"> <td>❌</td> <td>PC160</td> <td> Uses codespell

Must have https://github.com/codespell-project/codespell repo in .pre-commit-config.yaml

</td> </tr> <tr style="color: red;"> <td>❌</td> <td>PC170</td> <td> Uses PyGrep hooks (only needed if RST present)

Must have https://github.com/pre-commit/pygrep-hooks repo in .pre-commit-config.yaml

</td> </tr> <tr style="color: red;"> <td>❌</td> <td>PC180</td> <td> Uses prettier

Must have https://github.com/pre-commit/mirrors-prettier repo in .pre-commit-config.yaml

</td> </tr> <tr style="color: red;"> <td>❌</td> <td>PC191</td> <td> Ruff show fixes if fixes enabled

If --fix is present, --show-fixes must be too.

</td> </tr> <tr style="color: red;"> <td>❌</td> <td>PC901</td> <td> Custom pre-commit CI message

Should have something like this in .pre-commit-config.yaml:

ci:
  autoupdate_commit_msg: 'chore: update pre-commit hooks'
</td> </tr> </table>

MyPy

<table> <tr><th>?</th><th>Name</th><th>Description</th></tr> <tr style="color: red;"> <td>❌</td> <td>MY101</td> <td> MyPy strict mode

Must have strict in the mypy config. MyPy is best with strict or nearly strict configuration. If you are happy with the strictness of your settings already, ignore this check or set strict = false explicitly.

[tool.mypy]
strict = true
</td> </tr> <tr style="color: red;"> <td>❌</td> <td>MY103</td> <td> MyPy warn unreachable

Must have warn_unreachable = true to pass this check. There are occasionally false positives (often due to platform or Python version static checks), so it's okay to ignore this check. But try it first - it can catch real bugs too.

[tool.mypy]
warn_unreachable = true
</td> </tr> <tr style="color: red;"> <td>❌</td> <td>MY104</td> <td> MyPy enables ignore-without-code

Must have "ignore-without-code" in enable_error_code = [...]. This will force all skips in your project to include the error code, which makes them more readable, and avoids skipping something unintended.

[tool.mypy]
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
</td> </tr> <tr style="color: red;"> <td>❌</td> <td>MY105</td> <td> MyPy enables redundant-expr

Must have "redundant-expr" in enable_error_code = [...]. This helps catch useless lines of code, like checking the same condition twice.

[tool.mypy]
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
</td> </tr> <tr style="color: red;"> <td>❌</td> <td>MY106</td> <td> MyPy enables truthy-bool

Must have "truthy-bool" in enable_error_code = []. This catches mistakes in using a value as truthy if it cannot be falsey.

[tool.mypy]
enable_error_code = ["ignore-without-code", "redundant-expr", "truthy-bool"]
</td> </tr> </table>

Ruff

<table> <tr><th>?</th><th>Name</th><th>Description</th></tr> <tr style="color: red;"> <td>❌</td> <td>RF101</td> <td> Bugbear must be selected

Must select the flake8-bugbear B checks. Recommended:

[tool.ruff]
select = [
  "B",  # flake8-bugbear
]
</td> </tr> </table>
{
    "url": "https://api.github.com/repos/pydata/xarray/issues/8239/reactions",
    "total_count": 0,
    "+1": 0,
    "-1": 0,
    "laugh": 0,
    "hooray": 0,
    "confused": 0,
    "heart": 0,
    "rocket": 0,
    "eyes": 0
}
    xarray 13221727 issue

Next page

Advanced export

JSON shape: default, array, newline-delimited, object

CSV options:

CREATE TABLE [issues] (
   [id] INTEGER PRIMARY KEY,
   [node_id] TEXT,
   [number] INTEGER,
   [title] TEXT,
   [user] INTEGER REFERENCES [users]([id]),
   [state] TEXT,
   [locked] INTEGER,
   [assignee] INTEGER REFERENCES [users]([id]),
   [milestone] INTEGER REFERENCES [milestones]([id]),
   [comments] INTEGER,
   [created_at] TEXT,
   [updated_at] TEXT,
   [closed_at] TEXT,
   [author_association] TEXT,
   [active_lock_reason] TEXT,
   [draft] INTEGER,
   [pull_request] TEXT,
   [body] TEXT,
   [reactions] TEXT,
   [performed_via_github_app] TEXT,
   [state_reason] TEXT,
   [repo] INTEGER REFERENCES [repos]([id]),
   [type] TEXT
);
CREATE INDEX [idx_issues_repo]
    ON [issues] ([repo]);
CREATE INDEX [idx_issues_milestone]
    ON [issues] ([milestone]);
CREATE INDEX [idx_issues_assignee]
    ON [issues] ([assignee]);
CREATE INDEX [idx_issues_user]
    ON [issues] ([user]);
Powered by Datasette · Queries took 1521.988ms · About: xarray-datasette