You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
examples/gallery/histograms/histogram.py:15:1: NPY002 Replace legacy `np.random.seed` call with `np.random.Generator`
|
13 | import pygmt
14 |
15 | np.random.seed(100)
| ^^^^^^^^^^^^^^ NPY002
16 |
17 | # Generate random elevation data from a normal distribution
|
The usage of np.random.seed(100) is deprecated. We should use something like below instead:
rng = np.random.default_rng(100)
rng.random()
The text was updated successfully, but these errors were encountered:
Currently, ruff provides three NumPy-specific rules (https://docs.astral.sh/ruff/rules/#numpy-specific-rules-npy), which can help us avoid deprecated NumPy functions.
To enable NumPy-specific rules, we just need to add
NPY
to theselect
option below:pygmt/pyproject.toml
Lines 91 to 97 in 8f1d476
After enabling the
NPY
rules, runningmake format
gives many [NPY002]*https://docs.astral.sh/ruff/rules/numpy-legacy-random/) warnings, like:The usage of
np.random.seed(100)
is deprecated. We should use something like below instead:The text was updated successfully, but these errors were encountered: