Skip to content

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

Lines changed: 1 addition & 2 deletions
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

Lines changed: 2 additions & 2 deletions
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/gh-action-pypi-publish@v1.10.0
91+
uses: pypa/gh-action-pypi-publish@v1.10.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/gh-action-pypi-publish@v1.10.0
114+
uses: pypa/gh-action-pypi-publish@v1.10.1
115115
with:
116116
verbose: true

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
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

Lines changed: 0 additions & 2 deletions
This file was deleted.

asv_bench/benchmarks/dataset_io.py

Lines changed: 4 additions & 6 deletions
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

Lines changed: 15 additions & 0 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 2 deletions
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

Lines changed: 2 additions & 1 deletion
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

0 commit comments

Comments
 (0)