-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Is your feature request related to a problem?
cc @benbovy
xref #7730
import numpy as np
import xarray as xr
arr = np.random.randn(10, 10, 365*30)
time = xr.date_range("2000", periods=30*365, calendar="noleap")
da = xr.DataArray(arr, dims=("y", "x", "time"), coords={"time": time})
year = da["time.year"]xr.align(da, year, join="outer", copy=False)This should result in no copies, but does
Describe the solution you'd like
I think we need to check aligner.copy and/or aligner.reindex (maybe?) before copying here
Lines 2805 to 2818 in f8127fc
| def _reindex_callback( | |
| self, | |
| aligner: alignment.Aligner, | |
| dim_pos_indexers: dict[Hashable, Any], | |
| variables: dict[Hashable, Variable], | |
| indexes: dict[Hashable, Index], | |
| fill_value: Any, | |
| exclude_dims: frozenset[Hashable], | |
| exclude_vars: frozenset[Hashable], | |
| ) -> Dataset: | |
| """Callback called from ``Aligner`` to create a new reindexed Dataset.""" | |
| new_variables = variables.copy() | |
| new_indexes = indexes.copy() |
Describe alternatives you've considered
No response
Additional context
No response
