Closed MarkWieczorek closed 4 years ago
@MarkWieczorek What's your ghostscript version (i.e., output of gs --version
)?
v9.50
I can't reproduce your issue with PyGMT v0.1.1 + Python 3.7.6 on macOS.
Please try if the command line version works for you:
gmt basemap -R0/360/-90/90 -JW7i -B -Vd -pdf map
That command works fine....
I just tried reinstalling python, gmt and gs (via brew), and updated xcode, but all to no avail. The command line version works fine, but the pygmt still crops the image.
That's weird. Please try the code below and post the output:
import pygmt
pygmt.print_clib_info()
fig = pygmt.Figure()
fig.basemap(region=[0, 360, -90, 90], projection='W7i', frame=True)
fig.savefig("map.pdf", V='d')
In [1]: import pygmt
...: pygmt.print_clib_info()
...: fig = pygmt.Figure()
...: fig.basemap(region=[0, 360, -90, 90], projection='W7i', frame=True)
...: fig.savefig("map.pdf", V='d')
Loaded libgmt:
binary dir: /usr/local/Cellar/python/3.7.7/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS
cores: 8
grid layout: rows
library path: /usr/local/Cellar/gmt/6.0.0_5/lib/libgmt.dylib
padding: 2
plugin dir: /usr/local/Cellar/gmt/6.0.0_5/lib/gmt/plugins
share dir: /usr/local/Cellar/gmt/6.0.0_5/share/gmt
version: 6.0.0
psconvert [DEBUG]: gmt_check_executable: Pass to popen: [gs --version 2> /dev/null]
psconvert [DEBUG]: gs --version 2> /dev/null was successful
psconvert [DEBUG]: Use PS filename /Users/lunokhod/.gmt/sessions/gmt6.18885/gmt_1.ps-
psconvert [DEBUG]: Hidden PS file /Users/lunokhod/.gmt/sessions/gmt6.18885/gmt_1.ps- found
psconvert [DEBUG]: Complete partial PS file /Users/lunokhod/.gmt/sessions/gmt6.18885/gmt_1.ps-
psconvert [DEBUG]: Size of half-baked PS file = 26447.
psconvert [DEBUG]: Fattened up PS file /Users/lunokhod/.gmt/sessions/gmt6.18885/gmt_1.ps-
psconvert [INFORMATION]: Processing /Users/lunokhod/.gmt/sessions/gmt6.18885/gmt_1.ps-...
psconvert [INFORMATION]: Find HiResBoundingBox ...
psconvert [DEBUG]: Running: gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/Users/lunokhod/.gmt/sessions/gmt6.18885/gmt_1.ps-' 2> '/Users/lunokhod/.gmt/sessions/gmt6.18885/psconvert_18885c.bb'
psconvert [INFORMATION]: Figure dimensions: Width: 235.764 points [8.31723 cm] Height: 502.974 points [17.7438 cm]
psconvert [DEBUG]: Delete /Users/lunokhod/.gmt/sessions/gmt6.18885/psconvert_18885c.bb
psconvert [INFORMATION]: [0 339.03 235.764 842.004]...
psconvert [INFORMATION]: Convert to PDF...
psconvert [DEBUG]: Running: gs -q -dNOPAUSE -dBATCH -dNOSAFER -dPDFSETTINGS=/prepress -dDownsampleColorImages=false -dDownsampleGrayImages=false -dDownsampleMonoImages=false -dUseFlateCompression=true -dEmbedAllFonts=true -dSubsetFonts=true -dMonoImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dSCANCONVERTERTYPE=2 -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite -g5030x2358 -r720 -sOutputFile='map.pdf' '/Users/lunokhod/.gmt/sessions/gmt6.18885/psconvert_18885d.eps'
psconvert [DEBUG]: Delete /Users/lunokhod/.gmt/sessions/gmt6.18885/psconvert_18885d.eps
psconvert [DEBUG]: Final input buffer length was 256
psconvert (gmtlib_free_tmp_arrays): tried to free unallocated memory
This is what I have. I don't understand the differences. @PaulWessel Any thoughts?
Loaded libgmt:
binary dir: /Users/seisman/.anaconda/bin
cores: 8
grid layout: rows
library path: /Users/seisman/local/GMT-6.0.0/lib/libgmt.dylib
padding: 2
plugin dir: /Users/seisman/local/GMT-6.0.0/lib/gmt/plugins
share dir: /Users/seisman/local/GMT-6.0.0/share
version: 6.0.0
psconvert [DEBUG]: gmt_check_executable: Pass to popen: [gs --version 2> /dev/null]
psconvert [DEBUG]: gs --version 2> /dev/null was successful
psconvert [DEBUG]: Use PS filename /Users/seisman/.gmt/sessions/gmt6.55086/gmt_1.ps-
psconvert [DEBUG]: Hidden PS file /Users/seisman/.gmt/sessions/gmt6.55086/gmt_1.ps- found
psconvert [DEBUG]: Complete partial PS file /Users/seisman/.gmt/sessions/gmt6.55086/gmt_1.ps-
psconvert [DEBUG]: Size of half-baked PS file = 26448.
psconvert [DEBUG]: Fattened up PS file /Users/seisman/.gmt/sessions/gmt6.55086/gmt_1.ps-
psconvert [INFORMATION]: Processing /Users/seisman/.gmt/sessions/gmt6.55086/gmt_1.ps-...
psconvert [INFORMATION]: Find HiResBoundingBox ...
psconvert [DEBUG]: Running: gs -q -dSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true '/Users/seisman/.gmt/sessions/gmt6.55086/gmt_1.ps-' 2> '/Users/seisman/.gmt/sessions/gmt6.55086/psconvert_55086c.bb'
psconvert [INFORMATION]: Figure dimensions: Width: 545.904 points [19.2583 cm] Height: 253.512 points [8.94334 cm]
psconvert [DEBUG]: Delete /Users/seisman/.gmt/sessions/gmt6.55086/psconvert_55086c.bb
psconvert [INFORMATION]: [338.994 359.244 884.898 612.756]...
psconvert [INFORMATION]: Convert to PDF...
psconvert [DEBUG]: Running: gs -q -dNOPAUSE -dBATCH -dNOSAFER -dPDFSETTINGS=/prepress -dDownsampleColorImages=false -dDownsampleGrayImages=false -dDownsampleMonoImages=false -dUseFlateCompression=true -dEmbedAllFonts=true -dSubsetFonts=true -dMonoImageFilter=/FlateEncode -dAutoFilterGrayImages=false -dGrayImageFilter=/FlateEncode -dAutoFilterColorImages=false -dColorImageFilter=/FlateEncode -dSCANCONVERTERTYPE=2 -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite -g5460x2536 -r720 -sOutputFile='map.pdf' '/Users/seisman/.gmt/sessions/gmt6.55086/psconvert_55086d.eps'
psconvert [DEBUG]: Delete /Users/seisman/.gmt/sessions/gmt6.55086/psconvert_55086d.eps
psconvert [DEBUG]: Final input buffer length was 256
psconvert (gmtlib_free_tmp_arrays): tried to free unallocated memory
@MarkWieczorek If you have a "gmt.conf" in your home directory or elsewhere, perhaps you can move it to other places and try again.
No, other that a gmt.conf with a PS_MEDIA in it causing trouble?
The gmt.conf file seems to be the cause of the problem, but there is still some kind of weird bug.
gmt defaults -D > gmt.conf
I run into the same problem.This seems to indicate to me that the configuration parameters that are somehow hardcoded into gmt are not in fact the same as those that are created with gmt defaults -D
gmt defaults -D
print the current GMT default settings. If you have a "gmt.conf" somewhere, gmt defaults -D
may load and print settings in that "gmt.conf". Running gmt defaults -D -Vd > gmt.conf
can tell you if you still have another "gmt.conf" file anywhere.
BTW, gmt defaults -Ds
and gmt defaults -Du
will print the system default settings in SI and US units, respectively. You can also check the differences among the "gmt.conf" files generated by the three commands.
-Vd
says Could not find file gmt.conf
. As far as I can tell, I only have one gmt.conf file, and it is located in the default location in ~/.gmtgmt defaults -Ds
gives exactly the same output as gmt defaults -D
gmt defaults -Du
and gmt defaults -D
differ only in 4 variables (include letter vs. A4)In waiting for this issue to be resolved, I will delete the default gmt.conf
whenever using pygmt.
Now I can reproduce your issue with GMT 6.0.0, but not with the lastest GMT master branch. I believe it is a GMT 6.0.0 bug, and was possibly fixed in https://github.com/GenericMappingTools/gmt/pull/2120 and https://github.com/GenericMappingTools/gmt/pull/2100.
As GMT 6.1.0 is planned to be released on June 1st, 2020, and PyGMT is mostly likely to bump its minimum required GMT version to 6.1.0 due to the bug in plot()
(#255), I don't think we'll try to find a workaround on the PyGMT side.
I can wait until June 1!
FYI, you can run brew install gmt --HEAD
to build and install the GMT master branch via homebrew.
I believe this is also a upstream GMT bug, fixed in GMT 6.1.0. Closing the issue. Feel free to re-open it if you still have the same problem.
Problem:
Portions of maps are cut off because the bounding box is too small, or the map size is too large.
Here are two examples, one of which is taken directly from the basemap doc string:
And here are the results
I am using pygmt version 'v0.1.1' on macos with Python 3.7. I don't recall that this was a problem in the pre-v0.1 releases.