Hi all
I’m recently using PyGMT for my work and i got some issue for plotting raster image (.tiff) file. I got 2 problems here:
- grdimage didnt work when i used I (shading) and Q (NaN_transparent). I got this following error : grdimage [ERROR]: Option -Q: Cannot specify a transparent color for grids when intensities are also used
And when i only used -I the background of the map was colored grey
- the file used UTM 54N projection and the result when i run the program I got this following error: “grdview [ERROR]: Map region exceeds 360 degrees”
I would greatly appreciate any advice or solutions from the GMT community.
Thanks you
Hi @rasta.2206
I think this problem was recently fixed (Grdimage transparency of NAN values). You will have to use the dev version.
For your second problem, I will need to see your script to help you.
Hi @Esteban82 thank for the answer
Sorry I still dont get it. What do you meant by using the dev version?
For my second problem this is my code
import pygmt
trench='D:/00_Pygmt/00_project/01_test/Mariana_PD19MT02_75m_geo.tif'
region = [351487.5, 1066612.5, 1182262.5, 1448587.5]
mariana_trench=pygmt.Figure()
mariana_trench.basemap(
projection="U52N/15c",
region=region,
frame=["WSNE", "xaf", "yaf"],
)
mariana_trench.grdimage(
grid=trench,
cmap="jet",
region=region,
shading=True,)
mariana_trench.show()
Thanks
I meant to that you try to work with the development version of GMT. For that, you have to build GMT from source. What GMT version do you have?
I suspect that this image is already in UTM coordinates. If so, then, you have to use linear projection to plot the image correctly. Try adding using this instead:
mariana_trench.grdimage(
projection=X15c
grid=trench,
cmap="jet",
region=region,
shading=True,)
Posting the example code that errors in pure GMT CLI is highly preferable.
I use GMT version 6.5.0
In development version the -I dan -Q parameters can work in the same time?
Ok thanks, it worked but the map looked distorted.
This one used plotted using UTM coordinates from the original file that using UTM projection.

And this one plotted using Geographic coordinates. This one I reprojected the image from the original.

Thanks
This is expected with projection=X15c
. It sets both vertical and horizontal map size to the same value, 15 cm, regardless of the actual grid dimentions.
Yes, I forgot about that. Sorry.
In order to keep the original aspect, try using this command instead:
projection=X15c/0
No need to be sorry. This gave the topic starter opportunity to learn how X
projection specification works.