xarray icon indicating copy to clipboard operation
xarray copied to clipboard

update numpy version requirement

Open smoors opened this issue 2 years ago • 5 comments

What happened?

in the latest xarray version 2022.06.0, xarray.DataArray.quantile supports 9 methods: https://docs.xarray.dev/en/latest/generated/xarray.DataArray.quantile.html

however, those methods are only implemented starting from numpy 1.22.0 https://numpy.org/doc/stable/reference/generated/numpy.quantile.html

whereas the current numpy requirement is only numpy >= 1.19

What did you expect to happen?

that the numpy requirement is updated to numpy >= 1.22

Minimal Complete Verifiable Example

No response

MVCE confirmation

  • [ ] Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
  • [ ] Complete example — the example is self-contained, including all data and the text of any traceback.
  • [ ] Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
  • [ ] New issue — a search of GitHub Issues suggests this is not a duplicate.

Relevant log output

No response

Anything else we need to know?

No response

Environment

smoors avatar Aug 04 '22 08:08 smoors

What exactly is the problem? As clearly stated in the documentation that you linked the supported methods depend on your installed numpy version.

The oldest numpys version that will be supported is at least 18 month old, so 1.19 is still correct.

headtr1ck avatar Aug 04 '22 13:08 headtr1ck

we could probably have a nicer error message, the one from numpy might be a bit confusing:

ValueError: interpolation can only be 'linear', 'lower' 'higher', 'midpoint', or 'nearest'

Maybe something like this?

ValueError: interpolation method '{method}' requires numpy >= 1.22

Edit: while we're at it, we could also make that caveat in the docstring a bit easier to see by moving it to its own paragraph within the the parameter description, and actually add a literal * somewhere

keewis avatar Aug 04 '22 13:08 keewis

As clearly stated in the documentation that you linked the supported methods depend on your installed numpy version.

indeed, I should have read the docs more carefully.

it's a bit annoying though: from the requirements I expected that numpy 1.19 would provide full support for all methods that xarray provides. maybe you could add a comment to the setup.cfg file along the lines of "recommended numpy version >= 1.22" to better indicate this?

I am not a direct user of this package, I just install it for our HPC users, but your suggestions to improve the error message and docs seem good to me.

smoors avatar Aug 04 '22 14:08 smoors

maybe you could add a comment to the setup.cfg file along the lines of "recommended numpy version >= 1.22" to better indicate this?

Do people really look into the setup.cfg file when installing a package? I would assume >99% of the people simply do pip/conda install xarray But I guess a comment does not hurt anyone.

headtr1ck avatar Aug 05 '22 11:08 headtr1ck

Do people really look into the setup.cfg file when installing a package?

yes, especially people like me who do central software installations in a HPC cluster (for example with EasyBuild) and who want to have full control over the package versions that are installed (which is essential for scientific reproducibility). this is indeed a small minority, but note that a lot of people are using our centrally installed packages.

smoors avatar Aug 05 '22 12:08 smoors