Add blockmedian and surface gallery example - #4771
Open
Aayush7788 wants to merge 10 commits into
Open
Conversation
seisman
reviewed
Jul 28, 2026
seisman
reviewed
Jul 28, 2026
updated Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
updated Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
updated Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Contributor
Author
|
@seisman , any update |
Contributor
Author
|
@seisman, any update on this branch? |
seisman
reviewed
Aug 6, 2026
| Gridding scattered data | ||
| ======================= | ||
| The :func:`pygmt.surface` function interpolates irregularly spaced |
Member
There was a problem hiding this comment.
Our adopted style guides limit the maximum line length to <= 88 characters. Please rewrap the short lines.
Comment on lines
+6
to
+8
| (x, y, z) observations onto a regular grid. Before interpolation, | ||
| :func:`pygmt.blockmedian` reduces redundant observations by returning one | ||
| median value for every occupied block. |
Member
There was a problem hiding this comment.
Maybe rephrase the sentence to something like:
Before interpolation, it's usually recommended to preprocess the data using
one of blockmean, blockmedian, and blockmode, to avoid aliasing short wavelengths, by returning one value for every occupied block.
Comment on lines
+23
to
+28
| reduced_data = pygmt.blockmedian( | ||
| data=data, | ||
| region=region, | ||
| spacing=spacing, | ||
| center=True, | ||
| ) |
Member
There was a problem hiding this comment.
Suggested change
| reduced_data = pygmt.blockmedian( | |
| data=data, | |
| region=region, | |
| spacing=spacing, | |
| center=True, | |
| ) | |
| reduced_data = pygmt.blockmedian( | |
| data=data, region=region, spacing=spacing, center=True | |
| ) |
Comment on lines
+32
to
+38
| grid = pygmt.surface( | ||
| data=reduced_data, | ||
| region=region, | ||
| spacing=spacing, | ||
| lower="d", | ||
| upper="d", | ||
| ) |
Member
There was a problem hiding this comment.
Suggested change
| grid = pygmt.surface( | |
| data=reduced_data, | |
| region=region, | |
| spacing=spacing, | |
| lower="d", | |
| upper="d", | |
| ) | |
| grid = pygmt.surface( | |
| data=reduced_data, region=region, spacing=spacing, lower="d", upper="d" | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description of proposed changes
Adds a gallery example showing how to reduce irregular bathymetry observations
with
pygmt.blockmedianbefore interpolating them withpygmt.surface.The example uses the built-in bathymetry sample dataset and compares the reduced
observations with the resulting grid.
Fixes #1352
Preview: https://pygmt-dev--4771.org.readthedocs.build/en/4771/gallery/images/gridding_with_surface.html
Guidelines
Slash Commands
You can write slash commands (
/command) in the first line of a comment to performspecific operations. Supported slash command is:
/format: automatically format and lint the code