xdem.spatialstats.fit_sum_model_variogram#
- xdem.spatialstats.fit_sum_model_variogram(list_models, empirical_variogram, bounds=None, p0=None, maxfev=None)[source]#
Fit a sum of variogram models to an empirical variogram, with weighted least-squares based on sampling errors. To use preferably with the empirical variogram dataframe returned by the sample_empirical_variogram function.
- Parameters:
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).empirical_variogram (
DataFrame
) – Empirical variogram, formatted as a dataframe with count (pairwise sample count), lags (upper bound of spatial lag bin), exp (experimental variance), and err_exp (error on experimental variance).bounds (
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).maxfev (
int
) – Maximum number of function evaluations before the termination, passed to scipy.optimize.curve_fit(). Convergence problems can sometimes be fixed by changing this value (default None: automatically determine the number).
- Return type:
tuple
[Callable
[[ndarray
[Any
,dtype
[floating
[Any
]]]],ndarray
[Any
,dtype
[floating
[Any
]]]],DataFrame
]- Returns:
Function of sum of variogram, Dataframe of optimized coefficients.