Uh oh!
There was an error while loading. Please reload this page.
pygmt.binstats: Let the parameter 'statistic' support descriptive arguments - #3012
Merged
Conversation
4 tasks
seismanforce-pushed
the
binstats/statistic
branch
2 times, most recently
from
September 29, 2024 09:27
de6ffcc to
464b170Compareseismanforce-pushed
the
binstats/statistic
branch
3 times, most recently
from
August 3, 2025 04:16
7f190d8 to
8883dd8Compareseismanforce-pushed
the
binstats/statistic
branch
from
August 3, 2025 04:19
8883dd8 to
6df2d83Compareseisman
marked this pull request as ready for review
August 3, 2025 04:19
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Yvonne Fröhlich <94163266+yvonnefroehlich@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the pygmt.binstats function to support long-form arguments for the statistic parameter, replacing short single-letter codes with descriptive names (e.g., statistic="mean" instead of statistic="a").
Key changes:
- Implemented an alias system to map long-form statistic names to their corresponding short-form GMT codes
- Added type hints and explicit parameter definitions for better API usability
- Updated tests to use the new long-form syntax
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pygmt/src/binstats.py | Adds alias system, type hints, and long-form parameter support for statistic names |
| pygmt/tests/test_binstats.py | Updates existing tests to use long-form statistic names and adds new quantile test |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
michaelgrund
approved these changes
Aug 8, 2025
Uh oh!
There was an error while loading. Please reload this page.
6 tasks
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 freeto 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
Refactor using the new alias system to make the parameter
statisticsupport long-form arguments likestatistic="mean"instead ofstatistic="a".Upstream documentation at https://docs.generic-mapping-tools.org/dev/gmtbinstats.html
Long-form arguments come from https://github.com/GenericMappingTools/gmt/blob/0ae77bb0ae34d6dcb331156d7ee17a747ba83c57/src/longopt/gmtbinstats_inc.h#L29
Preview: https://pygmt-dev--3012.org.readthedocs.build/en/3012/api/generated/pygmt.binstats.html
Address #1651.