You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using xr.polyfit on a DataArray with time coordinate (datetime64) the coefficients don't match the data but the data shifted such that t_min = 0. So the coefficients obtained can not be used in xr.polyval directly.
This shift happens in _floatize_x (
My original issue in the primap2 package is here: primap-community/primap2#293 But that's just fyi, I think I have included all necessary information here.
From looking at the tests added in #9691 , I think it will (one test is basically my failing example). I only looked at the open issues and could not find a fitting one. Great that it's already fixed.
What happened?
When using
xr.polyfit
on aDataArray
with time coordinate (datetime64
) the coefficients don't match the data but the data shifted such thatt_min = 0
. So the coefficients obtained can not be used in xr.polyval directly.This shift happens in
_floatize_x
(xarray/xarray/core/missing.py
Line 585 in 91962d6
What did you expect to happen?
I expected the coefficient of the polynomial to be consistent with the data such that they can be used in
xr.polyval
directly.Minimal Complete Verifiable Example
MVCE confirmation
Relevant log output
Anything else we need to know?
My original issue in the primap2 package is here: primap-community/primap2#293 But that's just fyi, I think I have included all necessary information here.
Environment
INSTALLED VERSIONS
commit: None
python: 3.12.3 (main, Sep 11 2024, 14:17:37) [GCC 13.2.0]
python-bits: 64
OS: Linux
OS-release: 6.8.0-47-generic
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.14.4
libnetcdf: None
xarray: 2024.10.0
pandas: 2.2.3
numpy: 1.26.4
scipy: 1.14.1
netCDF4: None
pydap: None
h5netcdf: 1.4.0
h5py: 3.12.1
zarr: None
cftime: None
nc_time_axis: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.9.2
cartopy: None
seaborn: None
numbagg: 0.8.2
fsspec: None
cupy: None
pint: 0.24.3
sparse: None
flox: None
numpy_groupies: None
setuptools: 75.4.0
pip: 24.2
conda: None
pytest: None
mypy: None
IPython: 8.29.0
sphinx: None
The text was updated successfully, but these errors were encountered: