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) where M = y.shape(axis). It cannot have nan 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 to numpy.ndarray. In case of Dask Array, The data could be chunked. It is recommended not to chunk along the axis 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 to None. Refer to numpy.polyfit for further details.

  • full (bool, optional) – Switch determining nature of return value. Defaults to False. Refer to numpy.polyfit for further details.

  • w (array_like, optional) – Weights applied to the y-coordinates of the sample points. Defaults to None. Refer to numpy.polyfit for further details.

  • cov (bool, optional) – Determines whether to return the covariance matrix. Defaults to False. Refer to numpy.polyfit for further details.

  • missing_value (int, float, or nan, optional) – The value to be treated as missing. Default is numpy.nan

  • xarray_output (bool, optional) – Determines the type of the output. If set to True the output would be of type xarray.DataArray and the some extra information are attached to the output as attributes. Otherwise, the output would be of type numpy.ndarray containing only the coefficients of the fitted polynomial. Defaults to True.

Returns

coefficients (xarray.DataArray or numpy.ndarray) – An array containing the coefficients of the fitted polynomial.