NCAS-CMS / NCAS-CMS/cf-plot

Address multiple deprecation warnings emerging at Python 3.12

Open
#72 0 comments 0 reactions 1 assignee View on GitHub

@sadielbartholomew is already working on this.

Since Aug 14, 2024.

code hygiene
Dominant language
Python
Stars
21
Forks
11
Avg merge
7h 11m
Merged PRs (30d)
1

Description

The test suite is showing that there are at last a few deprecation warnings emerging from standard cf-plot code, which therefore probably needs to be updated accordingly in its use of numpy, matplotlib and perhaps other libraries too:

...
/home/slb93/miniconda3/envs/cf-env-312/lib/python3.12/site-packages/numpy/ma/core.py:5074: DeprecationWarning: Calling nonzero on 0d arrays is deprecated, as it behaves surprisingly. Use `atleast_1d(cond).nonzero()` if the old behavior was intended. If the context of this warning is of the form `arr[nonzero(cond)]`, just use `arr[cond]`.
  return narray(self.filled(0), copy=False).nonzero()
...
/home/slb93/miniconda3/envs/cf-env-312/lib/python3.12/site-packages/matplotlib/cbook.py:1699: DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated, and will error in future. Ensure you extract a single element from your array before performing this operation. (Deprecated NumPy 1.25.)
  return math.isfinite(val)
...

We should make updates to prevent any DeprecationWarning emerging.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.