geocat.comp.stats.pearson_r#
- geocat.comp.stats.pearson_r(a, b, dim=None, weights=None, skipna=False, keep_attrs=False, axis=None)#
This function wraps the function of the same name from xskillscore. The difference between the xskillscore version and this one is that the GeoCAT version allows for array-like inputs rather than only supporting
xarray.DataArrays. The parameters work the same way as in the xskillscore version, with an added parameteraxis(see below).- Parameters:
a (
xarray.DataArray,xarray.Dataset,numpy.ndarray) – Arrays over which to apply the function.b (
xarray.DataArray,xarray.Dataset,numpy.ndarray) – Arrays over which to apply the function.dim (
str,list, optional) – The dimension(s) to apply the correlation along. Note that this dimension will be reduced as a result. Defaults toNonereducing all dimensions. Only used whenaandbare of typexarray.DataArrayorxarray.Dataset.weights (
xarray.DataArray,numpy.ndarray, optional) – Weights matching dimensions ofdimto apply during the function.skipna (
bool, optional) – If True, skip NaNs when computing function.keep_attrs (
bool, optional) – If True, the attributes (attrs) will be copied from the first input to the new one. If False (default), the new object will be returned without attributes. Only used whenaandbare of typesxarray.Datasetorxarray.DataArray.axis (
int) – The axis to apply the correlation along. Only used whenaandbare of typenp.ndarrayor are array-like.
- Returns:
r (
xarray.DataArray,numpy.ndarray) – Pearson’s correlation coefficient