GenericMappingTools / gmt

The Generic Mapping Tools
https://www.generic-mapping-tools.org
Other
858 stars 359 forks source link

Better error message for server connection errors #2119

Closed seisman closed 7 months ago

seisman commented 4 years ago

Sometimes, we may have intermittent network issues and fail to download some files. GMT reports errors likes:

movie [ERROR]: Libcurl Error: Couldn't connect to server
movie [ERROR]: You can turn remote file download off by setting GMT_DATA_SERVER_LIMIT = 0.

Is it possible to provide more information? For example.

PaulWessel commented 4 years ago

OK, will see what information is available when it fails. But for certain we know what it is trying to download when it fails so we can add more information. I experience the same thing from time to time.

MarkWieczorek commented 4 years ago

I get the following error in pygmt from time to time when plotting my own data. Why would gmt be trying to download these files at all? At a very minimum, this should return a warning as opposed to an error.

grdimage [ERROR]: Unable to download file https://oceania.generic-mapping-tools.org/gmt_hash_server.txt
grdimage [ERROR]: Libcurl Error: Timeout was reached
grdimage [ERROR]: GMT data server may be down - delay checking hash file for 24 hours
grdimage [ERROR]: You can turn remote file download off by setting GMT_DATA_SERVER_LIMIT = 0.
grdimage [ERROR]: Unable to obtain remote file @GMTAPI@-000000
grdimage [ERROR]: File GMTAPI@-000000 not found
[Session pygmt-session (4)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16)
seisman commented 4 years ago

I think GMT only tries to download the hash table (gmt_hash_server.txt) if a remote file (file with a leading "@") is required.

I see two possible issues here:

  1. It seems GMT takes @GMTAPI@-000000 as a remote file.
  2. As @MarkWieczorek suggested, failing to download gmt_hash_server.txt should be a warning instead of an error.
PaulWessel commented 4 years ago

We have explicit checks to not download @GMTAPI@-###### files and I have not seen that before. COuld you tell me the circumstance in which it happened. I know you use pygmt.

MarkWieczorek commented 4 years ago

The circumstance is very banal: I have a grid stored as a local xarray, and I am using grdimage to plot it. Here is an example if you want to check out a different problem! https://github.com/GenericMappingTools/pygmt/issues/375

seisman commented 4 years ago

I tried @MarkWieczorek's script in GenericMappingTools/pygmt#375. The first few lines of debug messages are:

grdimage [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
grdimage [DEBUG]: Map distance calculation will be using great circle approximation with authalic auxiliary latitudes and authalic (R_2) radius = 6371007.1809 m, in meter.
grdimage [DEBUG]: Look for file @GMTAPI@-000000 in /Users/seisman/.gmt
grdimage [DEBUG]: Look for file @GMTAPI@-000000 in /Users/seisman/.gmt/cache
grdimage [DEBUG]: Look for file @GMTAPI@-000000 in /Users/seisman/.gmt/server
grdimage [DEBUG]: Look for file @GMTAPI@-000000 in /Users/seisman/.gmt/server/srtm1
grdimage [DEBUG]: Look for file @GMTAPI@-000000 in /Users/seisman/.gmt/server/srtm3
grdimage [INFORMATION]: Read header from file @GMTAPI@-000000
grdimage [DEBUG]: Local file /Users/seisman/.gmt/server/gmt_hash_server.txt found
grdimage [DEBUG]: File /Users/seisman/.gmt/server/gmt_hash_server.txt less than 24 hours old, refresh is premature.
grdimage [DEBUG]: api_begin_io: Input resource access is now enabled [container]
seisman commented 4 years ago

@PaulWessel I'm reopening it since there are still some unsolved issues here.

PaulWessel commented 4 years ago

OK, fine.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed if no further activity occurs within 7 days. Thank you for your contributions.

joa-quim commented 8 months ago

Can we close this?