Skip to content
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

"ValueError: Percentiles must be in the range [0, 100]" #3634

Closed
mathause opened this issue Dec 17, 2019 · 1 comment · Fixed by #3635
Closed

"ValueError: Percentiles must be in the range [0, 100]" #3634

mathause opened this issue Dec 17, 2019 · 1 comment · Fixed by #3635

Comments

@mathause
Copy link
Collaborator

mathause commented Dec 17, 2019

MCVE Code Sample

import xarray as xr
da = xr.DataArray([0, 1, 2])
da.quantile(q=50)

>>> ValueError: Percentiles must be in the range [0, 100]

Expected Output

ValueError: Quantiles must be in the range [0, 1]

Problem Description

By wrapping np.nanpercentile (xref: #3559) we also get the numpy error. However, the error message is wrong as xarray needs it to be in 0..1.

BTW: thanks for #3559, makes my life easier!

Output of xr.show_versions()


Edit: uses nanpercentile internally.

INSTALLED VERSIONS

commit: None
python: 3.7.3 | packaged by conda-forge | (default, Jul 1 2019, 21:52:21)
[GCC 7.3.0]
python-bits: 64
OS: Linux
OS-release: 4.12.14-lp151.28.36-default
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.UTF-8
LOCALE: en_US.UTF-8
libhdf5: 1.10.5
libnetcdf: 4.7.1

xarray: 0.14.1+28.gf2b2f9f6 (current master)
pandas: 0.25.2
numpy: 1.17.3
scipy: 1.3.1
netCDF4: 1.5.3
pydap: None
h5netcdf: 0.7.4
h5py: 2.10.0
Nio: None
zarr: None
cftime: 1.0.4.2
nc_time_axis: 1.2.0
PseudoNetCDF: None
rasterio: 1.1.1
cfgrib: None
iris: None
bottleneck: 1.2.1
dask: 2.6.0
distributed: 2.6.0
matplotlib: 3.1.2
cartopy: 0.17.0
seaborn: 0.9.0
numbagg: None
setuptools: 41.4.0
pip: 19.3.1
conda: None
pytest: 5.2.2
IPython: 7.9.0
sphinx: 2.2.1

@crusaderky
Copy link
Contributor

Looks straightforward - could you open a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants