Skip to content

pygmt.binstats: Let the parameter 'statistic' support descriptive arguments #3012

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

Merged
merged 8 commits into from
Aug 10, 2025

Conversation

seisman
Copy link
Member

@seisman seisman commented Jan 17, 2024

Description of proposed changes

Refactor using the new alias system to make the parameter statistic support long-form arguments like statistic="mean" instead of statistic="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.

@seisman seisman force-pushed the binstats/statistic branch 2 times, most recently from de6ffcc to 464b170 Compare September 29, 2024 09:27
@seisman seisman self-assigned this Oct 30, 2024
@seisman seisman force-pushed the binstats/statistic branch from d1bc357 to 628e69e Compare July 23, 2025 06:53
@seisman seisman changed the base branch from main to AliasSystem/aliassystem July 23, 2025 06:53
@seisman seisman force-pushed the binstats/statistic branch from 628e69e to e1756bf Compare July 24, 2025 06:28
@seisman seisman added the enhancement Improving an existing feature label Jul 24, 2025
@seisman seisman added this to the 0.17.0 milestone Jul 24, 2025
@seisman seisman changed the title POC: pygmt.binstats: Make the 'statistic' parameter more Pythonic WIP: pygmt.binstats: Make the 'statistic' parameter more Pythonic Jul 26, 2025
Base automatically changed from AliasSystem/aliassystem to main July 29, 2025 04:09
@seisman seisman force-pushed the binstats/statistic branch 3 times, most recently from 7f190d8 to 8883dd8 Compare August 3, 2025 04:16
@seisman seisman force-pushed the binstats/statistic branch from 8883dd8 to 6df2d83 Compare August 3, 2025 04:19
@seisman seisman marked this pull request as ready for review August 3, 2025 04:19
@seisman seisman changed the title WIP: pygmt.binstats: Make the 'statistic' parameter more Pythonic pygmt.binstats: Let the parameter 'statistic' support long-form arguments Aug 3, 2025
@seisman seisman added the needs review This PR has higher priority and needs review. label Aug 3, 2025
@seisman seisman requested a review from a team August 7, 2025 08:24
@seisman seisman requested review from a team and Copilot August 8, 2025 04:09
Copy link
Contributor

@Copilot Copilot AI left a 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 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

@seisman seisman changed the title pygmt.binstats: Let the parameter 'statistic' support long-form arguments pygmt.binstats: Let the parameter 'statistic' support descriptive arguments Aug 8, 2025
@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 Aug 9, 2025
@seisman seisman removed the final review call This PR requires final review and approval from a second reviewer label Aug 10, 2025
@seisman seisman merged commit 2bc5931 into main Aug 10, 2025
23 of 24 checks passed
@seisman seisman deleted the binstats/statistic branch August 10, 2025 05:34
@github-project-automation github-project-automation bot moved this from In Progress to Done in Pythonic GMT arguments Aug 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving an existing feature
Projects
Development

Successfully merging this pull request may close these issues.

3 participants