Skip to content

Fix DataArray coordinate mismatch after array wrap#11405

Open
C1-BA-B1-F3 wants to merge 1 commit into
pydata:mainfrom
C1-BA-B1-F3:fix-pinv-coordinate-mismatch
Open

Fix DataArray coordinate mismatch after array wrap#11405
C1-BA-B1-F3 wants to merge 1 commit into
pydata:mainfrom
C1-BA-B1-F3:fix-pinv-coordinate-mismatch

Conversation

@C1-BA-B1-F3

Copy link
Copy Markdown

Summary

  • route DataArray.array_wrap through the existing dimension-aware replacement helper
  • drop coordinates/indexes whose shapes no longer match shape-changing wrapped NumPy results
  • add a regression test for np.linalg.pinv on a rectangular DataArray

Fixes #11396.

Tests

  • python3 -m pytest -o addopts='' xarray/tests/test_dataarray.py::TestDataArray::test_array_wrap_drops_mismatched_coords
  • python3 -m pytest -o addopts='' xarray/tests/test_dataarray.py::TestDataArray::test_array_interface xarray/tests/test_dataarray.py::TestDataArray::test_reduce_keepdims xarray/tests/test_dataarray.py::TestDataArray::test_math_with_coords
  • python3 -m pytest -o addopts='' xarray/tests/test_computation.py::test_apply_dask_new_output_sizes_not_supplied_same_dim_names
  • python3 -m pytest -o addopts='' xarray/tests/test_dataarray.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

np.linalg.pinv of a DataArray results in mismatched coordinates

1 participant