Deltares / hydromt

HydroMT: Automated and reproducible model building and analysis
https://deltares.github.io/hydromt/
MIT License
68 stars 28 forks source link

Loading raster data doesn't seem to work with webdav #1033

Open jensdebruijn opened 1 month ago

jensdebruijn commented 1 month ago

HydroMT version checks

Reproducible Example

import hydromt
import fsspec
import rioxarray

data_catalog = hydromt.DataCatalog(data_libs=["data_catalog.yml"])

# This results in an error
# rasterio.errors.RasterioIOError: webdav+https://files.isric.org/soilgrids/latest/data/sand/sand_0-5cm_mean.vrt: No such file or directory
# soilgrids = data_catalog.get_rasterdataset("soilgrids_test")

# but using fsspec directly works
soilgrids = data_catalog.get_source("soilgrids_test")
with fsspec.open(
    soilgrids.path,
    mode="rb",
    base_url=soilgrids.storage_options["base_url"],
) as f:
    da = rioxarray.open_rasterio(
        f,
    ).squeeze(drop=True)

    print(da)

data_catalog.yml:

soilgrids_test: data_type: RasterDataset driver: raster filesystem: webdav path: webdav://soilgrids/latest/data/sand/sand_0-5cm_mean.vrt storage_options: base_url: https://files.isric.org

Current behaviour

The data doesn't load, but results in the following error:

rasterio.errors.RasterioIOError: webdav+https://files.isric.org/soilgrids/latest/data/sand/sand_0-5cm_mean.vrt: No such file or directory

Desired behaviour

The data is loaded using webdav

Additional context

No response

Jaapel commented 3 weeks ago

Hi @jensdebruijn , thanks for reporting. This issue may be solved in v1: https://github.com/Deltares/hydromt/pull/1026.