hydroflows.methods.events.Event#

class hydroflows.methods.events.Event(*, name: str, root: Path | None = None, forcings: List[Forcing], return_period: float | None = None, tstart: datetime | None = None, tstop: datetime | None = None)[source]#

Bases: BaseModel

A model event.

Examples

The event can be created as follows:

event = Event(
    name="event",
    forcings=[{"type": "rainfall", "path": "path/to/data.csv"}],
    return_period=2,
)
field name: str [Required]#

The name of the event.

field root: Path | None = None#

The root directory for the event forcing.

field forcings: List[Forcing] [Required]#

The list of forcings for the event. Each forcing is a dictionary with the structure as defined in Forcing.

field return_period: float | None = None#

The return period of the event [years].

field tstart: datetime | None = None#

The start date of the event.

field tstop: datetime | None = None#

The end date of the event.

model_config: ClassVar[ConfigDict] = {}#

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

to_dict(root: Path | None = None, **kwargs) dict[source]#

Return the Event as a dictionary.

to_yaml(path: Path) None[source]#

Write the Event to a YAML file.

classmethod from_yaml(path: Path) Event[source]#

Create an Event from a YAML file.

set_time_range_from_forcings() None[source]#

Set the time range from the data.

read_forcing_data() None[source]#

Read all forcings.