xarray.DataArray.polyfit (original) (raw)

DataArray.polyfit(dim, deg, skipna=None, rcond=None, w=None, full=False, cov=False)[source]#

Least squares polynomial fit.

This replicates the behaviour of numpy.polyfit but differs by skipping invalid values when skipna = True.

Parameters:

Returns:

polyfit_results (Dataset) – A single dataset which contains:

polyfit_coefficients

The coefficients of the best fit.

polyfit_residuals

The residuals of the least-square computation (only included if full=True). When the matrix rank is deficient, np.nan is returned.

[dim]_matrix_rank

The effective rank of the scaled Vandermonde coefficient matrix (only included if full=True)

[dim]_singular_value

The singular values of the scaled Vandermonde coefficient matrix (only included if full=True)

polyfit_covariance

The covariance matrix of the polynomial coefficient estimates (only included if full=False and cov=True)