xdem.spatialstats.infer_spatial_correlation_from_stable#
- xdem.spatialstats.infer_spatial_correlation_from_stable(dvalues, list_models, stable_mask=None, unstable_mask=None, errors=None, estimator='dowd', gsd=None, coords=None, subsample=1000, subsample_method='cdist_equidistant', n_variograms=1, n_jobs=1, bounds=None, p0=None, random_state=None, **kwargs)[source]#
Infer spatial correlation of errors from differenced values on stable terrain and a list of variogram model to fit as a sum.
This function returns a dataframe of the empirical variogram, a dataframe of optimized model parameters, and a spatial correlation function. The spatial correlation is returned as a function of spatial lags (in units of the input coordinates) which gives a correlation value between 0 and 1. It is a convenience wrapper for estimate_model_spatial_correlation to work on either Raster or array and compute the stable mask.
If no stable or unstable mask is provided to mask in or out the values, all terrain is used.
- Parameters:
dvalues (
Union
[ndarray
[Any
,dtype
[floating
[Any
]]],TypeVar
(RasterType
, bound= Raster)]) – Proxy values as array or Raster (i.e., differenced values where signal should be zero such as elevation differences on stable terrain)list_models (
list
[Union
[str
,Callable
[[ndarray
[Any
,dtype
[floating
[Any
]]],float
,float
],ndarray
[Any
,dtype
[floating
[Any
]]]]]]) – List of K variogram models to sum for the fit in order from short to long ranges. Can either be a 3-letter string, full string of the variogram name or SciKit-GStat model function (e.g., for a spherical model “Sph”, “Spherical” or skgstat.models.spherical).stable_mask (
Union
[ndarray
[Any
,dtype
[floating
[Any
]]],Mask
,TypeVar
(VectorType
, bound= Vector),GeoDataFrame
]) – Vector shapefile of stable terrain (if dvalues is Raster), or boolean array of same shape as dvaluesunstable_mask (
Union
[ndarray
[Any
,dtype
[floating
[Any
]]],Mask
,TypeVar
(VectorType
, bound= Vector),GeoDataFrame
]) – Vector shapefile of unstable terrain (if dvalues is Raster), or boolean array of same shape as dvalueserrors (
Union
[ndarray
[Any
,dtype
[floating
[Any
]]],TypeVar
(RasterType
, bound= Raster)]) – Error values to account for heteroscedasticity (ignored if None).estimator (
str
) – Estimator for the empirical variogram; default to Dowd’s variogram (see skgstat.Variogram for the list of available estimators).gsd (
float
) – Ground sampling distance, if input values are provided as arraysubsample (
int
) – Number of samples to randomly draw from the valuessubsample_method (
str
) – Spatial subsampling methodn_variograms (
int
) – Number of independent empirical variogram estimations (to estimate empirical variogram spread)n_jobs (
int
) – Number of processing coresbounds (
list
[tuple
[float
,float
]]) – Bounds of range and sill parameters for each model (shape K x 4 = K x range lower, range upper, sill lower, sill upper).p0 (
list
[float
]) – Initial guess of ranges and sills each model (shape K x 2 = K x range first guess, sill first guess).random_state (
int
|Generator
|None
) – Random state or seed number to use for calculations (to fix random sampling during testing)
- Return type:
tuple
[DataFrame
,DataFrame
,Callable
[[ndarray
[Any
,dtype
[floating
[Any
]]]],ndarray
[Any
,dtype
[floating
[Any
]]]]]- Returns:
Dataframe of empirical variogram, Dataframe of optimized model parameters, Function of spatial correlation (0 to 1) with spatial lags