geocat.comp.polynomial._ndpolyfit
geocat.comp.polynomial._ndpolyfit#
- geocat.comp.polynomial._ndpolyfit(x, y, axis=0, deg=1, rcond=None, full=False, w=None, cov=False, missing_value=nan, xarray_output=True)#
An extension to
numpy.polyfit
function to support multi-dimensional arrays, Dask arrays, and missing values.- Parameters
x (array_like) – X-coordinate, an iterable object of shape
(M,)
,(M, 1)
, or(1, M)
whereM = y.shape(axis)
. It cannot havenan
or missing values.y (array_like) – Y-coordinate, an iterable containing the data. It could be list,
numpy.ndarray
,xarray.DataArray
, Dask array. or any Iterable convertible tonumpy.ndarray
. In case of Dask Array, The data could be chunked. It is recommended not to chunk along theaxis
provided.axis (
int
, optional) – Axis to fit the polynomial to. Defaults to 0.deg (
int
, optional) – Degree of the fitting polynomial. Defaults to 1.rcond (
float
, optional) – Relative condition number of the fit. Defaults toNone
. Refer tonumpy.polyfit
for further details.full (
bool
, optional) – Switch determining nature of return value. Defaults to False. Refer tonumpy.polyfit
for further details.w (array_like, optional) – Weights applied to the y-coordinates of the sample points. Defaults to
None
. Refer tonumpy.polyfit
for further details.cov (
bool
, optional) – Determines whether to return the covariance matrix. Defaults to False. Refer tonumpy.polyfit
for further details.missing_value (
int
,float
, ornan
, optional) – The value to be treated as missing. Default isnumpy.nan
xarray_output (
bool
, optional) – Determines the type of the output. If set toTrue
the output would be of typexarray.DataArray
and the some extra information are attached to the output as attributes. Otherwise, the output would be of typenumpy.ndarray
containing only the coefficients of the fitted polynomial. Defaults to True.
- Returns
coefficients (:class:
xarray.DataArray
ornumpy.ndarray
) – An array containing the coefficients of the fitted polynomial.