@earth_relief on MacOS in GMT6.1

Hi there,

My name is Norman and I recently switched from GMT4/GMT5 (classic) to GMT6.1 and installed it via MacPorts on my Mac. I am trying to update some of my figures showing the relief in various regions we work in. However I run into problem when trying to use the @earth_relief functionality. Access to it in the examples I tested worked, but my own converted scripts don’t.

I had to use get to download the jp2 files. Then I have narrowed down the problem to a conversion issue. On my command

gmt6 grdcut @earth_relief_30s -RLU+r1.0 -Gtest.grd -V

I get after some initial report lines:

grdblend [INFORMATION]: Downloading earth_relief_30s_p/ tile 1 of 1 [N45E000]
grdblend [INFORMATION]: Convert SRTM tile from JPEG2000 to netCDF grid [… /.gmt/server/earth/earth_relief/earth_relief_30s_p/N45E000.earth_relief_30s_p.nc]

ERROR 4: `…/.gmt/server/earth/earth_relief/earth_relief_30s_p/N45E000.earth_relief_30s_p.jp2’ not recognized as a supported file format.

grdblend [ERROR]: ERROR - Unable to convert SRTM file /Users/norman.teferle/.gmt/server/earth/earth_relief/earth_relief_30s_p/N45E000.earth_relief_30s_p.jp2 to compressed netCDF format

This suggests to me that the jp2 files is not correct. How can this happen when the download was fully automatic?

Any idea here. Your help is much appreciated.

Cheers,
Norman

The problem is that your GDAL was not built with JP2 support so the .jp2 files are not recognized. You need to rebuild GDAL and make it link with OpenJPEG lib.

Hi Joaquim,

Thanks for the prompt reply. Following your suggestion I did a
sudo port install gdal +openjpeg -v
(i.e. install gdal 3.1.2 with jp2 support using MacPorts)
and it seems to have done the trick.
Great.

Kind regards,
Norman

The recommended commands to install GMT using macports is:

sudo port install gdal +hdf5 +netcdf +openjpeg
sudo port install gmt6

See https://github.com/GenericMappingTools/gmt/blob/master/INSTALL.md#install-via-macports

Hi seisman,
cheers for that. I shall do a reinstall using these options.
Norman

Can someone help me with this same problem occurring in ubuntu-20.04 ?
A detailed procedure would be appreciated.