xdem.spatialstats

xdem.spatialstats#

Spatial statistical tools to estimate uncertainties related to DEMs

Functions

convolution(imgs, filters[, method])

Convolution on a number n_N of 2D images of size N1 x N2 using a number of kernels n_M of sizes M1 x M2, using either scipy.signal.fftconvolve or accelerated numba loops.

correlation_from_variogram(...)

Construct the spatial correlation function from a dataframe of variogram parameters.

covariance_from_variogram(params_variogram_model)

Construct the spatial covariance function from a dataframe of variogram parameters.

estimate_model_heteroscedasticity(dvalues, ...)

Estimate and model the heteroscedasticity (i.e., variability in error) according to a list of explanatory variables from a proxy of differenced values (e.g., elevation differences), if possible compared to a source of higher precision.

estimate_model_spatial_correlation(dvalues, ...)

Estimate and model the spatial correlation of the input variable by empirical variogram sampling and fitting of a sum of variogram model.

fit_sum_model_variogram(list_models, ...[, ...])

Fit a sum of variogram models to an empirical variogram, with weighted least-squares based on sampling errors.

get_perbin_nd_binning(df, list_var, ...[, ...])

Get per-bin array statistic for a list of array input variables, based on the results of an independent N-D binning.

get_variogram_model_func(params_variogram_model)

Construct the sum of spatial variogram function from a dataframe of variogram parameters.

infer_heteroscedasticity_from_stable(...[, ...])

Infer heteroscedasticity from differenced values on stable terrain and a list of explanatory variables.

infer_spatial_correlation_from_stable(...[, ...])

Infer spatial correlation of errors from differenced values on stable terrain and a list of variogram model to fit as a sum.

interp_nd_binning(df, list_var_names[, ...])

Estimate an interpolant function for an N-dimensional binning.

mean_filter_nan(img, kernel_size[, ...])

Apply a mean filter to an image with a square or circular kernel of size p and with NaN values ignored.

nd_binning(values, list_var, list_var_names)

N-dimensional binning of values according to one or several explanatory variables with computed statistics in each bin.

neff_circular_approx_numerical(area, ...)

Number of effective samples derived from numerical integration for any sum of variogram models over a circular area.

neff_circular_approx_theoretical(area, ...)

Number of effective samples approximated from exact disk integration of a sum of any number of variogram models of spherical, gaussian, exponential or cubic form over a disk of a certain area.

neff_exact(coords, errors, ...[, vectorized])

Exact number of effective samples derived from a double sum of covariance with euclidean coordinates based on

neff_hugonnet_approx(coords, errors, ...[, ...])

Approximated number of effective samples derived from a double sum of covariance subsetted on one of the two sums, based on euclidean coordinates with the provided variogram parameters.

nmad(data[, nfact])

Calculate the normalized median absolute deviation (NMAD) of an array.

number_effective_samples(area, ...[, ...])

Compute the number of effective samples, i.e. the number of uncorrelated samples, in an area accounting for spatial correlations described by a sum of variogram models.

patches_method(values, areas[, gsd, ...])

Monte Carlo patches method that samples multiple patches of terrain, square or circular, of a certain area and computes a statistic in each patch.

plot_1d_binning(df, var_name, statistic_name)

Plot a statistic and its count along a single binning variable.

plot_2d_binning(df, var_name_1, var_name_2, ...)

Plot one statistic and its count along two binning variables.

plot_variogram(df[, list_fit_fun, ...])

Plot empirical variogram, and optionally also plot one or several model fits.

sample_empirical_variogram(values[, gsd, ...])

Sample empirical variograms with binning adaptable to multiple ranges and spatial subsampling adapted for raster data.

spatial_error_propagation(areas, errors, ...)

Spatial propagation of elevation errors to an area using the estimated heteroscedasticity and spatial correlations.

two_step_standardization(dvalues, list_var, ...)

Standardize the proxy differenced values using the modelled heteroscedasticity, re-scaled to the spread statistic, and generate the final standardization function.

Classes

EmpiricalVariogramKArgs