-
Notifications
You must be signed in to change notification settings - Fork 382
If called from external with -Vi or lower, print command string #4131
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
Conversation
For simpler debugging from external calls, we echo out the module call string when -Vi is used.
Yes, they kind of get buried among low-level statements. Does it make sense for PyGMT to add some sort of debug-flag when you import, of is there no other place than passing a flag on the module call lines. |
I don't need this from Julia because it's already implemented, though it wouldn't harm, but it should NOT go into -Vi. Current attempt doesn't work either
Note that the inline argument Probably the best place to implement this is in
although here it doesn't know the module name, and cannot ever know it from MEX & Julia because we call |
Do we hold onto this in master and remove the backport for now, @seisman? |
Yes. "backport" removed. |
Some comments on the comments:
Since this is to help debug, not for regular use by mere mortals, I do not think it is too much hardship to add a gmt set call to plant that setting before the main gmt commands. See if this minor update is good enough for government work. Note: This PR still does not address @weiji14 point that these lines are not so visible given all the other stuff that is printed, which is the same as @seisman point of adding a higher level special verbosity to just kick in these messages. |
Tried this Python script: #!/usr/bin/env python
import pygmt
pygmt.config(GMT_VERBOSE='i')
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") And I get the full GMT commands by running the following command: $ python test.py 2>&1 | grep GMT_Call_Command | awk -F': ' '{print "gmt", $3}'
gmt figure 71485df0ed3b4d4983d7a2d6bc2a5445 -
gmt figure 71485df0ed3b4d4983d7a2d6bc2a5445 -
gmt basemap -Bxaf -Byaf -B+t"Global Map" -JH15c -Rg
gmt figure 71485df0ed3b4d4983d7a2d6bc2a5445 -
gmt coast -W1/0.5p
gmt figure 71485df0ed3b4d4983d7a2d6bc2a5445 -
gmt psconvert -A -Fmap -Qg2 -Qt2 -Tf
gmt end
gmt figure 71485df0ed3b4d4983d7a2d6bc2a5445 Seems not bad for developers. @weiji14 What do you think? |
Looks much better! Probably not as ideal for users submitting bug reports (especially those on non-UNIX systems), but it should be enough for developers wanting to reproduce the commands. 👍 for me. |
Any concerns for Julia, @joa-quim ? |
I'm wondering if we should move the messages to -Vd instead, as they're only useful for debugging purposes. |
I suppose it should be |
Well, I mentioned above some quirks from Julia, but nothing serious because I won't rely on this (which would partially fail for the reason referred). The best, but worky, solution would be to have a function that takes the linked list of options and build an options string. The reverse of one that I don't remember the name. |
Ping @PaulWessel to finalize this PR. |
Do you mean GMT_Create_Cmd ? We have all of those in the API. |
To finalize, do you mean moving this to -Vd then, @seisman? |
We have a function, |
And why is GMT_Create_Cmd not that function? |
It looks it is, so the solution is to use it to rebuild the |
Which is what this PR does, no? |
OK, I shut up. When I tested there were some issues but would need to repeat to learn again. |
OK @seisman I have moved it to -Vd and I hope this one is good to go. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's good, except a typo.
Co-authored-by: Dongdong Tian <[email protected]>
For simpler debugging from external calls, we echo out the module call string when -Vi is used. Please give this a test, @seisman, to see if it works for PyGMT.