-
-
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
Incorrect results when using xarray.ufuncs.angle(..., deg=True) #5857
Comments
This is because EDIT: Of course that doesn't explain why |
While closed, this is still an issue for us. np.angle is still not a ufunc, and when applied to an xr.DataArray will return a np array. I understand the removal of the xr.ufuncs namespace, but we're stuck with xarray 2022.3.0 now because upgrading will break our code. What is the recommended workaround here for code that depends on xr.ufuncs.angle? |
Yes it would be nice if this were fixed upstream. (Would you be interested in having a go?)
Perhaps you could make a custom |
Closing as upstream issue — |
What happened:
The
xarray.ufuncs.angle
is broken. From the help docstring one may use optiondeg=True
to have the result in degrees instead of radians (which is consistent withnumpy.angle
function). Yet results show that this is not the case. Moreover specifyingdeg=True
ordeg=False
leads to the same result with the values in radians.What you expected to happen:
To have the result of
xarray.ufuncs.angle
converted to degrees when optiondeg=True
is specified.Minimal Complete Verifiable Example:
Anything else we need to know?:
Though
xarray.ufuncs
has a deprecated warning stating that the numpy equivalent may be used, this is not true fornumpy.angle
. Example:If this code is run, the result of
numpy.angle(xarray.DataArray)
is not a DataArray object, contrary to other numpy operations (for all versions of xarray I've used). Hence thexarray.ufuncs.angle
is a great option, if it was not for the current problem.Environment:
No issues with xarray versions 0.16.2 and 0.17.0. This error happens from 0.18.0 onwards, up to 0.19.0 (recentmost).
Output of xr.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.7.10 (default, Feb 26 2021, 18:47:35)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.19.0-18-amd64
machine: x86_64
processor:
byteorder: little
LC_ALL: en_US.utf8
LANG: C.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: None
libnetcdf: None
xarray: 0.19.0
pandas: 1.2.3
numpy: 1.20.2
scipy: 1.5.3
netCDF4: None
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: None
nc_time_axis: None
PseudoNetCDF: None
rasterio: None
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 58.2.0
pip: 21.3
conda: 4.10.3
pytest: None
IPython: None
sphinx: None
The text was updated successfully, but these errors were encountered: