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

Address numpy DeprecationWarnings #148

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Zeitsperre
Copy link

@Zeitsperre Zeitsperre commented Jan 23, 2024

Hi there,

I've been working to reduce warnings in a downstream project and figured I could send a PR your way to address some messages coming from here.

Changes

  • Added the packaging library (provides a version-parsing replacement for the deprecated distutils, endorsed by PyPA)
  • Added a backwards-compatible numpy.{prod|product}, which can be removed when eofs drops Python3.8 support.
  • Replaced deprecated np.NaN artifacts with np.nan.

All the best!

Zeitsperre added a commit to Ouranosinc/xclim that referenced this pull request Jan 29, 2024
### What kind of change does this PR introduce?

* Drops Python3.8 references and marks Python3.9 as base requirement.
* Drops older `xarray` and `pandas` support.
* Updates documentation and CI for dropped Python3.8.
* Raises required versions of `scipy` and `numpy` (`1.9.0` and `1.20.0`,
respectively).
* Removes the `winter_storm` indice and indicator (deprecated in `xclim`
v0.46.0).
* Adopts the new syntax for frequency codes:
  - "A" is no more
  - Y -> YE, Q -> QE, M -> ME
  - H -> h, T -> min, S -> s, L -> ms, U -> us, N -> ns
* Addresses several `DeprecationWarning` and `RuntimeWarning` messages
related to `numpy`, `xarray`, and `pint`

### Does this PR introduce a breaking change?

**Yes**, Python3.8 is no longer supported and base dependency versions
have been augmented:
- `numpy>=1.20.0`
- `pandas>=2.2.0`
- `scipy>=1.9.0`
- `xarray>=2023.11.0`

### Other information:

~Python3.12 support is still not possible due to missing Python3.12
builds for `numba`. (This is being addressed in #1613)~ - This has been
addressed.

A Pull Request has been opened to address `DeprecationWarning`s stemming
from `numpy` calls in `eofs` (ajdawson/eofs#148;
`eofs` has been removed due to licensing-related issues (#1621))
@Zeitsperre
Copy link
Author

@ajdawson Hi, I was just wondering if there's anything else I can do to help this PR along. Thanks!

@bbuzz31
Copy link

bbuzz31 commented Jul 23, 2024

@Zeitsperre on line 206 in standard.py you need to change np.NaN to np.nan for the newest numpy version. for such a small change I'm too lazy to issue a PR to your branch (sorry!)

@Zeitsperre
Copy link
Author

Zeitsperre commented Jul 23, 2024

@bbuzz31 Not sure if I understand.

Do you mean to say that you'll be dropping NumPy v1.x support, so the only changes needed are for the new np.nan? np.product still needs to be replaced with np.prod for NumPy v2.0.

Edit: Ah, I understand! My bad! Will modify.

@bbuzz31
Copy link

bbuzz31 commented Jul 23, 2024

Thanks!

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 this pull request may close these issues.

2 participants