Skip to content

Cannot download 03s gebco data #4238

@FilLTP89

Description

@FilLTP89

Description of the problem

The edit in load_remote_dataset.py, removing the lines:

fname = f"@{prefix}_{resolution}_{reg}"
    kind = "image" if name in {"earth_day", "earth_night"} else "grid"
    kwdict = {"R": region, "T": {"grid": "g", "image": "i"}[kind]}
    with Session() as lib:
        with lib.virtualfile_out(kind=kind) as voutgrd:
            lib.call_module(
                module="read",
                args=[fname, voutgrd, *build_arg_list(kwdict)],
            )
            grid = lib.virtualfile_to_raster(kind=kind, outgrid=None, vfname=voutgrd)

    # Full path to the grid if not tiled grids.
    source = which(fname, download="a") if not resinfo.tiled else None
    # Manually add source to xarray.DataArray encoding to make the GMT accessors work.
    if source:
        grid.encoding["source"] = source

and replaced them with:

fname = f"@{prefix}_{resolution}_{reg}"
    grid = xr.load_dataarray(
        fname, engine="gmt", raster_kind=dataset.kind, region=region
    )

leads to error when attempting at downloading gebco data with 03s and 01s resolution.

Minimal Complete Verifiable Example

import pygmt
topography=pygmt.datasets.load_earth_relief(region=(20.2,20.9,38,38.54),resolution="03s",da\
ta_source="gebco")

Full error message

Traceback (most recent call last):
  File "<python-input-1>", line 1, in <module>
    topography=pygmt.datasets.load_earth_relief(region=(20.2,20.9,38,38.54),resolution="03s",data_source="gebco")
  File "/app/easyrisk/lib/python3.13/site-packages/pygmt/datasets/earth_relief.py", line 180, in load_earth_relief
    grid = _load_remote_dataset(
        name=name,
    ...<3 lines>...
        registration=registration,
    )
  File "/app/easyrisk/lib/python3.13/site-packages/pygmt/datasets/load_remote_dataset.py", line 582, in _load_remote_dataset
    grid = xr.load_dataarray(
        fname, engine="gmt", raster_kind=dataset.kind, region=region
    )
  File "/app/easyrisk/lib/python3.13/site-packages/xarray/backends/api.py", line 191, in load_dataarray
    with open_dataarray(filename_or_obj, **kwargs) as da:
         ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/easyrisk/lib/python3.13/site-packages/xarray/backends/api.py", line 813, in open_dataarray
    dataset = open_dataset(
        filename_or_obj,
    ...<16 lines>...
        **kwargs,
    )
  File "/app/easyrisk/lib/python3.13/site-packages/xarray/backends/api.py", line 606, in open_dataset
    backend_ds = backend.open_dataset(
        filename_or_obj,
    ...<2 lines>...
        **kwargs,
    )
  File "/app/easyrisk/lib/python3.13/site-packages/pygmt/helpers/decorators.py", line 742, in new_module
    return module_func(*bound.args, **bound.kwargs)
  File "/app/easyrisk/lib/python3.13/site-packages/pygmt/xarray/backend.py", line 149, in open_dataset
    source: str | list = which(fname=filename_or_obj, verbose="quiet")
                         ~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/easyrisk/lib/python3.13/site-packages/pygmt/helpers/decorators.py", line 576, in new_module
    return module_func(*args, **kwargs)
  File "/app/easyrisk/lib/python3.13/site-packages/pygmt/src/which.py", line 88, in which
    raise FileNotFoundError(msg)
FileNotFoundError: File(s) '@earth_gebco_03s_g' not found.

System information

PyGMT information:
  version: v0.17.0
System information:
  python: 3.13.9 (main, Oct 15 2025, 14:56:22) [GCC 15.2.0]
  executable: /app/easyrisk/bin/python
  machine: Linux-6.17.0-7-generic-x86_64-with-glibc2.41
Dependency information:
  numpy: 2.3.5
  pandas: 2.3.3
  xarray: 2025.11.0
  packaging: 25.0
  contextily: 1.7.0
  geopandas: 1.1.1
  IPython: 9.7.0
  pyarrow: 22.0.0
  rioxarray: 0.20.0
  gdal: 3.12.0
  ghostscript: None
GMT library information:
  version: 6.7.0
  padding: 2
  share dir: /usr/local/share
  plugin dir: /usr/local/lib/gmt/plugins
  library path: /usr/local/lib/libgmt.so
  cores: 16
  grid layout: rows
  image layout: 
  binary version: 6.7.0_d385d91_2025.11.18
WARNING:
  Ghostscript is not detected. Your installation may be broken.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingduplicateThis issue or pull request already exists

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions