-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rolling_exp
loses coords
#6870
Comments
This is actually a bug in da = xr.DataArray([[1, 2, 3], [4, 5, 6]], dims=["x", "y"], coords={"x": [5, 6]})
da.reduce(lambda x, *_, **__: x, dim="x") # has time coord
ds = xr.Dataset({"a": da})
ds.reduce(lambda x, *_, **__: x, dim="x") # lost time coord Probably the assumtion when writing this code was that the passed function actually reduces the dim. |
The logic of figuring out what stays and what goes is different in |
Seems like we should transition this to |
Is there any reason not to use There's a suggestion from @dcherian to change other reduce methods to use |
What happened?
We lose the time coord here —
Dimensions without coordinates: time
:(I realize I wrote this, I didn't think this used to happen, but either it always did or I didn't write good enough tests... mea culpa)
What did you expect to happen?
We keep the time coords, like we do for normal
rolling
:Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
No response
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: None
python: 3.9.13 (main, May 24 2022, 21:13:51)
[Clang 13.1.6 (clang-1316.0.21.2)]
python-bits: 64
OS: Darwin
OS-release: 21.6.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: en_US.UTF-8
LANG: None
LOCALE: ('en_US', 'UTF-8')
libhdf5: None
libnetcdf: None
xarray: 2022.6.0
pandas: 1.4.3
numpy: 1.21.6
scipy: 1.8.1
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: 2.12.0
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: 2021.12.0
distributed: 2021.12.0
matplotlib: 3.5.1
cartopy: None
seaborn: None
numbagg: 0.2.1
fsspec: 2021.11.1
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 62.3.2
pip: 22.1.2
conda: None
pytest: 7.1.2
IPython: 8.4.0
sphinx: 4.3.2
The text was updated successfully, but these errors were encountered: