Indicator#
- class IndicatorVariogramData(input_array, number_of_thresholds)[source]
Class describes indicator variogram data.
- Parameters:
- input_arraynumpy array, list, tuple
Coordinates and their values:
(pt x, pt y, value)
- number_of_thresholds: int
The number of thresholds to model data.
See also
ExperimentalIndicatorVariogram
Class that calculates experimental variograms for each indicator.
- Attributes:
- input_arraynumpy array, list, tuple
Coordinates and their values:
(pt x, pt y, value)
- n_thresholds: int
The number of thresholds to model data.
- thresholdsnumpy array
The 1D numpy array with thresholds.
- idsnumpy array
The numpy array with
[coordinate_x, coordinate_y, threshold_0, ..., threshold_n]
.
- class ExperimentalIndicatorVariogram(input_array, number_of_thresholds, step_size, max_range, weights=None, direction=None, tolerance=1.0, method='t', fit=True)[source]
Class describes Experimental Indicator Variogram models.
- Parameters:
- input_arraynumpy array, list, tuple
Coordinates and their values:
(pt x, pt y, value)
- number_of_thresholds: int
The number of thresholds to model data.
- step_sizefloat
The distance between lags within each points are included in the calculations.
- max_rangefloat
The maximum range of analysis.
- weightsnumpy array, default=None
Weights assigned to points, index of weight must be the same as index of point.
- directionfloat (in range [0, 360]), default=None
Direction of semivariogram, values from 0 to 360 degrees:
0 or 180: is E-W,
90 or 270 is N-S,
45 or 225 is NE-SW,
135 or 315 is NW-SE.
- tolerancefloat (in range [0, 1]), default=1
If
tolerance
is 0 then points must be placed at a single line with the beginning in the origin of the coordinate system and the direction given by y axis and direction parameter. Iftolerance
is> 0
then the bin is selected as an elliptical area with major axis pointed in the same direction as the line for 0 tolerance.The major axis size ==
step_size
.The minor axis size is
tolerance * step_size
The baseline point is at a center of the ellipse.
The
tolerance == 1
creates an omnidirectional semivariogram.
- methodstr, default = triangular
The method used for neighbors selection. Available methods:
“triangle” or “t”, default method where a point neighbors are selected from a triangular area,
“ellipse” or “e”, the most accurate method but also the slowest one.
- fitbool, default = True
Should models be fitted in the class initialization?
References
Goovaerts P. AUTO-IK: a 2D indicator kriging program for automated non-parametric modeling of local uncertainty in earth sciences. DOI: TODO
- Attributes:
- dsIndicatorVariogramData
Prepared indicator data.
- step_sizefloat
Derived from the
step_size
parameter.- max_rangefloat
Derived from the
max_range
parameter.- weightsnumpy array
Derived from the
weights
parameter.- directionfloat
Derived from the
direction
parameter.- tolerancefloat
Derived from the
tolerance
parameter.- methodstr
Derived from the
method
parameter.- experimental_modelsList
The
[threshold, experimental_variogram]
pairs.
Methods
fit()
Fits indicators to experimental variograms.
show()
Show experimental variograms for each indicator.
- fit()[source]
Function fits indicators to models and updates class models.
- show()[source]
Function shows generated experimental variograms for each indicator.
- class IndicatorVariograms(experimental_indicator_variogram)[source]
Class models indicator variograms for all indices.
- Parameters:
- experimental_indicator_variogramExperimentalIndicatorVariogram
Fitted experimanetal variograms with indicators for each threshold.
- Attributes:
- experimental_indicator_variogramExperimentalIndicatorVariogram
See
experimental_indicator_variogram
parameter.- theoretical_indicator_variogramsDict
Dictionary with fitted theoretical models for each threshold.
Methods
fit()
Fits theoretical models to experimental variograms.
show()
Shows experimental and theoretical variograms for each threshold.
- fit(model_name='linear', nugget=0, rang=None, min_range=0.1, max_range=0.5, number_of_ranges=64, sill=None, min_sill=0.5, max_sill=1.5, number_of_sills=64, direction=None, error_estimator='rmse', deviation_weighting='equal', auto_update_attributes=True, warn_about_set_params=True, verbose=False)[source]
Method tries to find the optimal range, sill and model (function) of the theoretical semivariogram.
- Parameters:
- model_namestr, default = “linear”
The name of a modeling function. Available models:
‘all’,
‘safe’ : linear, power and spherical models,
‘exponential’,
‘gaussian’,
‘linear’,
‘power’,
‘spherical’.
- nuggetfloat, default = 0
Nugget (bias) of a variogram. Default value is 0.
- rangfloat, optional
If given, then range is fixed to this value.
- min_rangefloat, default = 0.1
The minimal fraction of a variogram range,
0 < min_range <= max_range
.- max_rangefloat, default = 0.5
The maximum fraction of a variogram range,
min_range <= max_range <= 1
. Parametermax_range
greater than 0.5 raises warning.- number_of_rangesint, default = 64
How many equally spaced ranges are tested between
min_range
andmax_range
.- sillfloat, default = None
If given, then sill is fixed to this value.
- min_sillfloat, default = 0
The minimal fraction of the variogram variance at lag 0 to find a sill,
0 <= min_sill <= max_sill
.- max_sillfloat, default = 1
The maximum fraction of the variogram variance at lag 0 to find a sill. It should be lower or equal to 1. It is possible to set it above 1, but then warning is printed.
- number_of_sillsint, default = 64
How many equally spaced sill values are tested between
min_sill
andmax_sill
.- directionfloat, in range [0, 360], default=None
The direction of a semivariogram. If
None
given then semivariogram is isotropic. This parameter is required if passed experimental variogram is stored in a numpy array.- error_estimatorstr, default = ‘rmse’
A model error estimation method. Available options are:
‘rmse’: Root Mean Squared Error,
‘mae’: Mean Absolute Error,
‘bias’: Forecast Bias,
‘smape’: Symmetric Mean Absolute Percentage Error.
- deviation_weightingstr, default = “equal”
The name of a method used to weight error at a given lags. Works only with RMSE. Available methods:
equal: no weighting,
closest: lags at a close range have bigger weights,
distant: lags that are further away have bigger weights,
dense: error is weighted by the number of point pairs within a lag.
- auto_update_attributesbool, default = True
Update sill, range, model type and nugget based on the best model.
- warn_about_set_params: bool, default=True
Should class invoke warning if model parameters has been set during initialization?
- verbosebool, default = False
Show iteration results.
- Raises:
- ValueError
Raised when
sill < 0
orrange < 0
orrange > 1
.- KeyError
Raised when wrong model name(s) are provided by the users.
- KeyError
Raised when wrong error type is provided by the users.
- Warns:
- SillOutsideSafeRangeWarning
Warning printed when
max_sill > 1
.- RangeOutsideSafeDistanceWarning
Warning printed when
max_range > 0.5
.- Warning
Model parameters were given during initilization but program is forced to fit the new set of parameters.
- Warning
Passed
experimental_variogram
is a numpy array anddirection
parameter isNone
.
- show(subplots=False)[source]
Method plots experimental and theoretical variograms.
- Parameters:
- subplotsbool, default = False
If
True
then each indicator variogram is plotted on a separate plot. Otherwise, all variograms are plotted on a scatter single plot.