pastas.stressmodels.ChangeModel#

class pastas.stressmodels.ChangeModel(stress: pandas.Series, rfunc1: pastas.typing.RFunc, rfunc2: pastas.typing.RFunc, tchange: str | pandas.Timestamp, name: str = 'change', up: bool = True, settings: str | pastas.typing.StressSettingsDict | None = None, metadata: dict | None = None)#

Model where the response function changes from one to another over time.

Parameters:
  • stress (pandas.Series) – pandas Series object containing the stress.

  • rfunc1 (pastas.rfunc instance) – The instance of the response function used in the convolution with the stress.

  • rfunc2 (pastas.rfunc instance) – The instance of the response function used in the convolution with the stress.

  • tchange (str | pandas.Timestamp) – string with the approximate date of the change.

  • name (str) – Name of the stressmodel. Default is “change”.

  • up (bool or None, optional) – True if response function is positive (default), False if negative. None if you don’t want to define if response is positive or negative.

  • settings (Time series) – The settings of the stress. This can be a string referring to a predefined settings dict (defined in ps.rcParams[“timeseries”]), or a dict with the settings to apply. For more information, refer to the docs of pastas.Timeseries for further information.

  • metadata (dict, optional) – dictionary containing metadata about the stress. This is passed onto the TimeSeries object.

  • settings

  • fill_nan ({"drop", "mean", "interpolate"} or float) –

    Method for filling NaNs.
    • drop: drop NaNs from time series

    • mean: fill NaNs with mean value of time series

    • interpolate: fill NaNs by interpolating between finite values

    • float: fill NaN with provided value, e.g. 0.0

  • fill_before ({"mean", "bfill"} or float) –

    Method for extending time series into past.
    • mean: extend time series into past with mean value of time series

    • bfill: extend time series into past by back-filling first value

    • float: extend time series into past with provided value, e.g. 0.0

  • fill_after ({"mean", "ffill"} or float) –

    Method for extending time series into future.
    • mean: extend time series into future with mean value of time series

    • ffill: extend time series into future by forward-filling last value

    • float: extend time series into future with provided value, e.g. 0.0

  • sample_up ({"mean", "interpolate", "divide"} or float) –

    Method for up-sampling time series (increasing frequency, e.g. going from weekly to daily values).

    • bfill or backfill: fill up-sampled time steps by back-filling current values

    • ffill or pad: fill up-sampled time steps by forward-filling current values

    • mean: fill up-sampled time steps with mean of timeseries

    • interpolate: fill up-sampled time steps by interpolating between current values

    • divide: fill up-sampled steps with current value divided by length of current time steps (i.e. spread value over new time steps).

  • sample_down ({"mean", "drop", "sum", "min", "max"}) –

    Method for down-sampling time series (decreasing frequency, e.g. going from daily to weekly values).

    • mean: resample time series by taking the mean

    • drop: resample the time series by taking the mean, dropping any NaN-values

    • sum: resample time series by summing values

    • max: resample time series with maximum value

    • min: resample time series with minimum value

Notes

This model is based on Obergfell et al. [2019].

property stress: pastas.timeseries.TimeSeries#

Return the stress time series.

property stresses: tuple[pastas.timeseries.TimeSeries]#

Return the stress time series as a tuple.

property nsplit: int#

Determine in how many time series the contribution can be split.

Methods#

set_stress(→ None)

Set the stress time series.

set_init_parameters(→ None)

Set the initial parameters (back) to their default values.

simulate(→ pandas.Series)

Simulate the stress model contribution.

to_dict([series])

Export the stress model to a dictionary.