Skip to content
forked from pydata/xarray

Commit 5c9f291

Browse files
committed
Merge branch 'main' into flox-preserve-dtype
* main: (26 commits) Forbid modifying names of DataTree objects with parents (pydata#9494) DAS-2155 - Merge datatree documentation into main docs. (pydata#9033) Make illegal path-like variable names when constructing a DataTree from a Dataset (pydata#9378) Ensure TreeNode doesn't copy in-place (pydata#9482) `open_groups` for zarr backends (pydata#9469) Update pyproject.toml (pydata#9484) New whatsnew section (pydata#9483) Release notes for v2024.09.0 (pydata#9480) Fix `DataTree.coords.__setitem__` by adding `DataTreeCoordinates` class (pydata#9451) Rename DataTree's "ds" and "data" to "dataset" (pydata#9476) Update DataTree repr to indicate inheritance (pydata#9470) Bump pypa/gh-action-pypi-publish in the actions group (pydata#9460) Repo checker (pydata#9450) Add days_in_year and decimal_year to dt accessor (pydata#9105) remove parent argument from DataTree.__init__ (pydata#9465) Fix inheritance in DataTree.copy() (pydata#9457) Implement `DataTree.__delitem__` (pydata#9453) Add ASV for datatree.from_dict (pydata#9459) Make the first argument in DataTree.from_dict positional only (pydata#9446) Fix typos across the code, doc and comments (pydata#9443) ...
2 parents eebb067 + 8db6bc9 commit 5c9f291

File tree

150 files changed

+3342
-4385
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

150 files changed

+3342
-4385
lines changed

.github/workflows/ci-additional.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,7 @@ jobs:
8181
#
8282
# If dependencies emit warnings we can't do anything about, add ignores to
8383
# `xarray/tests/__init__.py`.
84-
# [MHS, 01/25/2024] Skip datatree_ documentation remove after #8572
85-
python -m pytest --doctest-modules xarray --ignore xarray/tests --ignore xarray/datatree_ -Werror
84+
python -m pytest --doctest-modules xarray --ignore xarray/tests -Werror
8685
8786
mypy:
8887
name: Mypy

.github/workflows/pypi-release.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ jobs:
8888
path: dist
8989
- name: Publish package to TestPyPI
9090
if: github.event_name == 'push'
91-
uses: pypa/[email protected].0
91+
uses: pypa/[email protected].1
9292
with:
9393
repository_url: https://test.pypi.org/legacy/
9494
verbose: true
@@ -111,6 +111,6 @@ jobs:
111111
name: releases
112112
path: dist
113113
- name: Publish package to PyPI
114-
uses: pypa/[email protected].0
114+
uses: pypa/[email protected].1
115115
with:
116116
verbose: true

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# https://pre-commit.com/
22
ci:
33
autoupdate_schedule: monthly
4-
exclude: 'xarray/datatree_.*'
4+
autoupdate_commit_msg: 'Update pre-commit hooks'
55
repos:
66
- repo: https://github.com/pre-commit/pre-commit-hooks
77
rev: v4.6.0

MANIFEST.in

-2
This file was deleted.

asv_bench/benchmarks/dataset_io.py

+4-6
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
import pandas as pd
88

99
import xarray as xr
10-
from xarray.backends.api import open_datatree
11-
from xarray.core.datatree import DataTree
1210

1311
from . import _skip_slow, parameterized, randint, randn, requires_dask
1412

@@ -556,7 +554,7 @@ def make_datatree(self, nchildren=10):
556554
for group in range(self.nchildren)
557555
}
558556
dtree = root | nested_tree1 | nested_tree2 | nested_tree3
559-
self.dtree = DataTree.from_dict(dtree)
557+
self.dtree = xr.DataTree.from_dict(dtree)
560558

561559

562560
class IOReadDataTreeNetCDF4(IONestedDataTree):
@@ -574,10 +572,10 @@ def setup(self):
574572
dtree.to_netcdf(filepath=self.filepath)
575573

576574
def time_load_datatree_netcdf4(self):
577-
open_datatree(self.filepath, engine="netcdf4").load()
575+
xr.open_datatree(self.filepath, engine="netcdf4").load()
578576

579577
def time_open_datatree_netcdf4(self):
580-
open_datatree(self.filepath, engine="netcdf4")
578+
xr.open_datatree(self.filepath, engine="netcdf4")
581579

582580

583581
class IOWriteNetCDFDask:
@@ -724,7 +722,7 @@ class PerformanceBackend(xr.backends.BackendEntrypoint):
724722
def open_dataset(
725723
self,
726724
filename_or_obj: str | os.PathLike | None,
727-
drop_variables: tuple[str] = None,
725+
drop_variables: tuple[str, ...] = None,
728726
*,
729727
mask_and_scale=True,
730728
decode_times=True,

asv_bench/benchmarks/datatree.py

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import xarray as xr
2+
from xarray.core.datatree import DataTree
3+
4+
5+
class Datatree:
6+
def setup(self):
7+
run1 = DataTree.from_dict({"run1": xr.Dataset({"a": 1})})
8+
self.d_few = {"run1": run1}
9+
self.d_many = {f"run{i}": xr.Dataset({"a": 1}) for i in range(100)}
10+
11+
def time_from_dict_few(self):
12+
DataTree.from_dict(self.d_few)
13+
14+
def time_from_dict_many(self):
15+
DataTree.from_dict(self.d_many)

asv_bench/benchmarks/groupby.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def setup(self, use_cftime, use_flox):
174174
# GH9426 - deep-copying CFTime object arrays is weirdly slow
175175
asda = xr.DataArray(time)
176176
labeled_time = []
177-
for year, month in zip(asda.dt.year, asda.dt.month):
177+
for year, month in zip(asda.dt.year, asda.dt.month, strict=True):
178178
labeled_time.append(cftime.datetime(year, month, 1))
179179

180180
self.da = xr.DataArray(

asv_bench/benchmarks/rolling.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def time_rolling_long(self, func, pandas, use_bottleneck):
6464
def time_rolling_np(self, window_, min_periods, use_bottleneck):
6565
with xr.set_options(use_bottleneck=use_bottleneck):
6666
self.ds.rolling(x=window_, center=False, min_periods=min_periods).reduce(
67-
getattr(np, "nansum")
67+
np.nansum
6868
).load()
6969

7070
@parameterized(

ci/requirements/bare-minimum.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@ dependencies:
1111
- pytest-env
1212
- pytest-xdist
1313
- pytest-timeout
14-
- numpy=1.23
14+
- numpy=1.24
1515
- packaging=23.1
16-
- pandas=2.0
16+
- pandas=2.1

ci/requirements/doc.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ dependencies:
3939
- sphinx-copybutton
4040
- sphinx-design
4141
- sphinx-inline-tabs
42-
- sphinx>=5.0
42+
- sphinx>=5.0,<7.0 # https://github.com/executablebooks/sphinx-book-theme/issues/749
43+
- sphinxcontrib-srclinks
4344
- sphinx-remove-toctrees
4445
- sphinxext-opengraph
4546
- sphinxext-rediraffe

ci/requirements/min-all-deps.yml

+12-12
Original file line numberDiff line numberDiff line change
@@ -9,37 +9,37 @@ dependencies:
99
# doc/user-guide/installing.rst, doc/user-guide/plotting.rst and setup.py.
1010
- python=3.10
1111
- array-api-strict=1.0 # dependency for testing the array api compat
12-
- boto3=1.26
12+
- boto3=1.28
1313
- bottleneck=1.3
14-
- cartopy=0.21
14+
- cartopy=0.22
1515
- cftime=1.6
1616
- coveralls
17-
- dask-core=2023.4
18-
- distributed=2023.4
17+
- dask-core=2023.9
18+
- distributed=2023.9
1919
# Flox > 0.8 has a bug with numbagg versions
2020
# It will require numbagg > 0.6
2121
# so we should just skip that series eventually
2222
# or keep flox pinned for longer than necessary
2323
- flox=0.7
24-
- h5netcdf=1.1
24+
- h5netcdf=1.2
2525
# h5py and hdf5 tend to cause conflicts
2626
# for e.g. hdf5 1.12 conflicts with h5py=3.1
2727
# prioritize bumping other packages instead
2828
- h5py=3.8
2929
- hdf5=1.12
3030
- hypothesis
31-
- iris=3.4
31+
- iris=3.7
3232
- lxml=4.9 # Optional dep of pydap
3333
- matplotlib-base=3.7
3434
- nc-time-axis=1.4
3535
# netcdf follows a 1.major.minor[.patch] convention
3636
# (see https://github.com/Unidata/netcdf4-python/issues/1090)
3737
- netcdf4=1.6.0
38-
- numba=0.56
38+
- numba=0.57
3939
- numbagg=0.2.1
40-
- numpy=1.23
40+
- numpy=1.24
4141
- packaging=23.1
42-
- pandas=2.0
42+
- pandas=2.1
4343
- pint=0.22
4444
- pip
4545
- pydap=3.4
@@ -49,9 +49,9 @@ dependencies:
4949
- pytest-xdist
5050
- pytest-timeout
5151
- rasterio=1.3
52-
- scipy=1.10
52+
- scipy=1.11
5353
- seaborn=0.12
5454
- sparse=0.14
5555
- toolz=0.12
56-
- typing_extensions=4.5
57-
- zarr=2.14
56+
- typing_extensions=4.7
57+
- zarr=2.16

design_notes/flexible_indexes_notes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ An `XarrayIndex` subclass must/should/may implement the following properties/met
7171
- a `data` property to access index's data and map it to coordinate data (see [Section 4](#4-indexvariable))
7272
- a `__getitem__()` implementation to propagate the index through DataArray/Dataset indexing operations
7373
- `equals()`, `union()` and `intersection()` methods for data alignment (see [Section 2.6](#26-using-indexes-for-data-alignment))
74-
- Xarray coordinate getters (see [Section 2.2.4](#224-implicit-coodinates))
74+
- Xarray coordinate getters (see [Section 2.2.4](#224-implicit-coordinates))
7575
- a method that may return a new index and that will be called when one of the corresponding coordinates is dropped from the Dataset/DataArray (multi-coordinate indexes)
7676
- `encode()`/`decode()` methods that would allow storage-agnostic serialization and fast-path reconstruction of the underlying index object(s) (see [Section 2.8](#28-index-encoding))
7777
- one or more "non-standard" methods or properties that could be leveraged in Xarray 3rd-party extensions like Dataset/DataArray accessors (see [Section 2.7](#27-using-indexes-for-other-purposes))

design_notes/grouper_objects.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ where `|` represents chunk boundaries. A simple rechunking to
166166
```
167167
000|111122|3333
168168
```
169-
would make this resampling reduction an embarassingly parallel blockwise problem.
169+
would make this resampling reduction an embarrassingly parallel blockwise problem.
170170

171171
Similarly consider monthly-mean climatologies for which the month numbers might be
172172
```

design_notes/named_array_design_doc.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ Questions:
258258
Variable.coarsen_reshape
259259
Variable.rolling_window
260260

261-
Variable.set_dims # split this into broadcas_to and expand_dims
261+
Variable.set_dims # split this into broadcast_to and expand_dims
262262

263263

264264
# Reordering/Reshaping

0 commit comments

Comments
 (0)