Skip to content
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

Finalize the pygmt.which wrapper #3003

Open
seisman opened this issue Jan 15, 2024 · 0 comments
Open

Finalize the pygmt.which wrapper #3003

seisman opened this issue Jan 15, 2024 · 0 comments
Labels
discussions Need more discussion before taking further actions

Comments

@seisman
Copy link
Member

seisman commented Jan 15, 2024

Upstream documentation: http://docs.generic-mapping-tools.org/dev/gmtwhich.html
Upstream long option: https://github.com/GenericMappingTools/gmt/blob/master/src/longopt/gmtwhich_inc.h

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.

-V: verbose level.

Common option. Already implemented.

We also need to decide:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussions Need more discussion before taking further actions
Projects
None yet
Development

No branches or pull requests

1 participant