Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving ERA5 netcdf from deltares_data without a timerange results in a ValueError #1007

Open
2 tasks done
Tjalling-dejong opened this issue Jun 21, 2024 · 0 comments
Open
2 tasks done
Labels
Bug Something isn't working Needs refinement issue still needs refinement

Comments

@Tjalling-dejong
Copy link
Contributor

HydroMT version checks

  • I have checked that this issue has not already been reported.
  • I have checked that this bug exists on the latest version of HydroMT.

Reproducible Example

from hydromt import DataCatalog

dc = DataCatalog("deltares_data")

era5 = dc.get_rasterdataset("era5", bbox=[4.2555,51.9489,4.5636,52.146], provider="netcdf")

Current behaviour

The above code will produce the following error:

File "C:\Users\jong\Projects\HydroMT\hydromt\hydromt\data_catalog\uri_resolvers\convention_resolver.py", line 192, in resolve
    self._resolve_wildcards(
  File "C:\Users\jong\Projects\HydroMT\hydromt\hydromt\data_catalog\uri_resolvers\convention_resolver.py", line 117, in _resolve_wildcards
    reduce(
  File "C:\Users\jong\Projects\HydroMT\hydromt\hydromt\data_catalog\uri_resolvers\convention_resolver.py", line 118, in <lambda>
    lambda uri_res, uri: uri_res + [split_and_glob(uri)], uris, []
  File "C:\Users\jong\Projects\HydroMT\hydromt\hydromt\data_catalog\uri_resolvers\convention_resolver.py", line 96, in split_and_glob
    return (protocol, fs.glob(uri))
  File "C:\Users\jong\Projects\HydroMT\hydromt\.pixi\envs\default\lib\site-packages\fsspec\spec.py", line 613, in glob
    pattern = glob_translate(path + ("/" if ends_with_sep else ""))
  File "C:\Users\jong\Projects\HydroMT\hydromt\.pixi\envs\default\lib\site-packages\fsspec\utils.py", line 732, in glob_translate
    raise ValueError(
ValueError: Invalid pattern: '**' can only be an entire path component

This caused by glob receiving the following path: meteo/era5_daily/nc_merged/era5_**_daily.nc

Desired behaviour

The above code should return a xarray dataset or a clear warning/error that it is not possible to retrieve the data without specifying a time range.

Additional context

No response

@Tjalling-dejong Tjalling-dejong added Bug Something isn't working Needs refinement issue still needs refinement labels Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Needs refinement issue still needs refinement
Projects
None yet
Development

No branches or pull requests

1 participant