esmtools.stats.polyfit¶
-
esmtools.stats.
polyfit
(x, y=None, order=None, dim='time', nan_policy='none')[source]¶ Returns the fitted polynomial line of
y
regressed ontox
.Note
This will be released as a standard
xarray
func in 0.15.2.Parameters: - x (xarray object) – Independent variable used in the polynomial fit.
If
y
isNone
, treatx
as dependent variable. - y (xarray object) – Dependent variable used in the polynomial fit.
If
None
, treatx
as the independent variable. - order (int) – Order of polynomial fit to perform.
- dim (str, optional) – Dimension to apply polynomial fit over. Defaults to “time”.
- nan_policy (str, optional) –
Policy to use when handling nans. Defaults to “none”.
- ’none’, ‘propagate’: If a NaN exists anywhere on the given dimension,
- return nans for that whole dimension.
- ’raise’: If a NaN exists at all in the datasets, raise an error.
- ’omit’, ‘drop’: If a NaN exists in x or y, drop that index and
- compute the slope without it.
Returns: - The polynomial fit for
y
regressed ontox
. Has the same dimensions as
y
.
Return type: xarray object
- x (xarray object) – Independent variable used in the polynomial fit.
If