Incompatible BoundingBox and PS_MEDIA causes crash
User error or bug - whatever you call it, GMT 6 crashes if the BoundingBox and PS_MEDIA are incompatible. During the PS → PDF,PNG[..] conversion. I think.
GMT 6 modern mode
andreas:~$ gmt begin && gmt pscoast -R6/8/61/63 -Js0/90/1:10000 -W -Dc -Bafg --PS_MEDIA=A4 && gmt end psconvert [ERROR]: Unable to decode BoundingBox file ./psconvert_8548c.bb psconvert [ERROR]: Failed to remove ./psconvert_8548c.bb! [remove error: No such file or directory] ERROR: Caught signal number 11 (Segmentation fault) at /lib/x86_64-linux-gnu/libc.so.6(fclose+0x4)[0x7fa293a3d264] [0x0] Stack backtrace: /usr/local/lib/libgmt.so.6(sig_handler+0x2b1)[0x7fa293ff63a1] /lib/x86_64-linux-gnu/libpthread.so.0(+0x11390)[0x7fa293db1390] /lib/x86_64-linux-gnu/libc.so.6(fclose+0x4)[0x7fa293a3d264] /usr/local/lib/libgmt.so.6(GMT_psconvert+0x485a)[0x7fa294261e8a] /usr/local/lib/libgmt.so.6(GMT_Call_Module+0x135)[0x7fa29400d615] /usr/local/lib/libgmt.so.6(gmt_manage_workflow+0x9d5)[0x7fa29410a9f5] /usr/local/lib/libgmt.so.6(GMT_end+0x30b)[0x7fa293ff7afb] /usr/local/lib/libgmt.so.6(GMT_Call_Module+0x135)[0x7fa29400d615] gmt(main+0x926)[0x401576] /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0)[0x7fa2939f0830] gmt(_start+0x29)[0x4016b9]
~equivalent in GMT 5 (classic)
$ gmt pscoast -R6/8/61/63 -Js0/90/1:10000 -W -Dc -Bafg --PS_MEDIA=A4 > a.ps $ psconvert -Tf -A -Z a.ps gmt: Unable to create GMT User directory : \/.gmt gmt: Auto-downloading of earth_relief_##m|s.grd files has been disabled. psconvert: Unable to decode BoundingBox file ./psconvert_10144c.bb psconvert: Failed to remove ./psconvert_10144c.bb! [remove error: No such file or directory]
This might not be the correct place to bring this up, but; will the PS_MEDIA parameter be obsolete and removed at some point? In this day and age, who cares about the "physical format of the current plot paper"? In the past I can understand why this was important, but now?
Setting a paper size is mostly something required by ghostscript so that it will render the full plot. If you plot outside the PS_MEDIA dimensions then psconvert, calling gs, will truncate your plot to the paper size. There are some ways to deal with this:
- Set PS_MEDIA internally once the plot dimensions from -R -J is known, plus margins.
- Set PS_MEDIA to something very large, then crop at the end.
Option 1 seems good until you realize that later plotting may very well enlarge the area. So then it becomes much more complicated to keep track. We used to do this (badly) back in the GMT4 days but gave up since we cannot do it accurately without including font metrics. Option 2 means we may waste large amounts of memory to rasterize the PS onto an unnecessarily large matrix.
GMT originated in making plots destined for paper and of high quality, and setting dimensions is still relevant given -J -R. So being aware of a paper size does not seem that unreasonable to me, still.
Meanwhile... we have looked into this further and can announce that GMT 6 will not require any PS_MEDIA setting unless you want to. The default will be "auto" and we crop to fit you plot, no matter how large. Thanks for starting the thought process. We will retain PS_MEDIA because it is required for some endeavors such as making frames for movies (they all need to be the same size).