Hi, all
I use the GMT to plot the Sentinel-2 optical image data. The region is over the Arctic, so I choose some map projection suitable for there. -Q in grdimage could plot the NaN value as transparent. But in this projection (-JB), the transparent is not perfect.
See:
Hi @yangleir, can you please check whether the result is the same when you put a space in between -Q and the redirect? Currently it looks like there is no space, which could cause problems.
Thanks!
I use the GMT6.1.1. Not the latest version. Maybe that is why -Q crash for you.
Also, the tiff data maybe in chaos. The black is 0,0,0 and not NaN. I will check it.
After fixing the crash with -Q I just made a plot using a linear projection so that there is no reprojection: This will check if the black pixels are turned to transparent. It mostly work but there are patches in the image that has pixels set to (1,1,1) instead - these show up as black below. So nothing wrong with GMT it seems:
I am guessing that gmt_img_project does not necessarily treat the 0,0,0 pixels as NaNs and hence there must be some averaging of blue and black pixels.
I just try your code. It works no problem on GMT6.1.1. ( The small black jagged pixels may also due to the data resolution or something else. )
The data has been updated using gdal_translate : https://www.jianguoyun.com/p/DV5M9VwQ2PCQBxjzpNgD
Are you using the new data?
Please try the updated tiff file. I think it will be ok.
I think the key problem was basically raised because of the wrong usage of the scaling in gdal_translate.
If you are using the original image that has a mix of 0,0,0 and 1,1,1 apart from the blue, then I am not sure how you get a white background PS. Surely those 1,1,1 pixels will remain and give almost black. There is nothing in grdimage that replaces 1,1,1 with NaN but there is for 0,0,0. So not sure what you are showing,