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.polyfitfunction 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 havenanor 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 theaxisprovided.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.polyfitfor further details.full (
bool, optional) – Switch determining nature of return value. Defaults to False. Refer tonumpy.polyfitfor further details.w (array_like, optional) – Weights applied to the y-coordinates of the sample points. Defaults to
None. Refer tonumpy.polyfitfor further details.cov (
bool, optional) – Determines whether to return the covariance matrix. Defaults to False. Refer tonumpy.polyfitfor further details.missing_value (
int,float, ornan, optional) – The value to be treated as missing. Default isnumpy.nanxarray_output (
bool, optional) – Determines the type of the output. If set toTruethe output would be of typexarray.DataArrayand the some extra information are attached to the output as attributes. Otherwise, the output would be of typenumpy.ndarraycontaining only the coefficients of the fitted polynomial. Defaults to True.
- Returns
coefficients (:class:
xarray.DataArrayornumpy.ndarray) – An array containing the coefficients of the fitted polynomial.