Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion doc/whats-new.rst
Original file line number Diff line number Diff line change
@@ -57,7 +57,8 @@ Bug fixes
Haacker <https://github.com/j-haacker>`_.
- Fix ``isel`` for multi-coordinate Xarray indexes (:issue:`10063`, :pull:`10066`).
By `Benoit Bovy <https://github.com/benbovy>`_.

- Always merge coordinates with "no_conflicts" to fix missing attributes after apply_ufunc
operations (:issue:`9317`). By `Jasper de Jong <https://github.com/JdeJong96>`_.

Documentation
~~~~~~~~~~~~~
4 changes: 2 additions & 2 deletions xarray/core/computation.py
Original file line number Diff line number Diff line change
@@ -306,7 +306,7 @@ def apply_dataarray_vfunc(
first_obj = _first_of_type(args, DataArray)
name = first_obj.name
result_coords, result_indexes = build_output_coords_and_indexes(
args, signature, exclude_dims, combine_attrs=keep_attrs
args, signature, exclude_dims, combine_attrs="no_conflicts"
)

data_vars = [getattr(a, "variable", a) for a in args]
@@ -522,7 +522,7 @@ def apply_dataset_vfunc(
)

list_of_coords, list_of_indexes = build_output_coords_and_indexes(
args, signature, exclude_dims, combine_attrs=keep_attrs
args, signature, exclude_dims, combine_attrs="no_conflicts"
)
args = tuple(getattr(arg, "data_vars", arg) for arg in args)

6 changes: 6 additions & 0 deletions xarray/tests/test_computation.py
Original file line number Diff line number Diff line change
@@ -691,6 +691,12 @@
)


def test_keep_coordattrs() -> None:
a = xr.DataArray([0, 1], [("x", [0, 1], {"a": "b"})])
actual = apply_ufunc(operator.abs, a)
assert actual.x.attrs == a.x.attrs


def test_keep_attrs() -> None:
def add(a, b, keep_attrs):
if keep_attrs:
@@ -955,7 +961,7 @@
data=[0, 3],
coords={"x": ("x", [0, 1], dim_attrs), "u": ("x", [0, 1], coord_attrs)},
)
actual = apply_ufunc(lambda *args: sum(args), a, b, c, keep_attrs=strategy)

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[default-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[default-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[False-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[False-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[True-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[True-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[override-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[override-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_keep_attrs_strategies_dataarray_variables[drop-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[default-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[default-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[False-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[False-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[True-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[True-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[override-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[override-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.13

test_keep_attrs_strategies_dataarray_variables[drop-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[default-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[default-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[False-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[False-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[True-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[True-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[override-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[override-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_keep_attrs_strategies_dataarray_variables[drop-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[default-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[default-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[False-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[False-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[True-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[True-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[override-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[override-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / macos-latest py3.10

test_keep_attrs_strategies_dataarray_variables[drop-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[default-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[default-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[False-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[False-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[True-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[True-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[override-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[override-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_keep_attrs_strategies_dataarray_variables[drop-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[default-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[default-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[False-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[False-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[True-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[True-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[override-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[override-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[drop-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

test_keep_attrs_strategies_dataarray_variables[drop-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[default-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[default-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[False-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[False-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[True-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[True-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[override-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[override-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10

test_keep_attrs_strategies_dataarray_variables[drop-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[default-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[default-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[False-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[False-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[True-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[True-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[override-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[override-coord] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

Check failure on line 964 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.13

test_keep_attrs_strategies_dataarray_variables[drop-dim] xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'a': 1} with {'a': 2}

assert_identical(actual, expected)

@@ -2211,7 +2217,7 @@
y["a"].attrs = {"attr": "y_coord"}

# 3 DataArrays, takes attrs from x
actual = xr.where(cond, x, y, keep_attrs=True)

Check failure on line 2220 in xarray/tests/test_computation.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

test_where_attrs xarray.core.merge.MergeError: combine_attrs='no_conflicts', but some values are not the same. Merging {'attr': 'cond_coord'} with {'attr': 'x_coord'}
expected = xr.DataArray([1, 0], coords={"a": [0, 1]}, attrs={"attr": "x_da"})
expected["a"].attrs = {"attr": "x_coord"}
assert_identical(expected, actual)

Unchanged files with check annotations Beta

xp = get_array_namespace(data)
if xp == np:
# numpy currently doesn't have a astype:
return data.astype(dtype, **kwargs)

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / macos-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / macos-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / macos-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / macos-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / macos-latest py3.10

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / macos-latest py3.10

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / windows-latest py3.10

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / windows-latest py3.10

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / windows-latest py3.13

invalid value encountered in cast

Check warning on line 232 in xarray/core/duck_array_ops.py

GitHub Actions / windows-latest py3.13

invalid value encountered in cast
return xp.astype(data, dtype, **kwargs)
return data.astype(dtype, **kwargs)

Check warning on line 234 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

invalid value encountered in cast

Check warning on line 234 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

invalid value encountered in cast

Check warning on line 234 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

invalid value encountered in cast

Check warning on line 234 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

invalid value encountered in cast

Check warning on line 234 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

invalid value encountered in cast

Check warning on line 234 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

invalid value encountered in cast

Check warning on line 234 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

invalid value encountered in cast

Check warning on line 234 in xarray/core/duck_array_ops.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

invalid value encountered in cast
def asarray(data, xp=np, dtype=None):
attrs: _AttrsLike = None,
):
self._data = data
self._dims = self._parse_dimensions(dims)

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / ubuntu-latest py3.10 bare-minimum

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / macos-latest py3.13

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / macos-latest py3.13

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / macos-latest py3.10

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / macos-latest py3.10

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / ubuntu-latest py3.10

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / ubuntu-latest py3.10

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / ubuntu-latest py3.13

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.

Check warning on line 264 in xarray/namedarray/core.py

GitHub Actions / ubuntu-latest py3.13

Duplicate dimension names present: dimensions {'x'} appear more than once in dims=('x', 'x'). We do not yet support duplicate dimension names, but we do allow initial construction of the object. We recommend you rename the dims immediately to become distinct, as most xarray functionality is likely to fail silently if you do not. To rename the dimensions you will need to set the ``.dims`` attribute of each variable, ``e.g. var.dims=('x0', 'x1')``.
self._attrs = dict(attrs) if attrs else None
def __init_subclass__(cls, **kwargs: Any) -> None:
np_arr = xr.DataArray(np.array([1, 0]), dims="x")
xp_arr = xr.DataArray(xp.asarray([1, 0]), dims="x")
expected = xr.where(np_arr, 1, 0)
actual = xr.where(xp_arr, 1, 0)

Check failure on line 144 in xarray/tests/test_array_api.py

GitHub Actions / macos-latest py3.13

test_where TypeError: `condition` must be have a boolean data type

Check failure on line 144 in xarray/tests/test_array_api.py

GitHub Actions / ubuntu-latest py3.12 all-but-dask

test_where TypeError: `condition` must be have a boolean data type

Check failure on line 144 in xarray/tests/test_array_api.py

GitHub Actions / macos-latest py3.10

test_where TypeError: `condition` must be have a boolean data type

Check failure on line 144 in xarray/tests/test_array_api.py

GitHub Actions / ubuntu-latest py3.13 all-but-numba

test_where TypeError: `condition` must be have a boolean data type

Check failure on line 144 in xarray/tests/test_array_api.py

GitHub Actions / ubuntu-latest py3.10

test_where TypeError: `condition` must be have a boolean data type

Check failure on line 144 in xarray/tests/test_array_api.py

GitHub Actions / ubuntu-latest py3.13

test_where TypeError: `condition` must be have a boolean data type
assert isinstance(actual.data, Array)
assert_equal(actual, expected)
fx.create_dataset(k, data=v)
with pytest.warns(UserWarning, match="The 'phony_dims' kwarg"):
with xr.open_dataset(tmp_file, engine="h5netcdf", group="bar") as ds:
assert ds.dims == {

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / macos-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / macos-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / ubuntu-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / ubuntu-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / windows-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / windows-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / windows-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / windows-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / windows-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.

Check warning on line 4188 in xarray/tests/test_backends.py

GitHub Actions / windows-latest py3.10

The return type of `Dataset.dims` will be changed to return a set of dimension names in future, in order to be more consistent with `DataArray.dims`. To access a mapping from dimension names to lengths, please use `Dataset.sizes`.
"phony_dim_0": 5,
"phony_dim_1": 5,
"phony_dim_2": 5,
# otherwise numpy unsigned ints will silently cast to the signed counterpart
fill_value = fill_value.item()
# passes if provided fill value fits in encoded on-disk type
new_fill = encoded_dtype.type(fill_value)

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).

Check warning on line 348 in xarray/coding/variables.py

GitHub Actions / ubuntu-latest py3.10 min-all-deps

NumPy will stop allowing conversion of out-of-bound Python integers to integer arrays. The conversion of 255 to int8 will fail in the future. For the old behavior, usually: np.array(value).astype(dtype)` will give the desired result (the cast overflows).
except OverflowError:
encoded_kind_str = "signed" if encoded_dtype.kind == "i" else "unsigned"
warnings.warn(