Skip to content

Commit 3c0d585

Browse files
committed
Merge branch 'main' into groupby-save-codes-new
* main: Preserve `base` and `loffset` arguments in `resample` (pydata#7444) ignore the `pkg_resources` deprecation warning (pydata#7594) Update contains_cftime_datetimes to avoid loading entire variable array (pydata#7494) Support first, last with dask arrays (pydata#7562) update the docs environment (pydata#7442) Add xCDAT to list of Xarray related projects (pydata#7579) [pre-commit.ci] pre-commit autoupdate (pydata#7565) fix nczarr when libnetcdf>4.8.1 (pydata#7575) use numpys SupportsDtype (pydata#7521)
2 parents ea3ed87 + 6d771fc commit 3c0d585

30 files changed

+435
-157
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
files: ^xarray/
1717
- repo: https://github.com/charliermarsh/ruff-pre-commit
1818
# Ruff version.
19-
rev: 'v0.0.248'
19+
rev: 'v0.0.253'
2020
hooks:
2121
- id: ruff
2222
args: ["--fix"]

ci/requirements/doc.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ channels:
44
- conda-forge
55
- nodefaults
66
dependencies:
7-
- python=3.9
7+
- python=3.10
88
- bottleneck
99
- cartopy
1010
- cfgrib>=0.9
@@ -23,18 +23,17 @@ dependencies:
2323
- pandas>=1.4
2424
- pooch
2525
- pip
26-
- pydata-sphinx-theme>=0.4.3
2726
- pyproj
2827
- rasterio>=1.1
2928
- scipy!=1.10.0
3029
- seaborn
3130
- setuptools
3231
- sparse
3332
- sphinx-autosummary-accessors
34-
- sphinx-book-theme >= 0.0.38
33+
- sphinx-book-theme >= 0.3.0
3534
- sphinx-copybutton
3635
- sphinx-design
37-
- sphinx!=4.4.0
36+
- sphinx>=5.0
3837
- zarr>=2.10
3938
- pip:
4039
- sphinxext-rediraffe

doc/conf.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,8 @@
9797

9898

9999
extlinks = {
100-
"issue": ("https://github.com/pydata/xarray/issues/%s", "GH"),
101-
"pull": ("https://github.com/pydata/xarray/pull/%s", "PR"),
100+
"issue": ("https://github.com/pydata/xarray/issues/%s", "GH%s"),
101+
"pull": ("https://github.com/pydata/xarray/pull/%s", "PR%s"),
102102
}
103103

104104
# sphinx-copybutton configurations
@@ -244,12 +244,11 @@
244244
use_repository_button=True,
245245
use_issues_button=True,
246246
home_page_in_toc=False,
247-
extra_navbar="",
248-
navbar_footer_text="",
249247
extra_footer="""<p>Xarray is a fiscally sponsored project of <a href="https://numfocus.org">NumFOCUS</a>,
250248
a nonprofit dedicated to supporting the open-source scientific computing community.<br>
251249
Theme by the <a href="https://ebp.jupyterbook.org">Executable Book Project</a></p>""",
252250
twitter_url="https://twitter.com/xarray_devs",
251+
icon_links=[], # workaround for pydata/pydata-sphinx-theme#1220
253252
)
254253

255254

doc/ecosystem.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ Geosciences
4545
- `xarray-spatial <https://xarray-spatial.org/>`_: Numba-accelerated raster-based spatial processing tools (NDVI, curvature, zonal-statistics, proximity, hillshading, viewshed, etc.)
4646
- `xarray-topo <https://xarray-topo.readthedocs.io/>`_: xarray extension for topographic analysis and modelling.
4747
- `xbpch <https://github.com/darothen/xbpch>`_: xarray interface for bpch files.
48+
- `xCDAT <https://xcdat.readthedocs.io/>`_: An extension of xarray for climate data analysis on structured grids.
4849
- `xclim <https://xclim.readthedocs.io/>`_: A library for calculating climate science indices with unit handling built from xarray and dask.
4950
- `xESMF <https://pangeo-xesmf.readthedocs.io/>`_: Universal regridder for geospatial data.
5051
- `xgcm <https://xgcm.readthedocs.io/>`_: Extends the xarray data model to understand finite volume grid cells (common in General Circulation Models) and provides interpolation and difference operations for such grids.

doc/user-guide/interpolation.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ array-like, which gives the interpolated result as an array.
5050
# interpolation
5151
da.interp(time=[2.5, 3.5])
5252
53-
To interpolate data with a :py:doc:`numpy.datetime64 <reference/arrays.datetime>` coordinate you can pass a string.
53+
To interpolate data with a :py:doc:`numpy.datetime64 <numpy:reference/arrays.datetime>` coordinate you can pass a string.
5454

5555
.. ipython:: python
5656

doc/user-guide/weather-climate.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ For data indexed by a :py:class:`~xarray.CFTimeIndex` xarray currently supports:
233233

234234
.. ipython:: python
235235
236-
da.resample(time="81T", closed="right", label="right", base=3).mean()
236+
da.resample(time="81T", closed="right", label="right", offset="3T").mean()
237237
238238
.. _Timestamp-valid range: https://pandas.pydata.org/pandas-docs/stable/user_guide/timeseries.html#timestamp-limitations
239239
.. _ISO 8601 standard: https://en.wikipedia.org/wiki/ISO_8601

doc/whats-new.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,22 @@ New Features
2525

2626
- Fix :py:meth:`xr.cov` and :py:meth:`xr.corr` now support complex valued arrays (:issue:`7340`, :pull:`7392`).
2727
By `Michael Niklas <https://github.com/headtr1ck>`_.
28+
- Support dask arrays in ``first`` and ``last`` reductions.
29+
By `Deepak Cherian <https://github.com/dcherian>`_.
2830

2931
Breaking changes
3032
~~~~~~~~~~~~~~~~
3133

3234

3335
Deprecations
3436
~~~~~~~~~~~~
37+
- Following pandas, the ``base`` and ``loffset`` parameters of
38+
:py:meth:`xr.DataArray.resample` and :py:meth:`xr.Dataset.resample` have been
39+
deprecated and will be removed in a future version of xarray. Using the
40+
``origin`` or ``offset`` parameters is recommended as a replacement for using
41+
the ``base`` parameter and using time offset arithmetic is recommended as a
42+
replacement for using the ``loffset`` parameter (:pull:`8459`). By `Spencer
43+
Clark <https://github.com/spencerkclark>`_.
3544

3645

3746
Bug fixes
@@ -42,6 +51,8 @@ Bug fixes
4251
- Fix matplotlib raising a UserWarning when plotting a scatter plot
4352
with an unfilled marker (:issue:`7313`, :pull:`7318`).
4453
By `Jimmy Westling <https://github.com/illviljan>`_.
54+
- Improved performance in ``open_dataset`` for datasets with large object arrays (:issue:`7484`, :pull:`7494`).
55+
By `Alex Goodman <https://github.com/agoodm>`_ and `Deepak Cherian <https://github.com/dcherian>`_.
4556

4657
Documentation
4758
~~~~~~~~~~~~~

xarray/backends/zarr.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ def _get_zarr_dims_and_attrs(zarr_obj, dimension_key, try_nczarr):
207207
"which are required for xarray to determine variable dimensions."
208208
) from e
209209

210-
nc_attrs = [attr for attr in zarr_obj.attrs if attr.startswith("_NC")]
210+
nc_attrs = [attr for attr in zarr_obj.attrs if attr.lower().startswith("_nc")]
211211
attributes = HiddenKeyDict(zarr_obj.attrs, [dimension_key] + nc_attrs)
212212
return dimensions, attributes
213213

@@ -495,7 +495,7 @@ def get_attrs(self):
495495
return {
496496
k: v
497497
for k, v in self.zarr_group.attrs.asdict().items()
498-
if not k.startswith("_NC")
498+
if not k.lower().startswith("_nc")
499499
}
500500

501501
def get_dimensions(self):

xarray/coding/calendar_ops.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ def convert_calendar(
147147
from xarray.core.dataarray import DataArray
148148

149149
time = obj[dim]
150-
if not _contains_datetime_like_objects(time):
150+
if not _contains_datetime_like_objects(time.variable):
151151
raise ValueError(f"Coordinate {dim} must contain datetime objects.")
152152

153153
use_cftime = _should_cftime_be_used(time, calendar, use_cftime)
@@ -319,8 +319,8 @@ def interp_calendar(source, target, dim="time"):
319319
target = DataArray(target, dims=(dim,), name=dim)
320320

321321
if not _contains_datetime_like_objects(
322-
source[dim]
323-
) or not _contains_datetime_like_objects(target):
322+
source[dim].variable
323+
) or not _contains_datetime_like_objects(target.variable):
324324
raise ValueError(
325325
f"Both 'source.{dim}' and 'target' must contain datetime objects."
326326
)

xarray/coding/cftime_offsets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1267,7 +1267,7 @@ def date_range_like(source, calendar, use_cftime=None):
12671267
if not isinstance(source, (pd.DatetimeIndex, CFTimeIndex)) and (
12681268
isinstance(source, DataArray)
12691269
and (source.ndim != 1)
1270-
or not _contains_datetime_like_objects(source)
1270+
or not _contains_datetime_like_objects(source.variable)
12711271
):
12721272
raise ValueError(
12731273
"'source' must be a 1D array of datetime objects for inferring its range."

0 commit comments

Comments
 (0)