GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — pygmt.grdgradient: Add parameters 'normalize'/'norm_ambient'/'norm_amp'/'norm_sigma'/'norm_offset' for normalization by seisman · Pull Request #4365 · GenericMappingTools/pygmt

Conversation

@seisman

@seisman seisman commented Jan 19, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Description of proposed changes

This PR provides a more Pythonic implementation for the -N option. Its full syntax is -N[e|t][amp][+aambient][+ssigma][+ooffset]

Previously, -N option was aliased to normalize. This PR splits the option into multiple parameters:

  • normalize: accept bool, "Laplace" (for e) or "Cauchy" (for t)
  • norm_amp: amplitude
  • norm_ambient: +a
  • norm_sigma: +s
  • norm_offset: +o

Preview: https://pygmt-dev--4365.org.readthedocs.build/en/4365/api/generated/pygmt.grdgradient.html

https://pygmt-dev--4365.org.readthedocs.build/en/4365/gallery/images/grdgradient_shading.html

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@seisman
seisman force-pushed the grdgradient/normalize branch from c64f483 to 80afd26 Compare January 27, 2026 04:46
@seisman seisman changed the title pygmt.grdgradient: Pythonic implemention of the normalization pygmt.grdgradient: Add parameters 'normalize'/'norm_ambient'/'norm_amp'/'norm_sigma'/'norm_offset' for normalization Jan 27, 2026
@seisman seisman mentioned this pull request Jan 27, 2026
Figure 5: Use the long-form argument for grdgradient's normalize parameter GenericMappingTools/pygmt-paper-figures#31
Merged
@seisman seisman added this to the 0.19.0 milestone Jan 27, 2026
@seisman seisman added the enhancement Improving an existing feature label Jan 27, 2026
@seisman
pygmt.grdgradient: Add parameters 'normalize'/'norm_ambient'/'norm_am…
c3d9ee3
…p'/'norm_sigma'/'norm_offset' for normalization
@seisman
seisman force-pushed the grdgradient/normalize branch from 80afd26 to c3d9ee3 Compare January 28, 2026 03:01
seisman added 3 commits January 30, 2026 17:27
@seisman
Pass as keyword argumenst
52886da
@seisman
Update grdgradient examples
18d5de0
@seisman
Merge branch 'main' into grdgradient/normalize
b1a700f
@seisman
seisman marked this pull request as ready for review January 30, 2026 09:42
@seisman seisman added the needs review This PR has higher priority and needs review. label Jan 31, 2026
seisman added 4 commits February 2, 2026 13:22
@seisman
Merge branch 'main' into grdgradient/normalize
7a36075
@seisman
Fix docstrings
0b86bd1
@seisman
Fix styling
fddc01e
@seisman
Merge branch 'main' into grdgradient/normalize
2f474c8
@seisman
seisman requested a review from Copilot February 2, 2026 12:41
Copilot started reviewing on behalf of seisman February 2, 2026 12:41
View session
Copilot AI reviewed Feb 2, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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.

Pull request overview

This PR refactors the grdgradient function to provide a more Pythonic interface for the normalization option (-N in GMT). Instead of requiring users to provide GMT CLI-style strings, the PR introduces dedicated parameters for normalization control.

Changes:

  • Adds new parameters normalize, norm_amp, norm_ambient, norm_sigma, and norm_offset to pygmt.grdgradient for more intuitive normalization control
  • Implements backward compatibility by allowing the old GMT CLI string syntax while preventing mixed usage of old and new syntax
  • Updates documentation to explain the new Pythonic parameter interface and mathematical formulas

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.

File Description
pygmt/src/grdgradient.py Adds helper function _alias_option_N to handle new normalization parameters and their conversion to GMT CLI format; updates function signature and documentation
pygmt/tests/test_grdgradient.py Adds tests to verify that mixing old GMT syntax with new parameters raises appropriate errors
examples/gallery/images/grdgradient_shading.py Updates example to demonstrate new Pythonic normalization syntax with normalize="cauchy"/"laplace" and norm_amp parameter

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread pygmt/src/grdgradient.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/grdgradient.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_grdgradient.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/tests/test_grdgradient.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread pygmt/src/grdgradient.py Resolved

Uh oh!

There was an error while loading. Please reload this page.

seisman added 3 commits February 2, 2026 20:48
@seisman
Fix imports
dd97ef2
@seisman
Fix a typo
00baa9a
@seisman
Fix tests
a0c3ffa
@seisman seisman added final review call This PR requires final review and approval from a second reviewer and removed needs review This PR has higher priority and needs review. labels Feb 2, 2026
@seisman
Reorder parameters in docstrings
92fc86c
@seisman
seisman requested a review from a team February 3, 2026 01:44
seisman added 2 commits February 4, 2026 09:06
@seisman
Merge branch 'main' into grdgradient/normalize
83ef198
@seisman
Merge branch 'main' into grdgradient/normalize
e6ecc82
@seisman

seisman commented Feb 4, 2026

Copy link
Copy Markdown
Member Author

@GenericMappingTools/pygmt-maintainers I plan to merge this PR in 24 hours if no further comments.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@seisman
Merge branch 'main' into grdgradient/normalize
ef53225
weiji14
weiji14 approved these changes Feb 5, 2026
View reviewed changes

@weiji14 weiji14 left a comment

Copy link
Copy Markdown
Member

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.

Formulations and implementations seems ok. Just one comment on the gallery example.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread examples/gallery/images/grdgradient_shading.py Outdated
- ``normalize`` to enhance the three-dimensional sense of the topography.
- ``azimuth`` sets the illumination light source direction (0° is North, 90° is East,
180° is South, 270° is West).
- ``normalize`` and related parameters enhances the 3-D sense of the topography.

@weiji14 weiji14 Feb 5, 2026

Copy link
Copy Markdown
Member

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.

Maybe state that the normalize param sets the normalization method (e.g. Cauchy/Laplace), and norm_amp sets the output magnitude/amplitude?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@seisman seisman Feb 5, 2026

Copy link
Copy Markdown
Member Author

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.

I've make related changes in 9c142eb.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

weiji14 reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@seisman
Improve the gallery example docstrings
9c142eb
@seisman
seisman merged commit 57f9c6d into main Feb 5, 2026
18 of 21 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@seisman
seisman deleted the grdgradient/normalize branch February 5, 2026 03:29
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Feb 14, 2026
@seisman seisman mentioned this pull request Feb 28, 2026
pygmt.grdgradient: Compute directional gradients from a grid #4253
Closed
6 of 15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@weiji14 weiji14 weiji14 approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement Improving an existing feature

Projects

None yet

Milestone

0.19.0

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@seisman @weiji14
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.