pastas.stressmodels.RechargeModel#

class pastas.stressmodels.RechargeModel(prec: pandas.Series, evap: pandas.Series, rfunc: pastas.typing.RFunc | None = None, name: str = 'recharge', recharge: pastas.typing.Recharge | None = None, temp: pandas.Series | None = None, settings: tuple[str | pastas.typing.StressSettingsDict, str | pastas.typing.StressSettingsDict, str | pastas.typing.StressSettingsDict] = ('prec', 'evap', 'evap'), metadata: tuple[dict | None, dict | None, dict | None] = (None, None, None), max_cache_size: int = None)#

Stressmodel simulating the effect of groundwater recharge on the head.

Parameters:
  • prec (pandas.Series) – pandas.Series with pandas.DatetimeIndex containing the precipitation series. The precipitation series should be provided in mm/day when a nonlinear model is used.

  • evap (pandas.Series) – pandas.Series with pandas.DatetimeIndex containing the potential evaporation series. The evaporation series should be provided in mm/day when a nonlinear model is used.

  • rfunc (pastas.rfunc instance, optional) – Instance of the response function used in the convolution with the stress. Default is ps.Exponential().

  • name (str, optional) – Name of the stress. Default is “recharge”.

  • recharge (pastas.recharge instance, optional) – Instance of a recharge model. Options are: Linear, FlexModel and Berendrecht. These can be accessed through ps.rch. Default is ps.rch.Linear().

  • temp (pandas.Series, optional) – pandas.Series with pandas.DatetimeIndex containing the temperature series. It depends on the recharge model if this argument is required or not. The temperature series should be provided in degrees Celsius.

  • settings (list of dicts or str, optional) – The settings of the precipitation, evaporation and optionally temperature time series, in this order. By default (“prec”, “evap”, “evap”). 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 Time Series Settings section below for more information.

  • metadata (tuple of dicts or list of dicts, optional) – dictionary containing metadata about the stress. This is passed onto the TimeSeries object.

  • max_cache_size (int, optional) – Maximum size of the cache (in number of entries). Only used when cachetools is installed and caching is enabled (see ps.set_use_cache()).

Examples

>>> sm = ps.RechargeModel(rain, evap, rfunc=ps.Exponential(),
>>>                       recharge=ps.rch.FlexModel(), name="rch")
>>> ml.add_stressmodel(sm)
Parameters:
  • settings (Time series)

  • 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 stress model computes the contribution of precipitation and potential evaporation in two steps. In the first step a recharge flux is computed by a model determined by the input argument recharge. In the second step this recharge flux is convolved with a response function to obtain the contribution of recharge to the groundwater levels. If a nonlinear recharge model is used, the precipitation should be in mm/d.

Warning

We recommend not to store a RechargeModel is a variable named rm. This name is already reserved in IPython to remove files and will cause problems later.

Raises:
  • A warning if the the maximum annual precipitation is smaller than 12 and a

  • nonlinear recharge model is applied. This is likely an indication that the units of

  • the precipitation series are in m/d instead of mm/d. Please check the units of the

  • precipitation series.

Methods#

set_init_parameters(→ None)

Internal method to set the initial parameters.

update_stress(→ None)

Method to update the settings of the all stresses in the stress model.

get_stress(→ pandas.Series)

Method to obtain the recharge stress calculated by the model.

get_water_balance(→ pandas.DataFrame)

Method to obtain the water balance components.

get_parameters(→ pastas.typing.ArrayLike)

Get parameters and return as array.

to_dict(→ dict)

Method to export the RechargeModel object.