trend_predict
trend_predict(tr, index)Evaluate a trend model.
Builds the trend model named by tr (a :class:corehydropy.models.Trend) from its own class defaults, then evaluates it at index. tr.parameter (which distribution parameter the trend attaches to) is not used here – this evaluates the trend model on its own, the same way the model-attachment path’s type dispatch does before it further data-drives the parameter values from a live model’s distribution and data (this function has no such model to consult, so a tr with no explicit values predicts from the trend’s own zero-valued class defaults).
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| tr | corehydropy.models.Trend | From :func:corehydropy.models.trend. |
required |
| index | array_like | 1-based time indices to evaluate at. | required |
Returns
| Name | Type | Description |
|---|---|---|
| numpy.ndarray |
Examples
>>> from corehydropy import trend, trend_predict
>>> tr = trend("location", "Linear", start_index=0, values=[10, 2])
>>> trend_predict(tr, [1, 2, 3, 4, 5])
array([10., 12., 14., 16., 18.])