Skip to content

pygmt.which: Find full path to specified files #3003

Closed

Description

@seisman

This is the central issue to track the implementation of the pygmt.which method.

GMT options

Checked: Implemented; Unchecked: To be implemented/discussed; Strikethrough: Won't implement.

The gmtwhich module is one of the simplest modules and has very few options:

-A: Only consider files that the user has permission to read [Default consider all files found].

I think this option is useful and should be implemented. GMT's long option name readable sound good.

-C: Instead of reporting the paths, print the confirmation Y if the file is found and N if it is not.

Currently, we raise FileNotFoundError exception if a file is not found. Sometimes, we may want to take specific actions if a file is not found, so this option is still useful. GMT's long option name is confirm and return Y/N. I think it makes little sense in Python. Instead, we can return the full path if found and None if not found? Or True/False?

-D: Instead of reporting the paths, print the directories that contains the files.

Useless. In Python, we can always use os.path.dirname or Path().parent instead.

-G[a|c|l|u]: download the file if it's a downloadable file

Already implemented but is not Pythonic. The single-letter argument (e.g., download="a") is not Pythonic. More Pythonic arguments are True, auto, cache, local, user. GMT uses user, cache, current, data instead. I feel my suggestions make more sense and we can ask for upstrem changes.

We also need to decide:

Activity

  1. added
    discussions
    on Jan 15, 2024
  2. changed the title [-]Finalize the pygmt.which wrapper[/-] [+]which: Find full path to specified files[/+] on Sep 24, 2025
  3. changed the title [-]which: Find full path to specified files[/-] [+]pygmt.which: Find full path to specified files[/+] on Oct 15, 2025
  4. added
    feature
    and removed
    discussions
    on Oct 16, 2025
  5. moved this from 0) Wishlist to 3) Complete aliases in PyGMT: Wrapping GMT moduleson Dec 7, 2025
  6. added
    feature request
    and removed
    feature
    on Feb 28, 2026
  7. added this to the 0.1.x milestone on Feb 28, 2026
  8. seisman commented on Feb 28, 2026

    @seisman
    MemberAuthor

    -A/-C/-D are not implemented yet, but I feel they're less used. We may consider supporting these options in the future.

  9. self-assigned this
    on Feb 28, 2026
  10. moved this to Ongoing maintenance in PyGMT: Wrapping GMT moduleson Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

feature request

Type

No type

Projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions