Deltares / hydromt

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

Datacatalog.get_source_time_range() will error if the source does not have a time dimension #685

Open Tjalling-dejong opened 8 months ago

Tjalling-dejong commented 8 months ago

HydroMT version checks

Reproducible Example

Using deltares data catalog:

datacatalog.get_source_time_range("gcn250")

Current behaviour

Will result in a key error because ds.raster.time_dim is None in ds[ds.raster.time_dim].min().values

Desired behaviour

If the source does not have a time dimension it should give back a warning. I suggest to raise a TypeError when ds.raster.time_dim is None in detect_time_range() in the rasterdataset adapter.

Additional context

No response

savente93 commented 8 months ago

indeed definitely good to have a better error. This might also be a nice place for the new NoDataStrategy pattern so we give users flexibility in this.