-
Notifications
You must be signed in to change notification settings - Fork 228
Examples: Replace deprecated "np.random.seed()" with "np.random.Generator()" (NPY002 warning by ruff) #2781
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
Conversation
The PR title makes no sense to people who don't know NPY002. Could you please update the PR title to make it more clear what the changes are? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor suggestion to use kwargs, otherwise looks good! Just wait for the docs to be rebuilt and double-check that the transparency issue has been fixed with #2783.
I have improved the title, added the links to the previews, and expanded the comment explaining this PR. |
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com>
Co-authored-by: Dongdong Tian <seisman.info@gmail.com>
Description of proposed changes
This PR aims to update the examples to follow ruff's NumPy rules, especially it addresses the
NPY002
warning (please see https://docs.astral.sh/ruff/rules/numpy-legacy-random/):Example:
is replaced by
Affected examples:
Please note that the plots are not completely identical. This is because the generated random numbers are not identical.
Related to the PRs
Fixes #2779 partly
Reminders
make format
andmake check
to make sure the code follows the style guide.doc/api/index.rst
.Slash Commands
You can write slash commands (
/command
) in the first line of a comment to performspecific operations. Supported slash commands are:
/format
: automatically format and lint the code/test-gmt-dev
: run full tests on the latest GMT development version