Skip to content

Add option to set date when using HazardForecast.from_xarray_raster #1305

Description

@peanutfun

We currently hardcoded that HazardForecast.date is always set to zero when reading in xarray raster data. This was decided because it remains unclear if date encodes the forecast date or the valid date (forecast date + lead time).

It might be useful to only use this setting as a default. When the user explicitly sets, e.g., data_vars={"date": "valid_time"}, the appropriate data should be loaded from the dataset. This is currently not possible (it technically is, but the read data is always overwritten by the hardcoded zeros).

Zeros hardcoded here:

kwargs["date"] = np.zeros_like(kwargs["date"], dtype=int)

This line should only apply if the user did not supply data_vars={"date": ...}

Metadata

Metadata

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions