Skip to content

Commit f779b8a

Browse files
Merge branch 'main' into pixi-dust
2 parents 1b2869c + 957b61e commit f779b8a

20 files changed

Lines changed: 81 additions & 44 deletions

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ repos:
2424
- id: rst-inline-touching-normal
2525
- id: text-unicode-replacement-char
2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: v0.14.1
27+
rev: v0.14.3
2828
hooks:
2929
- id: ruff-check
3030
args: ["--fix", "--show-fixes"]
@@ -76,6 +76,6 @@ repos:
7676
- id: validate-pyproject
7777
additional_dependencies: ["validate-pyproject-schema-store[all]"]
7878
- repo: https://github.com/adhtruong/mirrors-typos
79-
rev: v1.38.1
79+
rev: v1.39.0
8080
hooks:
8181
- id: typos

design_notes/flexible_indexes_notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ Indexes:
350350

351351
To keep the `repr` compact, we could:
352352

353-
- consolidate entries that map to the same index object, and have an short inline repr for `XarrayIndex` object
353+
- consolidate entries that map to the same index object, and have a short inline repr for `XarrayIndex` object
354354
- collapse the index section by default in the HTML `repr`
355355
- maybe omit all trivial indexes for 1D coordinates that match the dimension name
356356

doc/user-guide/data-structures.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ in the dictionary:
360360
Where a pandas object is supplied as a value, the names of its indexes are used as dimension
361361
names, and its data is aligned to any existing dimensions.
362362

363-
You can also create an dataset from:
363+
You can also create a dataset from:
364364

365365
- A :py:class:`pandas.DataFrame` or ``pandas.Panel`` along its columns and items
366366
respectively, by passing it into the :py:class:`~xarray.Dataset` directly
@@ -559,7 +559,7 @@ nested dict-like containers of both :py:class:`xarray.DataArray`\s and :py:class
559559
A single datatree object is known as a "node", and its position relative to
560560
other nodes is defined by two more key properties:
561561

562-
- ``children``: An dictionary mapping from names to other :py:class:`~xarray.DataTree`
562+
- ``children``: A dictionary mapping from names to other :py:class:`~xarray.DataTree`
563563
objects, known as its "child nodes".
564564
- ``parent``: The single :py:class:`~xarray.DataTree` object whose children this datatree is a
565565
member of, known as its "parent node".

doc/user-guide/hierarchical-data.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ Operations and Methods on Trees
485485
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
486486

487487
To show how applying operations across a whole tree at once can be useful,
488-
let's first create a example scientific dataset.
488+
let's first create an example scientific dataset.
489489

490490
.. jupyter-execute::
491491

doc/user-guide/terminology.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ complete examples, please consult the relevant documentation.*
6464
distinguish :term:`Dimension coordinate` vs. :term:`Non-dimension
6565
coordinate` and :term:`Indexed coordinate` vs. :term:`Non-indexed
6666
coordinate`. A coordinate named ``x`` can be retrieved from
67-
``arr.coords[x]``. A ``DataArray`` can have more coordinates than
67+
``arr.coords["x"]``. A ``DataArray`` can have more coordinates than
6868
dimensions because a single dimension can be labeled by multiple
6969
coordinate arrays. However, only one coordinate array can be assigned
7070
as a particular dimension's dimension coordinate array.

doc/whats-new.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ New Features
1919
By `Stephan Hoyer <https://github.com/shoyer>`_.
2020
- The ``h5netcdf`` engine has support for pseudo ``NETCDF4_CLASSIC`` files, meaning variables and attributes are cast to supported types. Note that the saved files won't be recognized as genuine ``NETCDF4_CLASSIC`` files until ``h5netcdf`` adds support with version 1.7.0. (:issue:`10676`, :pull:`10686`).
2121
By `David Huard <https://github.com/huard>`_.
22+
- Support comparing :py:class:`DataTree` objects with :py:func:`testing.assert_allclose` (:pull:`10887`).
23+
By `Justus Magin <https://github.com/keewis>`_.
2224

2325
Breaking Changes
2426
~~~~~~~~~~~~~~~~
@@ -39,6 +41,9 @@ Bug Fixes
3941
``engine=`` argument. (:pull:`10804`). By `Ian Hunt-Isaak <https://github.com/ianhi>`_.
4042
- Fix indexing with empty arrays for scipy & h5netcdf backends which now resolves to empty slices (:issue:`10867`, :pull:`10870`).
4143
By `Kai Mühlbauer <https://github.com/kmuehlbauer>`_
44+
- Fix error handling issue in ``decode_cf_variables`` when decoding fails - the exception is now re-raised
45+
correctly, with a note added about the variable name that caused the error (:issue:`10873`, :pull:`10886`).
46+
By `Jonas L. Bertelsen <https://github.com/jonaslb>`_
4247

4348
Performance
4449
~~~~~~~~~~~

properties/test_pandas_roundtrip.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,9 @@ def test_roundtrip_1d_pandas_extension_array(extension_array, is_index) -> None:
163163
df_arr_to_test = df.index if is_index else df["arr"]
164164
assert (df_arr_to_test == roundtripped).all()
165165
# `NumpyExtensionArray` types are not roundtripped, including `StringArray` which subtypes.
166-
if isinstance(extension_array, pd.arrays.NumpyExtensionArray): # type: ignore[attr-defined]
166+
if isinstance(
167+
extension_array, pd.arrays.NumpyExtensionArray | pd.arrays.ArrowStringArray
168+
): # type: ignore[attr-defined]
167169
assert isinstance(arr.data, np.ndarray)
168170
else:
169171
assert (

xarray/backends/api.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -650,7 +650,7 @@ def open_dataarray(
650650
backend_kwargs: dict[str, Any] | None = None,
651651
**kwargs,
652652
) -> DataArray:
653-
"""Open an DataArray from a file or file-like object containing a single
653+
"""Open a DataArray from a file or file-like object containing a single
654654
data variable.
655655
656656
This is designed to read netCDF files with only one data variable. If

xarray/conventions.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,8 @@ def stackable(dim: Hashable) -> bool:
422422
decode_timedelta=_item_or_default(decode_timedelta, k, None),
423423
)
424424
except Exception as e:
425-
raise type(e)(f"Failed to decode variable {k!r}: {e}") from e
425+
e.add_note(f"Raised while decoding variable {k!r} with value {v!r}")
426+
raise
426427
if decode_coords in [True, "coordinates", "all"]:
427428
var_attrs = new_vars[k].attrs
428429
if "coordinates" in var_attrs:

xarray/convert.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def _name(iris_obj, default="unknown"):
155155

156156

157157
def from_iris(cube):
158-
"""Convert a Iris cube into an DataArray"""
158+
"""Convert a Iris cube into a DataArray"""
159159
import iris.exceptions
160160

161161
name = _name(cube)

0 commit comments

Comments
 (0)