Grdimage transparency not working

The -t flag is having no effect on my gmt shell script. Am I missing something very simple? There are other layers under it (topographic relief grayscale grdimage) that I would like to be partly visible through a colormap. I’ve tried varying levels from -t90 to in theory fully transparent at -t100 and they seem to have no effect on the grdimage function.

If it matters at all, this grdimage call is done while I have a mask present so that it only puts a contour and colormap on the landmass.

# mask
gmt pscoast -R -J -O -K -Df -Gc >> $out

# temperature cmap
gmt grdimage $grid -R -J -O -K -Ctemperature.cpt -t90 >> $out
# temperature contour
gmt grdcontour $grid -R -J -O -K -C1 -A5+f9p >> $out

# end mask
gmt pscoast -R -J -O -K -Q >> $out

This is my first attempt at a more complicated map so I could be missing something very obvious. Thank you for any assistance!

Are you looking at the PostScript file or at a PDF/raster image?

From the docs on the -t option:

Note : The transparency is only visible when PDF or raster format output is selected because the PostScript language does not support transparency. Only the PNG format selection adds a transparency layer in the image (for further processing).

Not sure exactly. I use ps2pdf for ps to PDF conversion at the end of my script (it’s just what I learned to do) but I suppose this is outside of the gmt commands themselves. Does the .ps file I built before I convert not have the capability for transparency layers and hence they do not translate to the finished .pdf? If so, how can I do this differently?

In my classic mode scripts I use psconvert for all PostScript conversions related stuff. It is conveniently part of GMT. Straight forward to use if you just want a direct pdf conversion:

gmt psconvert -Tf

Thanks, I was unaware of that. But does this explain my issue with the transparency layers not working?

Edit: I suppose to clarify, I don’t know much about GMT’s available formats (can you make a non-postscript file?). Is there a way to build a file that will display the transparency layer properly or is the transparency technically in the .ps file and will show properly once I convert to a .pdf format?

Transparency is a PDF feature. The PostScript language has no such thing. GMT modern mode defaults to PDF. If you do classic PS stuff then see @KristofKoch post.

See the Cookbook on the differences between classic and modern mode.

Without you providing a full script that shows the problem it is pretty hard to guess where things go wrong.

Alright, thank you both. I will review the cookbook and come back if I have further issues, as I said I have limited knowledge with GMT and I suppose I have been using ‘classic’ mode without knowing it :sweat_smile: