-
Notifications
You must be signed in to change notification settings - Fork 225
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
Document how to parse verbose messages to report equivalent GMT commands #573
Comments
I think the intention is good, it does take a bit of experience translating PyGMT Python commands to GMT bash commands, and any way we can simplify this to improve bug reports will be a plus. That said, I'm not sure if this should live in the PyGMT library. Presumably other GMT wrappers like GMT.jl and GMTmex might find it useful too? |
Ping @PaulWessel @joa-quim for thoughts on this. |
First reaction is that it sounds like a debug option, hence might be part of -Vd, but I am guessing you want to just see those commands. Of course, it makes no sense from the command line GMT to document and explain p since we already have the commands. So, first to check, might this go into -Vd as is? |
How about just for |
Sure, and actually, we know if we are called from externals (API->external is true) so we could print command when it makes sense. |
For cross-reference, the feature will be implemented in upstream GMT GenericMappingTools/gmt#4131. |
The feature has been implemented in the GMT master branch. Here is an example showing how it works: The example PyGMT script #!/usr/bin/env python
import pygmt
### To report equivalent GMT commands, you need to add this line to your PyGMT script
pygmt.config(GMT_VERBOSE='d')
fig = pygmt.Figure()
fig.basemap(region='g', projection='H15c', frame=['xaf', 'yaf', '+t"Global Map"'])
fig.coast(shorelines='1/0.5p')
fig.savefig("map.pdf") Then, run the script and extract the GMT commands from verbose messages:
|
Shall we document it somewhere? |
Yep, should document this in CONTRIBUTING.md or perhaps in our bug report template? Might need to wait for GMT 6.2.0 to come out near the end of the year though. |
I don't think users need to know the trick when reporting bugs. Perhaps better to document it in CONTRIBUTING.md. |
Description of the desired feature
Sometimes we may need the equivalent GMT commands. For example,
GMT already provides 7 verbosity levels by the -V option. The 7 verbosity levels (higher levels add more messages) are:
Here I propose to add one more verbosity level, for example,
verbose='p'
. The verbosity level should be between q and e, i.e.,If
verbose='p'
is used, they PyGMT should print the equivalent GMT command when calling the functioncall_module()
.I only spent a few seconds to choose the character
p
and its verbosity level. So I'm open to better choices.Are you willing to help implement and maintain this feature?
Yes, it should be easy to implement it in the
call_module()
function. Contributions are welcomed.The text was updated successfully, but these errors were encountered: