pastas.rfunc.Spline#

class pastas.rfunc.Spline(cutoff: float = 0.999, use_block: bool = True, kind: Literal['quadratic', 'cubic'] = 'quadratic', t: list[int] | None = None, **kwargs)#

Spline response function with parameters: A and a factor for every t.

Parameters:
  • cutoff (float, optional) – Fraction of the step response after which the response is truncated. This setting has no effect for this response function.

  • use_block (bool) – Must be True as Spline does not have an impulse response function

  • kind (str, optional) – Interpolation kind passed to scipy.interpolate.interp1d. Common choices are “quadratic” and “cubic”.

  • t (list[int], optional) – Times at which the response function is defined. Defaults to [1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024].

up#

Whether a positive stress causes the head to go up (True), down (False), or either direction (None).

Type:

bool or None, optional

gain_scale_factor#

Scale factor used to set the initial value and bounds of the gain parameter, computed as 1 / gain_scale_factor.

Type:

float, optional

Notes

The spline response function generates a response function from factors at t = 1, 2, 4, 8, 16, 32, 64, 128, 256, 512 and 1024 days by default. This response function is more data-driven than existing response functions and has no physical background. Therefore, it can primarily be used to compare to other more physical response functions, that probably describe the groundwater system better.

Example

>>> ml = ps.Model(obs, name="Spline")
>>> rfunc = ps.Spline(t=[1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024])
>>> sm = ps.RechargeModel(model=ml, prec=rain, evap=evap, rfunc=rfunc)
>>> ml.solve()
property nparam: int#

Number of parameters for the response function.

Returns:

Number of parameters (len(t) + 1 for Spline: A and one factor per time in t).

Return type:

int

Methods#

get_init_parameters(name) → pandas.DataFrame

Get initial parameters and bounds for the Spline response function.

get_tmax(p[, cutoff]) → float

Get response time for Spline response function.

gain(p) → float

Return the gain of the Spline response function.

step(p[, dt, cutoff, maxtmax]) → pastas.typing.ArrayLike

Return the step function for Spline response.

moment(p, order[, method, dt]) → float

Calculate the moment of a certain order for the Spline response function.

impulse(t, p) → pastas.typing.ArrayLike

Raise a NotImplementedError because Spline does not define an impulse response.

to_dict() → dict[str, Any]

Export the Spline response function object as a dictionary.