hydroflows.methods.historical_events.historical_events#

Method to derive historical events with one or more drivers from timeseries data.

class hydroflows.methods.historical_events.historical_events.HistoricalEvents(events_dates: ~typing.Annotated[~typing.Dict[str, ~hydroflows._typing.EventInfoDict], ~pydantic.functional_validators.BeforeValidator(func=~hydroflows._typing.<lambda>, json_schema_input_type=PydanticUndefined)], discharge_nc: ~pathlib.Path = None, precip_nc: ~pathlib.Path = None, water_level_nc: ~pathlib.Path = None, output_dir: ~pathlib.Path = PosixPath('data/historical_events'), wildcard: str = 'event', **params)[source]#

Method to derive historical events with one or more drivers from timeseries data.

Parameters:
  • discharge_nc (Path, optional) – The file path to the discharge time series in NetCDF format.

  • precip_nc (Path, optional) – The file path to the rainfall time series in NetCDF format.

  • water_level_nc (Path, optional) – The file path to the water level time series in NetCDF format.

  • events_dates (Dict) – The dictionary mapping event names to their start and end date/time information. For example, events_dates = {“p_event”: {“startdate”: “1995-03-04 12:00”, “enddate”: “1995-03-05 14:00”}.

  • output_dir (Path, optional) – The directory where the derived historical events will be saved, by default “data/historical_events”.

  • wildcard (str, optional) – The wildcard key for expansion over the historical events, by default “event”.

  • **params – Additional parameters to pass to the HistoricalEvents instance.

Create a new expand method instance.

pydantic model hydroflows.methods.historical_events.historical_events.Input[source]#

Input parameters for the HistoricalEvents method.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field discharge_nc: Path | None = None#

The file path to the discharge time series in NetCDF format which is used to derive historical events. This file should contain a time and an index dimension, specified by the discharge_index_dim parameter, for several (gauge) locations.

The discharge time series can be produced either by the Wflow toolchain (via the hydroflows.methods.wflow.wflow_update_forcing.WflowBuild, hydroflows.methods.wflow.wflow_update_forcing.WflowUpdateForcing, and hydroflows.methods.wflow.wflow_run.WflowRun methods) or can be directly supplied by the user.

field precip_nc: Path | None = None#

The file path to the rainfall time series in NetCDF format which are used to derive the historical events of interest. This file should contain a time dimension. These time series can be derived either by the hydroflows.methods.rainfall.get_ERA5_rainfall.GetERA5Rainfall or can be directly supplied by the user.

field water_level_nc: Path | None = None#

The file path to the water level time series in NetCDF format which are used to derive the historical events of interest. This file should contain a time and an index dimension specified by the water_level_index_dim parameter for several locations.

The water level time series can be produced either after processing GTSM tide and surge data (can be obtained by the hydroflows.methods.coastal.get_gtsm_data.GetGTSMData method) or can be directly supplied by the user.

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

pydantic model hydroflows.methods.historical_events.historical_events.Output[source]#

Output parameters for the HistoricalEvents method.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field event_set_yaml: Path [Required]#

The path to the event set yml file, see also hydroflows.methods.events.EventSet.

field event_yaml: Annotated[Path, AfterValidator(func=filedir_validator)] [Required]#

The path to the event description file, see also hydroflows.methods.events.Event.

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.

pydantic model hydroflows.methods.historical_events.historical_events.Params[source]#

Parameters for HistoricalEvents method.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Fields:
field discharge_index_dim: str = 'Q_gauges'#

Index dimension of the discharge input time series provided in Input class.

field events_dates: <lambda>, json_schema_input_type=PydanticUndefined)] [Required]#

A dictionary containing event identifiers as keys and their corresponding date information as values. Each key is a string representing the event name (e.g., “historical_event01”), and each value is another dictionary that holds two keys: “startdate” and “enddate”. These keys map to string values that represent the start and end dates/times of the event, for example:

events_dates = { “historical_event01”: {“startdate”: “1995-03-04 12:00”, “enddate”: “1995-03-05 14:00”}, }

field output_dir: Annotated[Path, AfterValidator(func=outputdirpath_validator)] [Required]#

Directory to save the derived historical events.

field time_dim: str = 'time'#

Time dimension of the input time series provided in Input class.

field water_level_index_dim: str = 'wl_locs'#

Index dimension of the water level input time series provided in Input class.

field wildcard: str = 'event'#

The wildcard key for expansion over the historical events.

model_post_init(context: Any, /) None#

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:
  • self – The BaseModel instance.

  • context – The context.