watex.utils.smart_thickness_ranker#

watex.utils.smart_thickness_ranker(t, /, depth=None, regex=None, sep=':-', surface_value=0.0, mode='strict', return_thickness=Ellipsis, verbose=Ellipsis)[source]#

Compute the layer thicknesses and rank strata accordingly.

Grub from the litteral string the layer depth range to find the ranking of layer thickness.

Parameters:
t: str, or List of Any

Litteral string that containing the data arrangement. The kind of data to provide for thickness arrangement are:

  • t-value: Compose only with the layer thickness values. For instance t= "10 20 7 58" indicates four layers with layer thicknesses equals to 10, 20, 7 and 58 ( meters) respectively.

  • tb-range: compose only with thickness range at each depth. For instance t= "0-10 10-30 40-47 101-159". Note the character used to separate thickness range is '-'. Any other character must be specified using the parameter sep. Here, the top(roof) and bottom(wall) of the layers are 0 (top) and 10 (bottom), 10 and 30, 40 and 47 , and 101 and 159 for stratum 1, 2, 3 and 4 respectively.

  • mixed: Mixed data kind is composed of the both t-value and tb-range. When this kind of data is provied, to smartly parse the data, user must set the operation mode to soft. However, to avoid any unexpected result, it is suggested to used either t-value or tb-range layer thickness naming.

depth: float, optional

Depth is mostly used when t-value thickness arrangement is provided. It add additional layer at the bottom the given thickness and recompute the last layer thickness. Howewer for a sampling as geochemistry sampling, depth specification is not necessary.

regex: re object,

Regular expresion object used to parse the litteral string v. If not given, the default is:

>>> import re
>>> re.compile (r'[_#&.)(*@!,;\s-]\s*', flags=re.IGNORECASE)
sep:str, default= ‘:-’

The character used to separate two layer thickness ranged from top to bottom. Any other character must be specified. Here is an example:

>>> sep ='10-35' or sep='10:35'
surface_value: float, default=0.

The top value of the first layer. The default is the sea level. For instance, if the first layer l0 is 10m thick, the top (roof) and the bottom(wall) of l0 should be 0-10 for surface_value=0..

return_thickness: bool, default=False

If True, return the calculated thickness of each stratum.

mode: str, default=’strict’

Control the layer thickness ranking. It can be [‘soft’|’strict’]. Any other value should be in ‘soft’ mode. Indeed, the mode is used to retrieve, arrange and compute the layer thicknesses. For instance, in strict mode, any bad arrangement or misimputed layer thicknesses should raise an error. However, in ‘soft’, the bad arrangements are systematically dropped especially when top and bottom values of the layers are null.

verbose: bool, default=False

Warn user about the layer ranking and thickness calculation.

Returns:
dh_from, dh_to| thickness: Tuple of Arraylike
  • dh_from: Arraylike of each layer roof ( top)

  • dh_to: Arraylike of each layer wall ( bottom)

  • thickness: Arraylike of composed of each stratum thickness. Values are returned if returun_thickness=True.

Examples

>>> from watex.utils.geotools import smart_thickness_ranker
>>> smart_thickness_ranker ("10 15 70 125")
(array([ 0., 10., 25., 95.]), array([ 10.,  25.,  95., 220.]))
>>> smart_thickness_ranker ("10 15 70 125", depth =300,
                            return_thickness= True)
(array([  0.,  10.,  25.,  95., 220.]),
 array([ 10.,  25.,  95., 220., 300.]),
 array([ 10.,  15.,  70., 125.,  80.]))
>>> smart_thickness_ranker ("10-15 70-125")
(array([10., 70.]), array([ 15., 125.]))
>>> smart_thickness_ranker ("10-15 70-125", depth =300)
(array([ 10.,  70., 125.]), array([ 15., 125., 300.]))
>>> smart_thickness_ranker ("7 10-15 13 70-125 ",mode='soft')
(array([ 0., 10., 15., 70.]), array([  7.,  15.,  28., 125.]))
>>> smart_thickness_ranker ("7 10-15 13 70-125 ",depth =300, mode='soft',
                            return_thickness=True)
(array([  0.,  10.,  15.,  70., 125.]),
 array([  7.,  15.,  28., 125., 300.]),
 array([  7.,   5.,  13.,  55., 175.]))