Pygmt.datasets.load_earth_relief ——Failed to download data

Dear all,

I am trying to download earth_relief data whose resolution is 05 m or higher, and usually what happens is that it does not download and report an error:
ValueError: did not find a match in any of xarray’s currently installed IO backends [‘netcdf4’, ‘scipy’]. Consider explicitly selecting one of the installed engines via the engine parameter, or installing additional IO dependencies, see:
Installation
Reading and writing files
However when the resolution is below than 05m, it can works. I think the reson is that

resolutions 05m and higher are tiled

But I don’t know how can I fix it?

Below is my code:

import pygmt
grid = pygmt.datasets.load_earth_relief(resolution=“01m”, region=[104,126,4,26])

Hello @xxxzzz32,

welcome to the GMT forum :slightly_smiling_face: !

Hm. Can you please try running:

import pygmt

fig = pygmt.Figure()
fig.grdimage(
    grid="@earth_relief_01m",
    region=[-10, 10, -10, 10],
    projection="M10c",
    cmap="oleron",
    frame=True,
)
fig.show()

Thank you very much for your reply! I tried to run your code but the problem seems to be harder to solve, do you have any idea how this could be resolved? Thank you again!

[Session pygmt-session (3)]: Error returned from GMT API: GMT_FILE_NOT_FOUND (16)
[Session pygmt-session (3)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session pygmt-session (3)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
[Session pygmt-session (3)]: Error returned from GMT API: GMT_GRID_READ_ERROR (18)
Error: /syntaxerror in /--%ztokenexec_continue--
Operand stack:
   PSL_eoclip
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   --nostringval--   false   1   %stopped_push   1990   1   3   %oparray_pop   1989   1   3   %oparray_pop   1977   1   3   %oparray_pop   1833   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:738/1123(ro)(G)--   --dict:0/20(G)--   --dict:75/200(L)--   --dict:147/250(L)--
Current allocation mode is local
psconvert [ERROR]: System call [@gswin64c -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/Bowen Xue/.gmt/sessions/gmt_session.10216/gmt_1.ps-" 2> "C:/Users/Bowen Xue/.gmt/sessions/gmt_session.10216/psconvert_1724c.bb"] returned error 1.
Traceback (most recent call last):
  File "D:\Personal Folders\SM-To-XBW\1-Papers\nanhai-SWOT\SWOT_07_area_plot_topo.py", line 45, in <module>
    fig.show()
  File "D:\Anaconda\envs\smenv\lib\site-packages\pygmt\figure.py", line 389, in show
    pdf = self._preview(fmt="pdf", dpi=dpi, anti_alias=False, as_bytes=False)
  File "D:\Anaconda\envs\smenv\lib\site-packages\pygmt\figure.py", line 448, in _preview
    self.savefig(fname, dpi=dpi, **kwargs)
  File "D:\Anaconda\envs\smenv\lib\site-packages\pygmt\figure.py", line 313, in savefig
    self.psconvert(prefix=prefix, fmt=fmt, crop=crop, **kwargs)
  File "D:\Anaconda\envs\smenv\lib\site-packages\pygmt\helpers\decorators.py", line 585, in new_module
    return module_func(*args, **kwargs)
  File "D:\Anaconda\envs\smenv\lib\site-packages\pygmt\helpers\decorators.py", line 725, in new_module
    return module_func(*args, **kwargs)
  File "D:\Anaconda\envs\smenv\lib\site-packages\pygmt\figure.py", line 248, in psconvert
    lib.call_module("psconvert", f"{prefix_arg} {build_arg_string(kwargs)}")
  File "D:\Anaconda\envs\smenv\lib\site-packages\pygmt\clib\session.py", line 502, in call_module
    raise GMTCLibError(
pygmt.exceptions.GMTCLibError: Module 'psconvert' failed with status code 79:
psconvert [ERROR]: System call [@gswin64c -q -dNOSAFER -dNOPAUSE -dBATCH -sDEVICE=bbox -DPSL_no_pagefill -dMaxBitmap=2147483647 -dUseFastColor=true "C:/Users/Bowen Xue/.gmt/sessions/gmt_session.10216/gmt_1.ps-" 2> "C:/Users/Bowen Xue/.gmt/sessions/gmt_session.10216/psconvert_1724c.bb"] returned error 1.
end [ERROR]: Failed to remove gmt_1.ps-! [remove error: Permission denied]
C:/Users/Bowen Xue/.gmt/sessions/gmt_session.10216: Directory not empty
end [WARNING]: Unable to remove directory C:/Users/Bowen Xue/.gmt/sessions/gmt_session.10216 [permissions?]

Can you please post the output of
python -c "import pygmt; pygmt.show_versions()" (in a terminal) or pygmt.show_versions() (directly in Jupyter notebook or any other IDE).

One side note: Just saw that some of your paths contain white spaces (D:\Personal Folders\SM-To-XBW, C:/Users/Bowen Xue/.gmt/session…). This can cause problems.

Thank you for your patience! I ran xxx in jupyter notebook with the following results:

I modified the program you gave above to 06m resolution or lower and the program works fine. So I think the resolution is causing the problem.

Thanks for posting the installation information!

It looks like you are using quite old versions, especially of PyGMT, GMT, and xarray. I think you should try updating to the latest versions of PyGMT (v0.12.0) and GMT (6.5), and xarray, and check if the error remains. (Please see Minimum Supported Versions — PyGMT for the minimum supported versions.)