GMT.jl cannot add transparency to coast using grdimage

Hello,

I am still trying out the different options given by gmt.jl, and i found it impossible to add a transparent layer to a png image.
If we take the “example” at https://github.com/GenericMappingTools/GMT.jl/issues/365 , i get the following code :

Summary

using GMT

f = Array{Float32}(undef,181,361)
for j in 1:181
for i in 1:361
f[j,i] = sin(pi*(j-1.0)/180.0)cos(4pi(i-1.0)/180)
end
end

G = GMT.mat2grid(f, x=0:360.0, y=-90.0:90);

mycmap = makecpt(color=“blue@100,white@50,red”, range=(-1.0,1.0,0.1), continuous=true)
coast(region=:g,proj=:Winkel,frame=:a,land=:gray)
grdimage!(G,cmap=mycmap,dpi=200,t=50,fmt=:png,show=true)

However, it always result in an error :

Summary

GPL Ghostscript 9.25: **** Could not open temporary file ‘’
**** Unable to open the initial device, quitting.
psconvert [ERROR]: System call [@“C:\Program Files\gs\gs9.25\bin\gswin64c.exe” -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 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite -g1601x1032 -r300 -sOutputFile=“C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp_intermediate.pdf” “./psconvert_53412d.eps”] returned error 1.
ERROR: LoadError: Something went wrong when calling the module. GMT error number = 78
Stacktrace:
[1] error(::String, ::Int32) at .\error.jl:42
[2] gmt(::String) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\gmt_main.jl:241
[3] showfig(::Dict{Symbol,Any}, ::String, ::String, ::String, ::Bool, ::String) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:2532
[4] finish_PS_module(::Dict{Symbol,Any}, ::String, ::String, ::Bool, ::Bool, ::Bool, ::GMT.GMTgrid, ::Vararg{Any,N} where N) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:2633
[5] grdimage(::String, ::GMT.GMTgrid, ::Nothing, ::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:cmap, :dpi, :t, :fmt, :show),Tuple{GMT.GMTcpt,Int64,Int64,Symbol,Bool}}}) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\grdimage.jl:107
[6] #grdimage!#114 at C:\Users\Hao.julia\packages\GMT\oeYJl\src\grdimage.jl:142 [inlined]
[7] top-level scope at H:\netcdf\donnée par année\trans.jl:14
[8] include(::Module, ::String) at .\Base.jl:377
[9] exec_options(::Base.JLOptions) at .\client.jl:288
[10] _start() at .\client.jl:484
in expression starting at H:\netcdf\donnée par année\trans.jl:14

But if is set the format as fmt=:ps, i do get both map, which i can manually set the transparency of the heatmap layer and get the correct result.

Regards

Hmm, don’t know. It works fine for me. I find strange this line of the error stack trace

Hello,

i retried it, entering the code directly into julia repl (thinking it might be a problem running the trans.jl file from my H: drive), it still doesn’t work and gives the following error :

Summary

GPL Ghostscript 9.25: **** Could not open temporary file ‘’
**** Unable to open the initial device, quitting.
psconvert [ERROR]: System call [@“C:\Program Files\gs\gs9.25\bin\gswin64c.exe” -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 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite -g1601x1032 -r300 -sOutputFile=“C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp_intermediate.pdf” “./psconvert_59436d.eps”] returned error 1.
ERROR: Something went wrong when calling the module. GMT error number = 78
Stacktrace:
[1] error(::String, ::Int32) at .\error.jl:42
[2] gmt(::String) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\gmt_main.jl:241
[3] showfig(::Dict{Symbol,Any}, ::String, ::String, ::String, ::Bool, ::String) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:2532
[4] finish_PS_module(::Dict{Symbol,Any}, ::String, ::String, ::Bool, ::Bool, ::Bool, ::GMT.GMTgrid, ::Vararg{Any,N} where N) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:2633
[5] grdimage(::String, ::GMT.GMTgrid, ::Nothing, ::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:cmap, :dpi, :t, :fmt, :show),Tuple{GMT.GMTcpt,Int64,Int64,Symbol,Bool}}}) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\grdimage.jl:107
[6] #grdimage!#114 at C:\Users\Hao.julia\packages\GMT\oeYJl\src\grdimage.jl:142 [inlined]
[7] top-level scope at REPL[19]:1

however, what i can’t explain is :
if i only do it in postscript, i do get both maps on top of one another, and if i set it to png but delete the t=50 option, it also works.

regards.

small edit, i just ran a test GMT, it says that it passed the test despite a few warnings :

Summary

(@v1.4) pkg> test GMT
Testing GMT
Status C:\Users\Hao\AppData\Local\Temp\jl_IvWetK\Manifest.toml
[5752ebe1] GMT v0.22.0 #master (https://github.com/GenericMappingTools/GMT.jl.git)
[2a0f44e3] Base64
[ade2ca70] Dates
[8ba89e20] Distributed
[b77e0a4c] InteractiveUtils
[56ddb016] Logging
[d6f4376e] Markdown
[de0858da] Printf
[9a3f8284] Random
[9e88b42a] Serialization
[6462fe0b] Sockets
[8dfed614] Test
[4ec0a83e] Unicode
6.1.0
┌ Warning: Unknown units request (lolo) Ignoring it
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:1834
┌ Warning: Color lines (or fill) from a color scale was selected but no color scale provided. Expect …
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\psxy.jl:118
┌ Warning: Ignoring the axis ‘equal’ request because figsize with Width and Height already provided.
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:260
┌ Warning: Very likely the projection name (blabla) is unknown to me. Expect troubles
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:383
┌ Warning: Empty units. Ignoring this units request.
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:1813
┌ Warning: Creating KML requires the use of a cartesian projection of geographical coordinates. Not your case
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:1129
gmt gmtset [core] 6.1.0 [64-bit] [MP] - Change individual GMT default settings

usage: gmt gmtset [-C | -D[s|u] | -G] [-[BJRXYp]] PARAMETER1 value1 PARAMETER2 value2 PARAMETER3 value3 …

    For available PARAMETERS, see gmt.conf man page.

    FITCIRCLE
    GMT2KML & KML2GMT
    GMTCONNECT
    GMTCONVERT
    GMTREGRESS
    GMTLOGO
    GMTSPATIAL
    GMTSELECT
    GMTSET
    GMTSIMPLIFY
    GMTREADWRITE

Pixel node registration used
x_min: 1.0 x_max :33.0 x_inc :1.0 n_columns :32
y_min: 0.0 y_max :32.0 y_inc :1.0 n_rows :32
z_min: 1.0 z_max :255.0
Warning: the following options were not consumed in psxy => [:lala]
GMTVECTOR
GRDINFO
grdinfo [INFORMATION]: Writing Data Table to memory reference supplied by pointer
grdinfo [INFORMATION]: Cartesian input grid
grdinfo [INFORMATION]: Processing grid
GRD2CPT
GRDBLEND
GRD2KML
grdimage [ERROR]: Option -A: No output argument allowed
grdimage [ERROR]: Option -A: Must provide an output filename for image
grd2kml [ERROR]: Unable to create a direct PNG from grid
grdmath [WARNING]: 1 more operands left on the stack!
GRDCLIP
GRDCONTOUR
GRDCUT
GRDFFT
GRDFIL
GRDFILTER
GRDGRADIENT
GRDHISTEQ
GRDLANDMASK
GRDPROJECT
GRDTREND
┌ Warning: Usage error, both difference and trend were required. Ignoring the trend request.
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\grdtrend.jl:60
GRDTRACK
GRDVECTOR
GRDVOLUME
GRDIMAGE
GRDVIEW
GREENSPLINE
IMSHOW
MAKECPT
MAPPROJECT
mapproject [WARNING]: No UTM zone given; zone 60T selected
PLOT
┌ Warning: option ms is ignored when either S or symbol options are used
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\psxy.jl:146
┌ Warning: markerline overrides markeredgecolor
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\psxy.jl:163
┌ Warning: option ms is ignored when either S or symbol options are used
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\psxy.jl:146
┌ Warning: option marker is ignored when either S or symbol options are used
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\psxy.jl:150
┌ Warning: You cannot use both markerline and W or pen keys.
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\psxy.jl:167
┌ Warning: Color lines (or fill) from a color scale was selected but no color scale provided. Expect …
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\psxy.jl:118
PLOT3D
ARROWS
LINES
Warning: the following options were not consumed in psxy => [:vec]
SCATTER
┌ Warning: Justification code provided (bottomrigh) is not valid. Defaulting to TopRight
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:2803
BARPLOT
BAR3
PROJECT
PSBASEMAP
PSCLIP
psclip [WARNING]: Option -B cannot be used in combination with Options -N or -T. -B is ignored.
PSCONVERT
psbasemap [WARNING]: 1 external clip operations were not terminated!
PSCOAST
┌ Warning: The ‘clip’ argument can only be a string with ‘land’, ‘water’ or ‘end’. Ignoring it.
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\pscoast.jl:113
PSCONTOUR
PSIMAGE
PSSCALE
PSHISTOGRAM
PSLEGEND
PSROSE
PSMASK
PSSOLAR
PSTERNARY
PSTEXT
PSWIGGLE
SPECTRUM1D
SPHTRIANGULATE
SPHINTERPOLATE
SPHDISTANCE
MODERN
SUBPLOT1
SUBPLOT2
BEGINEND
end [WARNING]: Figure # 1 (lixo) was registered but no matching PostScript-|+ file found - skipping
MOVIE
EVENTS
SURFACE
[Session GMT (74)]: Error returned from GMT API: GMT_WRITTEN_ONCE (84)
[Session GMT (74)]: Error returned from GMT API: GMT_WRITTEN_ONCE (84)
[Session GMT (74)]: Error returned from GMT API: GMT_WRITTEN_ONCE (84)
TRIANGULATE
NEARNEIGHBOR
XYZ2GRD
TREND2D
MISC
Header: -W,red
6×2 Array{Float64,2}:
0.648383 0.739276
0.592341 0.998629
0.381184 0.228491
0.979616 0.928923
0.814641 0.885434
0.733015 0.664663Array{GMT.GMTdataset,1} with 5 segments
Header1: -W,red
Header2: -W,blue
Header3: -W,red
Header4: -W,blue
Header5: -W,red
First segment DATA
6×2 Array{Float64,2}:
0.648383 0.739276
0.592341 0.998629
0.381184 0.228491
0.979616 0.928923
0.814641 0.885434
0.733015 0.664663Unable to discovery this data type - Default to double
[Session GMT (75)]: Error returned from GMT API: GMT_BAD_GEOMETRY (6)
┌ Warning: Adding alpha band is restricted to true color images (RGB)
└ @ GMT C:\Users\Hao.julia\packages\GMT\oeYJl\src\gmt_main.jl:1810
elapsed time: 0.0214611 seconds
EXAMPLES
Gridline node registration used
x_min: -3.0 x_max :3.0 x_inc :0.125 n_columns :49
y_min: -3.0 y_max :3.0 y_inc :0.125 n_rows :49
z_min: -6.541661739349365 z_max :8.083918571472168
Testing GMT tests passed

There is a small difference in our environments. I am using the ghostscript shipped with GMT (a v50.1 dev compiled by me) while you are using an official 9.25. I don’t know why it would make a difference in terms of errors but it can make a difference for transparency. Ghostscript has had a very serious history of released bugs recently. For example do NOT use current 9.52 version. Try to move your version out of the way and see if the shipped-with-GMT works better.

The tests, yes several warnings but most are part of the testing system. I mean, I’m testing the warning branches as well.

Hello,

Thanks for your reply, so it was indeed the official ghostscript that was interfering with GMT.jl.
I uninstalled it completely (i also needed to delete it from registry) and then re-installed gmt 6.1 for good measures.

I now get the following error :

Summary

psconvert [WARNING]: Input file has transparency but your gs version 9.51 has a bug preventing it - please downgrade to 9.50
GPL Ghostscript GIT PRERELEASE 9.51: **** Could not open temporary file ‘’
**** Unable to open the initial device, quitting.
psconvert [ERROR]: System call [@gswin64c -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 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite -g1601x1032 -r300 -sOutputFile=“C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp_intermediate.pdf” “./psconvert_38404d.eps”] returned error 1.
ERROR: LoadError: Something went wrong when calling the module. GMT error number = 78
Stacktrace:
[1] error(::String, ::Int32) at .\error.jl:42
[2] gmt(::String) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\gmt_main.jl:241
[3] showfig(::Dict{Symbol,Any}, ::String, ::String, ::String, ::Bool, ::String) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:2532
[4] finish_PS_module(::Dict{Symbol,Any}, ::String, ::String, ::Bool, ::Bool, ::Bool, ::GMT.GMTgrid, ::Vararg{Any,N} where N) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\common_options.jl:2633
[5] grdimage(::String, ::GMT.GMTgrid, ::Nothing, ::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:cmap, :dpi, :t, :fmt, :show),Tuple{GMT.GMTcpt,Int64,Int64,Symbol,Bool}}}) at C:\Users\Hao.julia\packages\GMT\oeYJl\src\grdimage.jl:107
[6] #grdimage!#114 at C:\Users\Hao.julia\packages\GMT\oeYJl\src\grdimage.jl:142 [inlined]
[7] top-level scope at H:\netcdf\donnée par année\trans.jl:14
[8] include(::Module, ::String) at .\Base.jl:377
[9] exec_options(::Base.JLOptions) at .\client.jl:288
[10] _start() at .\client.jl:484

I will a bit later install an old version of gmt, steal the required version of ghostscript, and in theory all should work.

Thank you for your help

regards

What does this says?

where gswin64c

The ghostscript version shipped with GMT6.0 is exactly the same as in GMT6.1 and that’s the one I use as well as all people that install the Windows version (well, at least those that do not have any other ghost version installed). So I’m confused with your errors.

Oh, my bad, i thought that GMT6.1 had ghostscript 9.51 in it, and i could get the version 9.50 by stealing it from an older version.

Anyway, as your request :

C:\Users\Hao>where gswin64c
C:\programs\gmt6\bin\gswin64c.exe

So normally, ghostscript is where it is supposed to be.

I also took the liberty to remove GMT alongside with julia and deleting all the files that GMT and Julia had on C:, hoping that a complete fresh install would solve things, but i still get the same error :

Summary
PS H:\netcdf\donnée par année> julia trans.jl
psconvert [WARNING]: Input file has transparency but your gs version 9.51 has a bug preventing it - please downgrade to 9.50
GPL Ghostscript GIT PRERELEASE 9.51: **** Could not open temporary file ''
**** Unable to open the initial device, quitting.
psconvert [ERROR]: System call [@gswin64c -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 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite  -g1601x1032 -r300 -sOutputFile="C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp_intermediate.pdf" "./psconvert_19996d.eps"] returned error 1.
ERROR: LoadError: Something went wrong when calling the module. GMT error number = 78
Stacktrace:
 [1] error(::String, ::Int32) at .\error.jl:42
 [2] gmt(::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\gmt_main.jl:241
 [3] showfig(::Dict{Symbol,Any}, ::String, ::String, ::String, ::Bool, ::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2532
 [4] finish_PS_module(::Dict{Symbol,Any}, ::String, ::String, ::Bool, ::Bool, ::Bool, ::GMT.GMTgrid, ::Vararg{Any,N} where N) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2633
 [5] grdimage(::String, ::GMT.GMTgrid, ::Nothing, ::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:cmap, :dpi, :t, :fmt, :show),Tuple{GMT.GMTcpt,Int64,Int64,Symbol,Bool}}}) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:107
 [6] #grdimage!#114 at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:142 [inlined]
 [7] top-level scope at H:\netcdf\donnée par année\trans.jl:14
 [8] include(::Module, ::String) at .\Base.jl:377
 [9] exec_options(::Base.JLOptions) at .\client.jl:288
 [10] _start() at .\client.jl:484
in expression starting at H:\netcdf\donnée par année\trans.jl:14

I also went to C:\programs\gmt6\bin\gswin64c.exe and launched the software to see what would happen, and in the command prompt generated, ghostscript confirms that it is in version 9.51 :

Summary
GPL Ghostscript GIT PRERELEASE 9.51 (2019-10-15)
Copyright (C) 2019 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
GS>

small edit :

i went to Release Ghostscript/GhostPDL 9.50 · ArtifexSoftware/ghostpdl-downloads · GitHub in an attempt to download ghostscript 9.50.
I installed gs950w64.exe, but i once again get an error :

Summary
PS H:\netcdf\donnée par année> julia trans.jl
GPL Ghostscript 9.50: **** Could not open temporary file ''
**** Unable to open the initial device, quitting.
psconvert [ERROR]: System call [@"C:\Program Files\gs\gs9.50\bin\gswin64c.exe" -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 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite  -g1601x1032 -r300 -sOutputFile="C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp_intermediate.pdf" "./psconvert_8944d.eps"] returned error 1.
ERROR: LoadError: Something went wrong when calling the module. GMT error number = 78
Stacktrace:
 [1] error(::String, ::Int32) at .\error.jl:42
 [2] gmt(::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\gmt_main.jl:241
 [3] showfig(::Dict{Symbol,Any}, ::String, ::String, ::String, ::Bool, ::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2532
 [4] finish_PS_module(::Dict{Symbol,Any}, ::String, ::String, ::Bool, ::Bool, ::Bool, ::GMT.GMTgrid, ::Vararg{Any,N} where N) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2633
 [5] grdimage(::String, ::GMT.GMTgrid, ::Nothing, ::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:cmap, :dpi, :t, :fmt, :show),Tuple{GMT.GMTcpt,Int64,Int64,Symbol,Bool}}}) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:107
 [6] #grdimage!#114 at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:142 [inlined]
 [7] top-level scope at H:\netcdf\donnée par année\trans.jl:14
 [8] include(::Module, ::String) at .\Base.jl:377
 [9] exec_options(::Base.JLOptions) at .\client.jl:288
 [10] _start() at .\client.jl:484
in expression starting at H:\netcdf\donnée par année\trans.jl:14

Ok, I was going to tell you to install 9.50 but you already did it.

For the record. The version shipped with GMT was build from source (master) a little bit after 9.50 had been released. At that time the transparency still worked but they (Artifex) already had increased the version number. More recently GMT started to print that warning message

... gs version 9.51 has a bug preventing it - please downgrade to 9.50

but because I have an official 9.23 (I don’t upgrade GS versions easily because last years history has been terrible) I never saw that message.

HOWEVER, even moving 9.23 out of the way and in spite of warning message the with-GMT version still works for me. My last hope of guessing what is failing for you is one or both of these two things.

  1. I notice that you are running the command from a directory with spaces in the name H:\netcdf\donnée par année and with accents. Spaces in the name is a recipe for tragedy soon or later. We have systematically tried to account for those cases but can never be sure we really succeed in all cases. So try to run from a no-spaces directory.

  2. Probably more likely cause. You are running from PowerShell. I remember to have had tons of shits when running from PowerShell and never understood why. So, try to run from a common cmd shell.

Hello,

So, i gave it a last try (tl;dr : didn’t work), this time, i used directly julia 1.4.2 REPL and also installed GS 9.23 just because “why not”. I entered the following code :

Summary
julia> using GMT

julia> f = Array{Float32}(undef,181,361);

julia> for j in 1:181
       for i in 1:361
       f[j,i] = sin(pi*(j-1.0)/180.0)*cos(4pi*(i-1.0)/180)
       end
       end

julia> G = GMT.mat2grid(f, x=0:360.0, y=-90.0:90);

julia> mycmap = makecpt(color="blue@100,white@50,red", range=(-1.0,1.0,0.1), continuous=true);

julia> coast(region=:g,proj=:Winkel,frame=:a,land=:gray)

julia> grdimage!(G,cmap=mycmap,dpi=200,t=50,fmt=:png,show=true)

and it gave me the following error :

Summary
GPL Ghostscript 9.23: **** Could not open temporary file ''
**** Unable to open the initial device, quitting.
psconvert [ERROR]: System call [@"C:\Program Files\gs\gs9.23\bin\gswin64c.exe" -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 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite  -g1601x1032 -r300 -sOutputFile="C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp_intermediate.pdf" "./psconvert_73952d.eps"] returned error 1.
ERROR: Something went wrong when calling the module. GMT error number = 78
Stacktrace:
 [1] error(::String, ::Int32) at .\error.jl:42
 [2] gmt(::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\gmt_main.jl:241
 [3] showfig(::Dict{Symbol,Any}, ::String, ::String, ::String, ::Bool, ::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2532
 [4] finish_PS_module(::Dict{Symbol,Any}, ::String, ::String, ::Bool, ::Bool, ::Bool, ::GMT.GMTgrid, ::Vararg{Any,N} where N) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2633
 [5] grdimage(::String, ::GMT.GMTgrid, ::Nothing, ::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:cmap, :dpi, :t, :fmt, :show),Tuple{GMT.GMTcpt,Int64,Int64,Symbol,Bool}}}) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:107
 [6] #grdimage!#114 at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:142 [inlined]
 [7] top-level scope at REPL[7]:1

The only good point about this one is that there are only 7 errors instead of 10 when i tried it with GS 9.50.

I think it’s best to call this one a lost cause. Maybe there is another software interfering, or maybe the computer is on a strike.
What i think i will do, is install GMT on another computer, and -if it works,- i will generate those “special” plots on this one instead.

Anyway, a huge thank you for helping me.

Regards

Where the hell that “intermediate” is coming from?
(mostly a question to myself)

No idea, when i go to the Temp folder, i only find a GMTjl_tmp.ps file with the plot that is wanted, the heatmap is correctly generated, and is “on top” of the countries.

Maybe my computer is a rebel and wants to try things by himself. :wink:

Regards

And it’s being successful at that.

intermediate it’s the name of one of the coastlines resolution. Does the error occur if you make a plot not involving a call to coast?

So using julia REPL 1.4.2, i first entered this code

Summary
julia> using GMT

julia> f = Array{Float32}(undef,181,361);

julia> for j in 1:181
       for i in 1:361
       f[j,i] = sin(pi*(j-1.0)/180.0)*cos(4pi*(i-1.0)/180)
       end
       end

julia> G = GMT.mat2grid(f, x=0:360.0, y=-90.0:90);

julia> mycmap = makecpt(color="blue@100,white@50,red", range=(-1.0,1.0,0.1), continuous=true);

julia> grdimage!(G,cmap=mycmap,dpi=200,t=50,fmt=:png,show=true)

Which gives me this error (i think it is normal since i am using grdimage!)

Summary
PSL: Error: Could not allocate memory [17179869184.00 Gb, 18446744073709551615 items of 1 bytes]
Error: /undefined in A
Operand stack:
   0
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   2015   1   3   %oparray_pop   2014   1   3   %oparray_pop   1998   1   3   %oparray_pop   1884   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:986/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--
Current allocation mode is local
Last OS error: No such file or directory
Current file position is 338862
psconvert [ERROR]: System call [@"C:\Program Files\gs\gs9.23\bin\gswin64c.exe" -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp.ps" 2> "./psconvert_85648c.bb"] returned error 1.
ERROR: Something went wrong when calling the module. GMT error number = 78
Stacktrace:
 [1] error(::String, ::Int32) at .\error.jl:42
 [2] gmt(::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\gmt_main.jl:241
 [3] showfig(::Dict{Symbol,Any}, ::String, ::String, ::String, ::Bool, ::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2532
 [4] finish_PS_module(::Dict{Symbol,Any}, ::String, ::String, ::Bool, ::Bool, ::Bool, ::GMT.GMTgrid, ::Vararg{Any,N} where N) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2633
 [5] grdimage(::String, ::GMT.GMTgrid, ::Nothing, ::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:cmap, :dpi, :t, :fmt, :show),Tuple{GMT.GMTcpt,Int64,Int64,Symbol,Bool}}}) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:107
 [6] #grdimage!#114 at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:142 [inlined]
 [7] top-level scope at REPL[6]:1

Then immediately after, i just do

Summary
julia> grdimage(G,cmap=mycmap,dpi=200,t=50,fmt=:png,show=true)

Which gives me this error (this one is clearly due to the t=50 option

Summary
GPL Ghostscript 9.23: **** Could not open temporary file ''
**** Unable to open the initial device, quitting.
psconvert [ERROR]: System call [@"C:\Program Files\gs\gs9.23\bin\gswin64c.exe" -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 -dALLOWPSTRANSPARENCY -dMaxBitmap=2147483647 -dUseFastColor=true -dGraphicsAlphaBits=1 -dTextAlphaBits=1 -sDEVICE=pdfwrite  -g1573x818 -r300 -sOutputFile="C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp_intermediate.pdf" "./psconvert_85648d.eps"] returned error 1.
ERROR: Something went wrong when calling the module. GMT error number = 78
Stacktrace:
 [1] error(::String, ::Int32) at .\error.jl:42
 [2] gmt(::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\gmt_main.jl:241
 [3] showfig(::Dict{Symbol,Any}, ::String, ::String, ::String, ::Bool, ::String) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2532
 [4] finish_PS_module(::Dict{Symbol,Any}, ::String, ::String, ::Bool, ::Bool, ::Bool, ::GMT.GMTgrid, ::Vararg{Any,N} where N) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\common_options.jl:2633
 [5] grdimage(::String, ::GMT.GMTgrid, ::Nothing, ::Nothing; first::Bool, kwargs::Base.Iterators.Pairs{Symbol,Any,NTuple{5,Symbol},NamedTuple{(:cmap, :dpi, :t, :fmt, :show),Tuple{GMT.GMTcpt,Int64,Int64,Symbol,Bool}}}) at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:107
 [6] #grdimage#113 at C:\Users\Hao\.julia\packages\GMT\oeYJl\src\grdimage.jl:141 [inlined]
 [7] top-level scope at REPL[7]:1

And finally i just get rid of t=50

Summary
julia> grdimage(G,cmap=mycmap,dpi=200,fmt=:png,show=true)

Which gives me the correct png file

and just for science, i did

julia> coast(region=:g,proj=:Winkel,frame=:a,land=:gray,fmt=:png,show=true)

which gives me the correct plot

so for some reason, GMT.jl is working fine (according to the few things i tested as of now) as long as i don’t ask him to add a transparency layer.

So it seems.But this has to be reproducible and I just can’t reproduce it.

One more before you try a different computer (I can’t believe I’m saying this). What does print?

grdimage(G,cmap=mycmap,dpi=200,t=50,fmt=:png,show=true, Vd=2)

using a new julia repl (just to be sure)

julia> using GMT

julia> grdimage(G,cmap=mycmap,dpi=200,t=50,fmt=:png,show=true, Vd=2)

returns the following error :

ERROR: UndefVarError: mycmap not defined
Stacktrace:
 [1] top-level scope at REPL[2]:1

just sorry i should have entered the full code, sorry, i redo it correctly right away

Edit done :

just to be sure, i didn’t have to add the coast option, right ?

it gives the following message :

“grdimage -JX12c/0 -Baf -BWSen -t50 -E200 -R0/360/-90/90 -C -P -K > C:\Users\Hao\AppData\Local\Temp\GMTjl_tmp.ps”

All fine, I just wanted to check that this was generated correctly. I’m still puzzled with the GMTjl_tmp_intermediate.pdf name. I don’t do it anywhere so who is sneaking in?

Unfortunately, i don’t have enough computer knowledge to tell you, could it be a software installed on my computer that is somehow finding a way to interfere when the files are being generated ?

In any case, i think we can all agree that the manual says : “if you are the only one having a weird bug, get a new computer”

I may get to this latter but now I’m out of ideas. Thanks a lot for your collaboration.

Well, thank you for helping me.

Regards


edit: i thought i had found another package giving me the same problem, however, it was me being dumb running the “cursed script”