-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Attributes are dropped after clip
even if keep_attrs
is True
#3433
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
Comments
Thanks @mraspaud
Lines 321 to 349 in 72be873
Are you up for sending in a PR? |
Sure! What do you reckon the default should be ? False for backwards compatibility ? |
ooh, maybe I answered too fast. I hadn't really looked at the code yet... but let's see: |
clip
even is keep_attrs
is Trueclip
even if keep_attrs
is True
I don't think so. You'll have to check which functions are used to inject methods on groupby, resample and rolling objects (at least) |
Ok, then I probably won't have the time to dig into this for now, sorry. If someone else with better knowledge of the code can work on this it would probably be for the best. |
Closes pydata#3490 Closes pydata#4065 Closes pydata#3433 Closes pydata#3595
Closes pydata#3490 Closes pydata#4065 Closes pydata#3433 Closes pydata#3595
* Propagate attrs with unary, binary functions Closes #3490 Closes #4065 Closes #3433 Closes #3595 * Un xfail test * bugfix * Some progress. Still need keep_attrs in DataArray._unary_op * Fix dataset attrs * whats-new * small fix * Fix imag, real * fix variable tests * fix multiple return variables. * review comments * Update doc/whats-new.rst * Propagate attrs with DataArray unary ops * More tests * Small cleanup * Review comments. * Fix duplication Co-authored-by: Maximilian Roos <[email protected]>
MCVE Code Sample
Expected Output
I would expect the attributes to be kept
Problem Description
keep_attrs
set toTrue
doesn't seem to be respected with theDataArray.clip
method.Output of
xr.show_versions()
xarray: 0.14.0
pandas: 0.25.1
numpy: 1.17.0
scipy: 1.3.0
netCDF4: 1.5.1.2
pydap: None
h5netcdf: 0.7.4
h5py: 2.10.0
Nio: None
zarr: 2.3.2
cftime: 1.0.3.4
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.0.28
cfgrib: None
iris: None
bottleneck: None
dask: 2.6.0
distributed: 2.6.0
matplotlib: 3.1.1
cartopy: 0.17.0
seaborn: None
numbagg: None
setuptools: 41.4.0
pip: 19.3
conda: None
pytest: 5.0.1
IPython: 7.8.0
sphinx: 2.2.0
The text was updated successfully, but these errors were encountered: