GSLib algorithms¶
This module is wrapper on top of GSLib to run its algorithms inside a jupyter notebook in a seamless integration with pyLPM.
Cell declustering¶
-
pyLPM.gslib.declus(df, x, y, z, var, tmin=-1e+21, tmax=1e+21, x_anis=1, z_anis=1, n_cell=10, min_size=1, max_size=20, keep_min=True, number_offsets=4, usewine=False)[source]¶ cell declustering algortihm. This function shows the declustering reults summary and writes weights to the DataFrame.
Parameters: - df (DataFrame) – points data DataFrame
- x (str) – x coordinates column name
- y (str) – y coordinates column name
- z (str) – z coordinates column name
- var (str) – variable column name
- tmin (float, optional) – minimum triming limit. Defaults to -1.0e21.
- tmax (float, optional) – maximum triming limit. Defaults to 1.0e21.
- x_anis (float, optional) – the anisotropy factors to consider rectangular cells. The cell size in the x direction is multiplied by these factors to get the cell size in the y and z directions, e.g., if a cell size of 10 is being considered and anisy2 and anisz3 then the cell size in the y direction is 20 and the cell size in the z direction is 30.. Defaults to 1.
- z_anis (float, optional) – anisotropy factor. Defaults to 1.
- n_cell (int, optional) – number of cells. Defaults to 10.
- min_size (float, optional) – minimum size. Defaults to 1.
- max_size (float, optional) – maximum size. Defaults to 20.
- keep_min (bool, optional) – an boolean flag that specifies whether a minimum mean value (True) or maximum mean value (False) is being looked for. Defaults to True.
- number_offsets (int, optional) – the number of origin offsets. Each of the ncell cell sizes are considered with noff different original starting points. This avoids erratic results caused by extreme values falling into specific cells. A good number is 4 in 2-D and 8 in 3-D. A short description of the program. Defaults to 4.
- usewine (bool, optional) – use wine flag. Defaults to False.
Variogram¶
-
pyLPM.gslib.gamv(df, x='x', y='y', z='z', var_h='V', var_tail='V', nlags: int = 10, lagdist=10, lagtol=5, ndirections=3, azm=[0, 0, 0], atol=[22, 22, 22], bandh=[5, 5, 5], dip=[0, 0, 0], dtol=[22, 22, 22], bandv=[5, 5, 5], standardize=0, variogram_type=1, tmin=-999, tmax=999, usewine=False)[source]¶ Calculate experimental functions using gamv
Parameters: - df (pandas.DataFrame) – DataFrame containing all spatial information
- x (str) – Label for the X coordinates
- y (str, optional) – Label for the Y coordinates
- z (str, optional) – Label for the Z coordinates
- var_h (str, optional) – Label for the variable at the head of the distance vector
- var_tail (str, optional) – Label for the variable at the tail of the distance vector
- nlags (int, optional) – Number of lags for the experimental variogram
- lagdist (int, optional) – Size of the lag for the experimental variogram
- lagtol (int, optional) – Linear tolerance for the experimental variogram
- ndirections (int, optional) – Number of directions to calculate
- azm (list, optional) – List of azimuth angles in degrees
- atol (list, optional) – List of horizontal angular tolerances in degrees
- bandh (list, optional) – List of horizontal band width
- dip (list, optional) – List of dip angles in degrees
- dtol (list, optional) – List of vertical angular tolerances in degrees
- bandv (list, optional) – List of vertical band width
- standardize (int, optional) – Standardize variables 0- No, 1- Yes
- variogram_type (int, optional) – Variogram experimental function. 1 = traditional semivariogram, 2 = traditional cross semivariogram, 3 = covariance, 4 = correlogram, 5 = general relative semivariogram, 6 = pairwise relative semivariogram, 7 = semivariogram of logarithms, 8 = semimadogram, 9 = indicator semivariogram - continuous, 10= indicator semivariogram - categorical
- tmin (TYPE, optional) – Minimum trimming limits
- tmax (int, optional) – Maximum trimming limits
- usewine (bool, optional) – Option to use wine for Linux users
Kriging¶
-
pyLPM.gslib.kt3d(df, dh, x, y, z, var, grid, variogram, min_samples, max_samples, max_oct, search_radius, search_ang=[0, 0, 0], discretization=[5, 5, 1], krig_type='OK', sk_mean=0, tmin=-1e+21, tmax=1e+21, option='grid', debug_level=0, usewine=False)[source]¶ Kriging algorithm. This function will show cross validation results if
option = 'cross'oroption = 'jackknife'or it will return estimated values and variace arrays ifoption = 'grid'.Parameters: - df (DataFrame) – points data DataFrame
- x (str) – x coordinates column name
- y (str) – y coordinates column name
- z (str) – z coordinates column name
- var (str) – variable column name
- grid (dict) – grid definitions dictionary
- variogram (dict) – variogram dictionary
- min_samples (int) – minimum samples
- max_samples (int) – maximum number of samples
- max_oct (int) – maximum number of samples per octant
- search_radius (list) – range1, ramge2, range3 values list
- search_ang (list, optional) – azimuth, dip, rake values list. Defaults to [0,0,0].
- discretization (list, optional) – block discretization. Defaults to [5,5,1].
- krig_type (str, optional) – ‘SK’ or ‘OK’ flag. Defaults to ‘OK’.
- sk_mean (float, optional) – simple kriging mean. Defaults to 0.
- tmin (float, optional) – minimum trimming limit. Defaults to -1.0e21.
- tmax (float, optional) – maximum trimming limit. Defaults to 1.0e21.
- option (str, optional) – cross validation ‘cross’, jackknife ‘jackknife’ or estimation ‘grid’ flag . Defaults to ‘grid’.
- debug_level (int, optional) – debug level. Defaults to 0. If 2 plots the negative weights histogram.
- usewine (bool, optional) – use wine flag. Defaults to False.