Skip to content

Commit 42cf522

Browse files
committed
Merge branch 'main' into concat_default_kwargs
2 parents 9667857 + 8ba2707 commit 42cf522

Some content is hidden

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

59 files changed

+1296
-1228
lines changed

ci/requirements/environment.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ dependencies:
5656
- types-pytz
5757
- types-PyYAML
5858
- types-setuptools
59+
- types-openpyxl
5960
- typing_extensions
6061
- zarr
6162
- pip:

conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ def pytest_runtest_setup(item):
2222
pytest.skip(
2323
"set --run-network-tests to run test requiring an internet connection"
2424
)
25-
if "mypy" in item.keywords and not item.config.getoption("--run-mypy"):
25+
if any("mypy" in m.name for m in item.own_markers) and not item.config.getoption(
26+
"--run-mypy"
27+
):
2628
pytest.skip("set --run-mypy option to run mypy tests")
2729

2830

doc/api-hidden.rst

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,22 @@
2828
core.coordinates.DatasetCoordinates.equals
2929
core.coordinates.DatasetCoordinates.identical
3030

31-
core.rolling.DatasetCoarsen.boundary
32-
core.rolling.DatasetCoarsen.coord_func
33-
core.rolling.DatasetCoarsen.obj
34-
core.rolling.DatasetCoarsen.side
35-
core.rolling.DatasetCoarsen.trim_excess
36-
core.rolling.DatasetCoarsen.windows
37-
38-
core.rolling.DatasetRolling.center
39-
core.rolling.DatasetRolling.dim
40-
core.rolling.DatasetRolling.min_periods
41-
core.rolling.DatasetRolling.obj
42-
core.rolling.DatasetRolling.rollings
43-
core.rolling.DatasetRolling.window
44-
45-
core.weighted.DatasetWeighted.obj
46-
core.weighted.DatasetWeighted.weights
31+
computation.rolling.DatasetCoarsen.boundary
32+
computation.rolling.DatasetCoarsen.coord_func
33+
computation.rolling.DatasetCoarsen.obj
34+
computation.rolling.DatasetCoarsen.side
35+
computation.rolling.DatasetCoarsen.trim_excess
36+
computation.rolling.DatasetCoarsen.windows
37+
38+
computation.rolling.DatasetRolling.center
39+
computation.rolling.DatasetRolling.dim
40+
computation.rolling.DatasetRolling.min_periods
41+
computation.rolling.DatasetRolling.obj
42+
computation.rolling.DatasetRolling.rollings
43+
computation.rolling.DatasetRolling.window
44+
45+
computation.weighted.DatasetWeighted.obj
46+
computation.weighted.DatasetWeighted.weights
4747

4848
Dataset.load_store
4949
Dataset.dump_to_store
@@ -70,22 +70,22 @@
7070
core.coordinates.DataArrayCoordinates.equals
7171
core.coordinates.DataArrayCoordinates.identical
7272

73-
core.rolling.DataArrayCoarsen.boundary
74-
core.rolling.DataArrayCoarsen.coord_func
75-
core.rolling.DataArrayCoarsen.obj
76-
core.rolling.DataArrayCoarsen.side
77-
core.rolling.DataArrayCoarsen.trim_excess
78-
core.rolling.DataArrayCoarsen.windows
79-
80-
core.rolling.DataArrayRolling.center
81-
core.rolling.DataArrayRolling.dim
82-
core.rolling.DataArrayRolling.min_periods
83-
core.rolling.DataArrayRolling.obj
84-
core.rolling.DataArrayRolling.window
85-
core.rolling.DataArrayRolling.window_labels
86-
87-
core.weighted.DataArrayWeighted.obj
88-
core.weighted.DataArrayWeighted.weights
73+
computation.rolling.DataArrayCoarsen.boundary
74+
computation.rolling.DataArrayCoarsen.coord_func
75+
computation.rolling.DataArrayCoarsen.obj
76+
computation.rolling.DataArrayCoarsen.side
77+
computation.rolling.DataArrayCoarsen.trim_excess
78+
computation.rolling.DataArrayCoarsen.windows
79+
80+
computation.rolling.DataArrayRolling.center
81+
computation.rolling.DataArrayRolling.dim
82+
computation.rolling.DataArrayRolling.min_periods
83+
computation.rolling.DataArrayRolling.obj
84+
computation.rolling.DataArrayRolling.window
85+
computation.rolling.DataArrayRolling.window_labels
86+
87+
computation.weighted.DataArrayWeighted.obj
88+
computation.weighted.DataArrayWeighted.weights
8989

9090
core.coordinates.DataTreeCoordinates.get
9191
core.coordinates.DataTreeCoordinates.items

doc/api.rst

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1334,7 +1334,7 @@ Grouper Objects
13341334
Rolling objects
13351335
===============
13361336

1337-
.. currentmodule:: xarray.core.rolling
1337+
.. currentmodule:: xarray.computation.rolling
13381338

13391339
Dataset
13401340
-------
@@ -1427,7 +1427,7 @@ DataArray
14271427
Exponential rolling objects
14281428
===========================
14291429

1430-
.. currentmodule:: xarray.core.rolling_exp
1430+
.. currentmodule:: xarray.computation.rolling_exp
14311431

14321432
.. autosummary::
14331433
:toctree: generated/
@@ -1439,7 +1439,7 @@ Exponential rolling objects
14391439
Weighted objects
14401440
================
14411441

1442-
.. currentmodule:: xarray.core.weighted
1442+
.. currentmodule:: xarray.computation.weighted
14431443

14441444
Dataset
14451445
-------

doc/user-guide/reshaping.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ Reshaping via coarsen
305305

306306
Whilst :py:class:`~xarray.DataArray.coarsen` is normally used for reducing your data's resolution by applying a reduction function
307307
(see the :ref:`page on computation<compute.coarsen>`),
308-
it can also be used to reorganise your data without applying a computation via :py:meth:`~xarray.core.rolling.DataArrayCoarsen.construct`.
308+
it can also be used to reorganise your data without applying a computation via :py:meth:`~xarray.computation.rolling.DataArrayCoarsen.construct`.
309309

310310
Taking our example tutorial air temperature dataset over the Northern US
311311

@@ -324,7 +324,7 @@ Taking our example tutorial air temperature dataset over the Northern US
324324
@savefig pre_coarsening.png
325325
air.isel(time=0).plot(x="lon", y="lat")
326326
327-
we can split this up into sub-regions of size ``(9, 18)`` points using :py:meth:`~xarray.core.rolling.DataArrayCoarsen.construct`:
327+
we can split this up into sub-regions of size ``(9, 18)`` points using :py:meth:`~xarray.computation.rolling.DataArrayCoarsen.construct`:
328328

329329
.. ipython:: python
330330

doc/whats-new.rst

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,7 +1473,7 @@ Bug fixes
14731473
special case ``NaT`` handling in :py:meth:`~core.accessor_dt.DatetimeAccessor.isocalendar`
14741474
(:issue:`7928`, :pull:`8084`).
14751475
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_.
1476-
- Fix :py:meth:`~core.rolling.DatasetRolling.construct` with stride on Datasets without indexes.
1476+
- Fix :py:meth:`~computation.rolling.DatasetRolling.construct` with stride on Datasets without indexes.
14771477
(:issue:`7021`, :pull:`7578`).
14781478
By `Amrest Chinkamol <https://github.com/p4perf4ce>`_ and `Michael Niklas <https://github.com/headtr1ck>`_.
14791479
- Calling plot with kwargs ``col``, ``row`` or ``hue`` no longer squeezes dimensions passed via these arguments
@@ -2488,8 +2488,8 @@ New Features
24882488

24892489
- The ``zarr`` backend is now able to read NCZarr.
24902490
By `Mattia Almansi <https://github.com/malmans2>`_.
2491-
- Add a weighted ``quantile`` method to :py:class:`~core.weighted.DatasetWeighted` and
2492-
:py:class:`~core.weighted.DataArrayWeighted` (:pull:`6059`).
2491+
- Add a weighted ``quantile`` method to :py:class:`.computation.weighted.DatasetWeighted` and
2492+
:py:class:`~computation.weighted.DataArrayWeighted` (:pull:`6059`).
24932493
By `Christian Jauvin <https://github.com/cjauvin>`_ and `David Huard <https://github.com/huard>`_.
24942494
- Add a ``create_index=True`` parameter to :py:meth:`Dataset.stack` and
24952495
:py:meth:`DataArray.stack` so that the creation of multi-indexes is optional
@@ -2871,7 +2871,7 @@ Thomas Nicholas, Tomas Chor, Tom Augspurger, Victor Negîrneac, Zachary Blackwoo
28712871

28722872
New Features
28732873
~~~~~~~~~~~~
2874-
- Add ``std``, ``var``, ``sum_of_squares`` to :py:class:`~core.weighted.DatasetWeighted` and :py:class:`~core.weighted.DataArrayWeighted`.
2874+
- Add ``std``, ``var``, ``sum_of_squares`` to :py:class:`~computation.weighted.DatasetWeighted` and :py:class:`~computation.weighted.DataArrayWeighted`.
28752875
By `Christian Jauvin <https://github.com/cjauvin>`_.
28762876
- Added a :py:func:`get_options` method to xarray's root namespace (:issue:`5698`, :pull:`5716`)
28772877
By `Pushkar Kopparla <https://github.com/pkopparla>`_.
@@ -3507,7 +3507,7 @@ New Features
35073507
By `Justus Magin <https://github.com/keewis>`_.
35083508
- Allow installing from git archives (:pull:`4897`).
35093509
By `Justus Magin <https://github.com/keewis>`_.
3510-
- :py:class:`~core.rolling.DataArrayCoarsen` and :py:class:`~core.rolling.DatasetCoarsen`
3510+
- :py:class:`~computation.rolling.DataArrayCoarsen` and :py:class:`~computation.rolling.DatasetCoarsen`
35113511
now implement a ``reduce`` method, enabling coarsening operations with custom
35123512
reduction functions (:issue:`3741`, :pull:`4939`).
35133513
By `Spencer Clark <https://github.com/spencerkclark>`_.
@@ -4352,8 +4352,8 @@ New Features
43524352
- :py:meth:`Dataset.quantile`, :py:meth:`DataArray.quantile` and ``GroupBy.quantile``
43534353
now work with dask Variables.
43544354
By `Deepak Cherian <https://github.com/dcherian>`_.
4355-
- Added the ``count`` reduction method to both :py:class:`~core.rolling.DatasetCoarsen`
4356-
and :py:class:`~core.rolling.DataArrayCoarsen` objects. (:pull:`3500`)
4355+
- Added the ``count`` reduction method to both :py:class:`~computation.rolling.DatasetCoarsen`
4356+
and :py:class:`~computation.rolling.DataArrayCoarsen` objects. (:pull:`3500`)
43574357
By `Deepak Cherian <https://github.com/dcherian>`_
43584358
- Add ``meta`` kwarg to :py:func:`~xarray.apply_ufunc`;
43594359
this is passed on to :py:func:`dask.array.blockwise`. (:pull:`3660`)
@@ -4705,7 +4705,7 @@ Bug fixes
47054705
- Fix error in concatenating unlabeled dimensions (:pull:`3362`).
47064706
By `Deepak Cherian <https://github.com/dcherian>`_.
47074707
- Warn if the ``dim`` kwarg is passed to rolling operations. This is redundant since a dimension is
4708-
specified when the :py:class:`~core.rolling.DatasetRolling` or :py:class:`~core.rolling.DataArrayRolling` object is created.
4708+
specified when the :py:class:`~computation.rolling.DatasetRolling` or :py:class:`~computation.rolling.DataArrayRolling` object is created.
47094709
(:pull:`3362`). By `Deepak Cherian <https://github.com/dcherian>`_.
47104710

47114711
Documentation
@@ -5936,7 +5936,7 @@ Enhancements
59365936
supplied list, returning a bool array. See :ref:`selecting values with isin`
59375937
for full details. Similar to the ``np.isin`` function.
59385938
By `Maximilian Roos <https://github.com/max-sixty>`_.
5939-
- Some speed improvement to construct :py:class:`~xarray.core.rolling.DataArrayRolling`
5939+
- Some speed improvement to construct :py:class:`~xarray.computation.rolling.DataArrayRolling`
59405940
object (:issue:`1993`)
59415941
By `Keisuke Fujii <https://github.com/fujiisoup>`_.
59425942
- Handle variables with different values for ``missing_value`` and
@@ -6016,8 +6016,8 @@ Enhancements
60166016
NumPy. By `Stephan Hoyer <https://github.com/shoyer>`_.
60176017

60186018
- Improve :py:func:`~xarray.DataArray.rolling` logic.
6019-
:py:func:`~xarray.core.rolling.DataArrayRolling` object now supports
6020-
:py:func:`~xarray.core.rolling.DataArrayRolling.construct` method that returns a view
6019+
:py:func:`~xarray.computation.rolling.DataArrayRolling` object now supports
6020+
:py:func:`~xarray.computation.rolling.DataArrayRolling.construct` method that returns a view
60216021
of the DataArray / Dataset object with the rolling-window dimension added
60226022
to the last axis. This enables more flexible operation, such as strided
60236023
rolling, windowed rolling, ND-rolling, short-time FFT and convolution.
@@ -6791,7 +6791,7 @@ Enhancements
67916791
By `Stephan Hoyer <https://github.com/shoyer>`_ and
67926792
`Phillip J. Wolfram <https://github.com/pwolfram>`_.
67936793

6794-
- New aggregation on rolling objects :py:meth:`~core.rolling.DataArrayRolling.count`
6794+
- New aggregation on rolling objects :py:meth:`~computation.rolling.DataArrayRolling.count`
67956795
which providing a rolling count of valid values (:issue:`1138`).
67966796

67976797
Bug fixes

pyproject.toml

Lines changed: 26 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,6 @@ dependencies = ["numpy>=1.24", "packaging>=23.2", "pandas>=2.1"]
3030
[project.optional-dependencies]
3131
accel = ["scipy", "bottleneck", "numbagg", "numba>=0.54", "flox", "opt_einsum"]
3232
complete = ["xarray[accel,etc,io,parallel,viz]"]
33-
dev = [
34-
"hypothesis",
35-
"jinja2",
36-
"mypy",
37-
"pre-commit",
38-
"pytest",
39-
"pytest-cov",
40-
"pytest-env",
41-
"pytest-mypy-plugins",
42-
"pytest-timeout",
43-
"pytest-xdist",
44-
"ruff>=0.8.0",
45-
"sphinx",
46-
"sphinx_autosummary_accessors",
47-
"xarray[complete,types]",
48-
]
4933
io = [
5034
"netCDF4",
5135
"h5netcdf",
@@ -71,11 +55,30 @@ types = [
7155
"types-pexpect",
7256
"types-psutil",
7357
"types-pycurl",
58+
"types-openpyxl",
7459
"types-python-dateutil",
7560
"types-pytz",
7661
"types-setuptools",
7762
]
7863

64+
[dependency-groups]
65+
dev = [
66+
"hypothesis",
67+
"jinja2",
68+
"mypy",
69+
"pre-commit",
70+
"pytest",
71+
"pytest-cov",
72+
"pytest-env",
73+
"pytest-mypy-plugins",
74+
"pytest-timeout",
75+
"pytest-xdist",
76+
"ruff>=0.8.0",
77+
"sphinx",
78+
"sphinx_autosummary_accessors",
79+
"xarray[complete,types]",
80+
]
81+
7982
[project.urls]
8083
Documentation = "https://docs.xarray.dev"
8184
SciPy2015-talk = "https://www.youtube.com/watch?v=X0pAhJgySxk"
@@ -99,10 +102,10 @@ fallback_version = "9999"
99102
[tool.coverage.run]
100103
omit = [
101104
"*/xarray/tests/*",
102-
"*/xarray/core/dask_array_compat.py",
103-
"*/xarray/core/npcompat.py",
104-
"*/xarray/core/pdcompat.py",
105-
"*/xarray/core/pycompat.py",
105+
"*/xarray/compat/dask_array_compat.py",
106+
"*/xarray/compat/npcompat.py",
107+
"*/xarray/compat/pdcompat.py",
108+
"*/xarray/namedarray/pycompat.py",
106109
"*/xarray/core/types.py",
107110
]
108111
source = ["xarray"]
@@ -166,9 +169,8 @@ check_untyped_defs = true
166169
module = [
167170
"xarray.core.accessor_dt",
168171
"xarray.core.accessor_str",
169-
"xarray.core.alignment",
170-
"xarray.core.computation",
171-
"xarray.core.rolling_exp",
172+
"xarray.structure.alignment",
173+
"xarray.computation.*",
172174
"xarray.indexes.*",
173175
"xarray.tests.*",
174176
]
@@ -359,7 +361,7 @@ markers = [
359361
"slow_hypothesis: slow hypothesis tests",
360362
]
361363
minversion = "7"
362-
python_files = "test_*.py"
364+
python_files = ["test_*.py"]
363365
testpaths = ["xarray/tests", "properties"]
364366

365367
[tool.aliases]

xarray/__init__.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,10 @@
1515
from xarray.coding.cftime_offsets import cftime_range, date_range, date_range_like
1616
from xarray.coding.cftimeindex import CFTimeIndex
1717
from xarray.coding.frequencies import infer_freq
18-
from xarray.conventions import SerializationWarning, decode_cf
19-
from xarray.core.alignment import align, broadcast
20-
from xarray.core.combine import combine_by_coords, combine_nested
21-
from xarray.core.common import ALL_DIMS, full_like, ones_like, zeros_like
22-
from xarray.core.computation import (
18+
from xarray.computation.apply_ufunc import (
2319
apply_ufunc,
20+
)
21+
from xarray.computation.computation import (
2422
corr,
2523
cov,
2624
cross,
@@ -29,7 +27,8 @@
2927
unify_chunks,
3028
where,
3129
)
32-
from xarray.core.concat import concat
30+
from xarray.conventions import SerializationWarning, decode_cf
31+
from xarray.core.common import ALL_DIMS, full_like, ones_like, zeros_like
3332
from xarray.core.coordinates import Coordinates
3433
from xarray.core.dataarray import DataArray
3534
from xarray.core.dataset import Dataset
@@ -42,7 +41,6 @@
4241
)
4342
from xarray.core.indexes import Index
4443
from xarray.core.indexing import IndexSelResult
45-
from xarray.core.merge import Context, MergeError, merge
4644
from xarray.core.options import get_options, set_options
4745
from xarray.core.parallel import map_blocks
4846
from xarray.core.treenode import (
@@ -53,6 +51,10 @@
5351
)
5452
from xarray.core.variable import IndexVariable, Variable, as_variable
5553
from xarray.namedarray.core import NamedArray
54+
from xarray.structure.alignment import align, broadcast
55+
from xarray.structure.combine import combine_by_coords, combine_nested
56+
from xarray.structure.concat import concat
57+
from xarray.structure.merge import Context, MergeError, merge
5658
from xarray.util.print_versions import show_versions
5759

5860
try:

xarray/backends/api.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,6 @@
3636
from xarray.coders import CFDatetimeCoder, CFTimedeltaCoder
3737
from xarray.core import dtypes, indexing
3838
from xarray.core.chunk import _get_chunk, _maybe_chunk
39-
from xarray.core.combine import (
40-
_infer_concat_order_from_positions,
41-
_nested_combine,
42-
combine_by_coords,
43-
)
4439
from xarray.core.dataarray import DataArray
4540
from xarray.core.dataset import Dataset
4641
from xarray.core.datatree import DataTree
@@ -50,6 +45,11 @@
5045
from xarray.core.utils import is_remote_uri
5146
from xarray.namedarray.daskmanager import DaskManager
5247
from xarray.namedarray.parallelcompat import guess_chunkmanager
48+
from xarray.structure.combine import (
49+
_infer_concat_order_from_positions,
50+
_nested_combine,
51+
combine_by_coords,
52+
)
5353
from xarray.util.deprecation_helpers import (
5454
_COMPAT_DEFAULT,
5555
_COORDS_DEFAULT,

0 commit comments

Comments
 (0)