-
Notifications
You must be signed in to change notification settings - Fork 234
Description
Description of the problem
PS_CONVERT is a GMT configuration parameter that can store a comma-separate list of options to use when calling psconvert implicitely when gmt end is called. The GMT documentation is at https://docs.generic-mapping-tools.org/6.6/gmt.conf.html#term-PS_CONVERT.
Comma-separated list of optional module arguments that we should supply when psconvert is called implicitly under modern mode [A]. Ignored when psconvert is called on the command line explicitly. The option arguments must be listed without their leading option hyphen.
In PyGMT, Figure.show/Figure.savefig calls psconvert internally, so this option has no effect, which is expected according to the GMT documentation. As a workaround, we can explicitely add these options when calling Figure.show/Figure.savefig, but it's a little tedious.
Possible solutions are:
- Document that
PS_CONVERTis ignored in PyGMT. - In
Figure.psconvert, parse the values ofPS_CONVERTand append them to the argument list when callingpsconvert. - Thinking about if there is a more Pythonic and elegant way to implement the same feature.
Solution 2 is not that hard to implement, but need time to think about solution 3.
Minimal Complete Verifiable Example
import pygmt
pygmt.config(PS_CONVERT="C-I/home/xxx/.gmt")
fig = pygmt.Figure()
fig.basemap(region="g", projection="H8c", frame=True)
fig.savefig("map.png", verbose="d")Full error message
pygmt-session [DEBUG]: Revised options: -A -Fmap -Qg2 -Qt2 -Tg -Vd
psconvert [DEBUG]: Ghostscript executable full name:
psconvert [DEBUG]: gmt_run_process_get_first_line: Pass to popen: [gs --version 2> /dev/null]
psconvert [DEBUG]: gs --version 2> /dev/null was successful
psconvert [DEBUG]: Ghostscript version: 10.06.0Options in PS_CONVERT are not shown in the first line of the debugging message.
The bug was originally found in #3220.