I have used grdcut calls to the remote data server to download digital topography for plotting. Recently (about the time I converted my code to modern mode and started using GMT v6.5.0) I am having a problem where the request seems to be going to the static data server, which doesn’t have the requested files. I’m not sure it’s a problem with the actual call in my script though. I tried one of the examples from the manual page for grdcut and got the same error:
gmt grdcut @earth_relief_02m -R160/20/220/30+r -Joc190/25.5/292/69/1 -Gdata.nc
grdblend [NOTICE]: SRTM15 Earth Relief at 02x02 arc minutes reduced by Gaussian Cartesian filtering (3.8 km fullwidth) [Tozer et al., 2019].
grdblend [NOTICE]: → Download 60x60 degree grid tile (earth_relief_02m_g): S30E120
grdblend [ERROR]: Libcurl Error: HTTP response code said error
grdblend [ERROR]: Probably means @S30E120.earth_relief_02m_g.nc does not exist on the remote server
grdblend [ERROR]: Unable to obtain remote file @S30E120.earth_relief_02m_g.nc
This is with the default server in Hawaii but I got the same result when I switched to the West Coast data server. I expect I’ve done something wrong in the setup of GMT, but everything else works fine. Any hints about where the problem lies will be greatly appreciated.
Eric
Hi Eric.
If you got a message that says that GMT is using the static server, then you have to change the default server to Oceania or another closer to you.
Estaban, I see the same “file not found” error with the default data server. That’s what I have used for many years. I only tried the alternate data server as a test, although according to the Manual I should probably make the West Coast mirror my data server, since it is closer.
I sorted out some of the problem I was having (some basic misunderstandings) and got further along in the process of using DEMs from a remote data server, but I’m getting stuck on file conversion/compression. I’m trying to use the get command to download the earth-relief data at a resolution of 1 arc-minute and lower, with the command
gmt get -Ddata=earth_relief -I1m -V
with oceania as the data server:
gmtget [NOTICE]: Remote data courtesy of GMT data server oceania [http://oceania.generic-mapping-tools.org]
It successfully downloads the 1-degree files (in both registrations) in ~.grd format, but then it starts on the 1-minute files, downloads the first file (S90W180) in ~.jp2 format and fails on the conversion to netCDF:
gmtget [INFORMATION]: Convert SRTM tile from JPEG2000 to netCDF grid [/Users/eab/.gmt/server/earth/earth_relief/earth_relief_01m_g/S90W180.earth_relief_01m_g.nc]
ERROR 4: `/Users/eab/.gmt/server/earth/earth_relief/earth_relief_01m_g/S90W180.earth_relief_01m_g.jp2’ not recognized as a supported file format.
Eric
I run this command and works fine for me. I got these messages. This that GDAL converts the jp2 formats. Would it be possible that you have an issue with GDAL?
gmtget [INFORMATION]: Downloading file http://oceania.generic-mapping-tools.org/server/earth/earth_relief/earth_relief_01m_g/S60W060.earth_relief_01m_g.jp2 ...
gmtget [INFORMATION]: Convert SRTM tile from JPEG2000 to netCDF grid [/home/esteban82/.gmt/server/earth/earth_relief/earth_relief_01m_g/S60W060.earth_relief_01m_g.nc]
grdconvert [INFORMATION]: File /home/esteban82/.gmt/server/earth/earth_relief/earth_relief_01m_g/S60W060.earth_relief_01m_g.jp2 reads with GDAL driver JP2OpenJPEG
grdconvert [INFORMATION]: Translating file /home/esteban82/.gmt/server/earth/earth_relief/earth_relief_01m_g/S60W060.earth_relief_01m_g.jp2 (format gd = Import/export through GDAL) to file /home/esteban82/.gmt/server/earth/earth_relief/earth_relief_01m_g/S60W060.earth_relief_01m_g.nc (format ns = GMT netCDF format (16-bit integer), CF-1.7)
grdconvert [INFORMATION]: File /home/esteban82/.gmt/server/earth/earth_relief/earth_relief_01m_g/S60W060.earth_relief_01m_g.jp2 reads with GDAL driver JP2OpenJPEG
grdconvert [INFORMATION]: Reading grid from file /home/esteban82/.gmt/server/earth/earth_relief/earth_relief_01m_g/S60W060.earth_relief_01m_g.jp2
I think you are right, Estaban. Is there anything that needs to be done during or after installation of GMT to enable it to use GDAL libraries? I thought it was built-in to the GMT installation.
If you installed it with a binary package, then I think it should work. Maybe something happened to gdal.
If you installed from source, them you have to install gdal by yourself.
GMT requires GDAL to be built, but GDAL may have a variable number of drivers and yours seems to lack the OpenJPEG driver and hence fails to convert the .jp2 files.
I installed GDAL with HomeBrew yesterday but it should have also been installed with GMT (not built from source). Some GDAL files are installed in /opt/homebrew/bin and some in /opt/homebrew/Cellar/gdal, but I don’t see an “OpenJPEG” file anywhere, so that seems to be the issue. I will work on this.
Run
gdalinfo --formats | sort
to see which drivers you have available.
It took a while to come back from that command and started out with a series of error messages like:
ERROR 1: PROJ: proj_create: no database context specified
ERROR 1: Cannot parse CRS http://www.opengis.net/def/crs/EPSG/0/5482
after which it did list many drivers, among which is
JP2OpenJPEG -raster,vector- (rwv): JPEG-2000 driver based on JP2OpenJPEG library (*.jp2, *.j2k)
But I cannot find anything that looks like the appropriate file. Where should that driver be found? Perhaps those error messages are relevant.
Thanks for your help!
The error messages are important, though not always fatal. It means the PROJ library installation has issues. There is an env variable that set to point to where the PROJ database (proj.db
and some more) are located. But should have been taken care by Homebrew (I think).
A driver
is a internal code that gets compiled into the GDAL lib (well, there are also the plugins
but let’s not complicate) and we don’t see them. But you have the needed driver so I don’t understand what is erroring. You could try to use the gdal_translate
GDAL program to convert the .jp2 files to .nc and see if some more meaningful error messages pops up.
Many thanks for your help, Joaquim. I will try the translation by hand, but I’m thinking about just uninstalling everything and doing a fresh install. Is it the case, then, that a standard installation of GMT will still need a separate installation of GDAL in order to make use of the remote data sets? The Manual says that an installation of GMT from GitHub comes with GDAL pre-installed. But perhaps not with the necessary JPEG2000 driver?
No. To build GMT (which is what brew does), one need to have all the dependencies previously installed.
Don’t know where that is. Only the Windows installer and the Mac DMG come with all the dependencies pre-packaged.
Removing and reinstalling is always something to try.