-
-
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
keep_attrs not respected for unary operators #4065
Labels
topic-metadata
Relating to the handling of metadata (i.e. attrs and encoding)
Comments
TomNicholas
added
the
topic-metadata
Relating to the handling of metadata (i.e. attrs and encoding)
label
May 16, 2020
Thanks for flagging this. Question for other devs: Where are these unary operators on xarray objects defined? If I search |
dcherian
added a commit
to dcherian/xarray
that referenced
this issue
Jul 2, 2020
Closes pydata#3490 Closes pydata#4065 Closes pydata#3433 Closes pydata#3595
3 tasks
dcherian
added a commit
to dcherian/xarray
that referenced
this issue
Aug 15, 2020
Closes pydata#3490 Closes pydata#4065 Closes pydata#3433 Closes pydata#3595
dcherian
added a commit
that referenced
this issue
Oct 14, 2020
* 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]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The xarray global option
keep_attrs
(introduced in #2482 ) is not respected for unary operators.MCVE Code Sample
Expected Output
I expect
Problem Description
I get:
I get the same for the other unary operators
+x
,-x
, andabs(x)
.Versions
Tested with latest xarray master (see below for details).
Output of xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.8.2 | packaged by conda-forge | (default, Mar 23 2020, 18:16:37)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.12.14-lp150.12.82-default
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_GB.UTF-8
libhdf5: 1.10.5
libnetcdf: 4.7.4
xarray: 0.15.2.dev64+g2542a63f
pandas: 1.0.3
numpy: 1.18.1
scipy: 1.4.1
netCDF4: 1.5.3
pydap: None
h5netcdf: None
h5py: 2.10.0
Nio: None
zarr: 2.4.0
cftime: 1.1.1.2
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.1.3
cfgrib: None
iris: None
bottleneck: None
dask: 2.14.0
distributed: 2.14.0
matplotlib: 3.2.1
cartopy: 0.17.0
seaborn: None
numbagg: None
pint: None
setuptools: 46.1.3.post20200325
pip: 20.0.2
conda: installed
pytest: 5.4.1
IPython: 7.13.0
sphinx: None
The text was updated successfully, but these errors were encountered: