Is a set of utilities that deal with geological rocks, strata and stratigraphic details for log construction.

watex.utils.geotools.annotate_log(ax, thick, layers, *, ylims=None, colors=None, set_nul='*unknow', bbox_kws=None, set_nul_bbox_kws=None, **an_kws)[source]#

Draw annotate stratigraphic map.

Parameters:
  • ax – obj, Matplotlib axis

  • thick – list of the thicknesses of the layers

  • layers – list of the name of layers

  • set_nul – str set the Name of the unknow layers. Default is `*unknow. Can be changed with any other layer name.

:param bbox_kws:dict, Additional keywords arguments of Fancy boxstyle

arguments

Parameters:

set_nul_bbox_kws – dict, customize the boxstyle of the set_nul param. If you want the bbox to be the same like bbox_kws, we need just to write idem or same` or origin.

Returns:

ax: matplotlib axis properties

watex.utils.geotools.assert_len_lns_tres(lns, tres)[source]#

Assert the length of LN and Tres

watex.utils.geotools.assert_station(id, nm=None)[source]#

Assert station according to the number of stations investigated.

Parameters:
  • id – int or str, station number. The station counter start from 01 as litteral count except whn provided value in string format following the letter S. For instance : S00 =1

  • nm – matrix of new stratiraphy model built.

Returns:

Index at specific station

Example:
>>> import watex.utils.geotools as GU
>>> import watex.geology.core as GC
>>> obj= GC.quick_read_geomodel()
>>> GU.assert_station(id=47, nm=geoObj.nmSites)
...46
watex.utils.geotools.base_log(ax, thick, layers, *, ylims=None, hatch=None, color=None)[source]#

Plot pseudo-stratigraphy basemap and return axis.

Parameters:
  • ax – obj, Matplotlib axis

  • thick – list of the thicknesses of the layers

  • layers – list of the name of layers

  • hatch – list of the layer patterns

  • color – list of the layer colors

Returns:

ax- matplotlib axis properties

watex.utils.geotools.build_random_thickness(depth, /, n_layers=None, h0=1, shuffle=True, dirichlet_dist=False, random_state=None, unit='m')[source]#

Generate a random thickness value for number of layers in deeper.

Parameters:
  • depth (ArrayLike, float) – Depth data. If float the number of layers n_layers must be specified. Otherwise an error occurs.

  • n_layers (int, Optional) – Number of layers that fit the samples in depth. If depth is passed as an ArrayLike, n_layers is ignored instead.

  • h0 (int, default='1m') – Thickness of the first layer.

  • shuffle (bool, default=True) – Shuffle the random generated thicknesses.

  • dirichlet_dis (bool, default=False) – Draw samples from the Dirichlet distribution. A Dirichlet-distributed random variable can be seen as a multivariate generalization of a Beta distribution. The Dirichlet distribution is a conjugate prior of a multinomial distribution in Bayesian inference.

  • random_state (int, array-like, BitGenerator, np.random.RandomState, np.random.Generator, optional) – If int, array-like, or BitGenerator, seed for random number generator. If np.random.RandomState or np.random.Generator, use as given.

  • unit (str, default='m') – The reference unit for generated layer thicknesses. Default is meters

Returns:

thickness – ArrayLike of shape equals to the number of layers.

Return type:

Arraylike of shape (n_layers, )

Examples

>>> from watex.utils.geotools import build_random_thickness
>>> build_random_thickness (7, 10, random_state =42  )
array([0.41865079, 0.31785714, 1.0234127 , 1.12420635, 0.51944444,
       0.92261905, 0.6202381 , 0.8218254 , 0.72103175, 1.225     ])
>>> build_random_thickness (7, 10, random_state =42 , dirichlet_dist=True )
array([1.31628992, 0.83342521, 1.16073915, 1.03137592, 0.79986286,
       0.8967135 , 0.97709521, 1.34502617, 1.01632075, 0.62315132])
watex.utils.geotools.display_ginfos(infos, inline='-', size=70, header='Automatic rocks', **kws)[source]#

Display unique element on list of array infos.

Parameters:
  • infos – Iterable object to display.

  • header – Change the header to other names.

Example:
>>> from watex.geology.stratigraphic import display_infos
>>> ipts= ['river water', 'fracture zone', 'granite', 'gravel',
     'sedimentary rocks', 'massive sulphide', 'igneous rocks',
     'gravel', 'sedimentary rocks']
>>> display_infos('infos= ipts,header='TestAutoRocks',
                  size =77, inline='~')
watex.utils.geotools.display_s_infos(s_list, s_range, s_thick, **kws)[source]#

Display strata infos at the requested station.

Parameters:
  • s_list – the pseudostratigraphic details list

  • s_range – the pseudostratigraphic strata range

  • s_thick – the pseudostratigraphic thicknesses

:param kws:additional keywords arguments.

watex.utils.geotools.find_distinct_items_and_indexes(items, cumsum=False)[source]#

Find distincts times and their indexes.

Parameters:
  • items – list of items to get the distincts values

  • cumsum – bool, cummulative sum when items is a numerical values

Returns:

  • distinct _indexes unique indexes of distinct items

  • distinct_items: unik items in the list

  • cumsum: cumulative sum of numerical items

Example:
>>> import watex.utils.geotools as GU
>>> test_values = [2,2, 5, 8, 8, 8, 10, 12, 1, 1, 2, 3, 3,4, 4, 6]
>>> ditems, dindexes, cumsum = GU.find_distinct_items_and_indexes(
    test_values, cumsum =True)
>>> cumsum
watex.utils.geotools.find_similar_structures(*resistivities, return_values=Ellipsis)[source]#

Find similar geological structures from electrical rock properties stored in configure data.

Parameters:
  • resistivities (float) – Array of geological rocks resistivities

  • return_values (bool, default=False,) – return the closest resistivities of the close structures with similar resistivities.

Returns:

structures , str_res – List of similar structures that fits each resistivities. returns also the closest resistivities if return_values is set to True.

Return type:

list

Examples

>>> from watex.utils.geotools import find_similar_structures
>>> find_similar_structures (2 , 10, 100 , return_values =True)
Out[206]:
(['sedimentary rocks', 'metamorphic rocks', 'clay'], [1.0, 10.0, 100.0])
watex.utils.geotools.fit_rocks(logS_array, lns_, tres_)[source]#

Find the pseudo rock name at each station from the pseudovalue intres.

Parameters:
  • logS_array – array_like of under the station resistivity value

  • lns – array_like of the rocks or the pseudolayers (automatick)

  • tres – array_like of the TRES or the pseudo value of the TRES

Returns:

list of the unik corresponding resistivity value at each station and its fitting rock names.

Example:
>>> import watex.utils.geotools as GU
>>> import watex.geology.core as GC
>>> obj= GC.quick_read_geomodel()
>>> pslns , pstres,  ps_lnstres= GU.make_strata(obj)
>>> logS1 =obj.nmSites[0] # station S0
>>> fit_rock(logS1, lns_= pslns, tres_= pstres)
watex.utils.geotools.fit_stratum_property(fittedrocks, z, site_tres)[source]#

Separated whole blocks into different stratum and fit their corresponding property like depth and value of resistivities

Parameters:
  • fittedrocks – array_like of layers fitted from the TRES

  • z – array like of the depth

  • site_tres – array like of the station TRES

Returns:

  • s_grouped: Each stratum grouped from s_tres

  • site_tres_grouped: The site resistivity value site_tres grouped

  • z_grouped: The depth grouped (from the top to bottom )

  • z_cumsum_grouped: The cumulative sum grouped from the top to bottom

Example:
>>> import watex.geology.core as GC
>>> obj= GC.quick_read_geomodel()
>>> logS1 = obj.nmSites[:, 0]
>>> sg, stg, zg, zcg= fit_stratum_property (
    obj.fitted_rocks, obj.z, obj.logS)
watex.utils.geotools.frame_top_to_bottom(top, bottom, data)[source]#

Compute the value range between the top and the bottom.

Find the main range value for plot ranged between the top model and

the bottom.

Parameters:
  • top – is the top value where plot might be started

  • bottom – is the bottom value where plot must end

  • data – is the list of thicknesses of each layers

  • cumsum_origin – is the list of cumul sum of the data

Returns:

  • the index for other properties mapping. It indicates the

    index of layer for the top and the index of layer for the bottom for visualizing.

  • the list of pairs top-bottom , ex: [10, 999.0]

    where tp -> 10 and bottom ->999. m

  • the value of thicknesses ranged from the top to the bottom

    For instance: [49.0, 150.0, 590.0, 200.0] where - 49 is the thockness of the first layer - 200 m is the thickness of the

  • the coverall allows to track bug issues.The thickness of layer

    for visualizing should be the same that shrank. Otherwise, the mapping was not successfully done. Therefore coverall will be different to 100% and function will return the raw data instead of raising errors.

Example:
>>> import watex.utils.geotools as GU
>>> layer_thicknesses = [ 59.0, 150.0, 590.0, 200.0]
>>> top , bottom = 10, 120 # in meters
>>> GU.frame_top_to_bottom( top = top, bottom =bottom,
                        data = layer_thicknesses)
...(([0, 2], [10, 120], [49.0, 61.0]), 'coverall = 100.0 %')
watex.utils.geotools.get_closest_gap(value, iter_obj, status='isin', condition_status=False, skip_value=0)[source]#

Get the value from the minimum gap found between iterable values.

Parameters:
  • value – float Value to find its corresponding in the iter_obj

  • iter_obj – iterable obj Object to iterate in oder to find the index and the value that match the best value.

:param condition_status:bool

If there is a condition to skip an existing value in the iter_obj, it should be set to True and mention the ship_value.

Parameters:

skip_value – float or obj Value to skip existing in the iter_obj.

:param status:str

If layer is in the databse, then get the electrical property and from that properties find the closest value in TRES If layer not in the database, then loop the database from the TRES and find the auto rock name from resistivity values in the TRES

Returns:

  • ix_close_res: close value with its index found in` iter_obj`

:rtype:tuple

watex.utils.geotools.get_index_for_mapping(ix, tp)[source]#

get the index and set the stratpoint of the top or the endpoint of bottom from tuple list. The index should be used to map the o ther properties like color or hatches

watex.utils.geotools.get_s_thicknesses(grouped_z, grouped_s, display_s=True, station=None)[source]#

Compute the thickness of each stratum from the grouped strata from the top to the bottom.

Parameters:
  • grouped_z – depth grouped according its TRES

  • grouped_s – strata grouped according to its TRES

  • s_display – bool, display infos in stdout

Returns:

  • thick : The thickness of each layers

  • strata: name of layers

  • status: check whether the total thickness is equal to the

    depth of investigation(doi). Iftrue: `coverall= 100% otherwise coverall is less which mean there is a missing layer which was not probably taking account.

Example:
>>> import watex.geology.core as GC
>>> obj= GC.quick_read_geomodel()
>>> sg, _, zg, _= fit_stratum_property (obj.fitted_rocks,
...                                    obj.z, obj.nmSites[:, 0]  )
>>> get_s_thicknesses( zg, sg)
... ([13.0, 16.0, 260.0, 240.0, 470.0],
...     ['*i', 'igneous rocks', 'granite', 'igneous rocks', 'granite'],
...     'coverall =100%')
watex.utils.geotools.get_thick_from_range(rthick, /, sep=':-', flatten_range=False, mode='strict', raise_warn=True)[source]#

Computes the thickness from depth range passed in litteral string.

Collect values where thickness range is explicitly specified then compute the thickness. Note that if sep is not supplied or empty, value can yield an expected bad thickness calculation. Note that when the layer thicknesses are given as numeric values only, uses get_thick_from_values() instead.

Parameters:
  • rthick (str) –

    Text value of thick range composed of layer thickness declaration. Each layer depth range must be separated with spaces. For instance the depth range of layer A and B should be:

    v='42-52 63-85'
    

    where '42-52' is the layer A thickness range with 42 (m) as the top and 52(m) the bottom i.e. the thickness of layer A equals to 10m. Idem, the thickness of layer B equals to 22(m) with top starts at 63 (m) and end at 85 (m) (bottom).

  • sep (str, default=':-') –

    The separator used to differenciate the top and bottom values of the layer. For example:

    sep =':-' --> '25:50' or '25-50'
    

    where 25 and 50 corresponds to top (roof) and bottom ( wall) of the layer/stratum respectively. Both '':-' are valid to make this distinction. Any other character can be used provided that it is specified as an argument of `sep`parameter.

  • flatten (bool, default=False,) –

    If True return the value of layer top and bottom into a single list. For example:

    ['20-33', '58:125']-> [['20', '33'], ['58', '125']] -->              ['20', '33', '58', '125']
    

  • mode (str, bool ='strict') – Mode to retrieve, arrange and compute the layer thicknesses. In strict mode, any bad arrangement of misimputed of thickness values should raise an error. However, in ‘soft’, the bad arrangement is systematically dropped especially when top and bottom values of the layers are null.

  • raise_warn (bool, default=True) – Warn user about the layer ranking and thickness calculation.

Returns:

  • thick_range (List of layer thickness flattened or not)

  • thickness (list - The calculated thickness of each stratum.)

Examples

>>> from watex.utils.geotools import get_thick_from_range
>>> get_thick_from_range ('20-33 58:125', sep =':-')
Out[88]:
([array([20., 33.]), array([ 58., 125.])], [13.0, 67.0])
>>> # when mixed values  are given
>>> get_thick_from ( "99 0-15 15.2-18.8 40.0-70.7", mode='soft')
Out[89]:
([array([ 0., 15.]), array([15.2, 18.8]), array([40. , 70.7])],
 [15.0, 3.6000000000000014, 30.700000000000003])
watex.utils.geotools.get_thick_from_values(thick, depth=None, surface_value=0.0, mode='strict', raise_warn=Ellipsis)[source]#

Compute thickness when only thick is given.

Here it is respectful of tthe <t-value> data kind. For t-range data, refer to get_thick_from_range().

Parameters:
  • thick (List,) – The list of layer thickness.

  • depth (float, optional) – The maximum depth of the borehole. Useful when it comes to describes the stratigraphic log in the borehole. However, it is not necessary when it comes for geochemistry sampling.

  • surface_value (float, default=0.) – The level of the the sea by default. It correspond to the depth of the roof (top) of the first layers.

  • mode (str, default='strict') – Control the layer thickness ranking. It can be [‘soft’|’strict’]. Any other value should be in ‘soft’ mode. Here the strict mode yields an error when the total sum of the thickness is greater than the given depth. However in soft mode, the depth is merely replaced by the total thick depth.

  • raise_warn (bool, default=False) – warn user when the given depth is less than the total layer thicknesses.

Returns:

dh_from, dh_to , thickness

  • dh_from: the array of layer roof (top) depth values

  • dh_to: The array of layer wall ( bottom) depth values

  • thickness: The calculated thickness of each layer.

Return type:

Tuple of Arraylike

Examples

>>> from watex.utils.geotools import _parse_only_thick
>>> _parse_only_thick ([12 , 20, 26, 50 ], depth = 205 )
Out[63]:
(array([  0.,  12.,  32.,  58., 108.]),
 array([ 12.,  32.,  58., 108., 205.]),
 array([12., 20., 26., 50., 97.]))
watex.utils.geotools.grouped_items(items, dindexes, force=True)[source]#

Grouped items with the same value from their corresponding indexes.

Parameters:
  • items – list of items for grouping.

  • dindexes – list of distinct indexes

  • force – bool, force the last value to broken into two lists. Forcing value to be broke is usefull when the items are string. Otherwise, force param should be False when dealing numerical values.

Returns:

distinct items grouped

Example:
>>> import watex.utils.geotools as GU
>>> test_values = [2,2, 5, 8, 8, 8, 10, 12, 1, 1, 2, 3, 3,4, 4, 6]
>>> dindexes,* _ = GU.find_distinct_items_and_indexes(
    test_values, cumsum =False)
>>> GU.grouped_items( test_values, dindexes)
...  [[2, 2], [5], [8, 8, 8], [10], [12], [1, 1],
...      [2], [3, 3], [4, 4], [6]]
>>> GU.grouped_items( test_values, dindexes, force =False)
... [[2, 2], [5], [8, 8, 8], [10], [12], [1, 1],
    [2], [3, 3], [4, 4, 6]]
watex.utils.geotools.lns_and_tres_split(ix, lns, tres)[source]#

Indeed lns and tres from GeoStratigraphy model are updated.

Then splitting the lns and tres from the topped up values is necessary. Kind to resetting tres and `ln `back to original and return each split of inputting layers and TRES and the automatic rocks topped up during the NM construction.

Parameters:
  • ix – int Number of autorocks added

  • lns – list List of input layers

  • tres – list List of input resistivities values.

watex.utils.geotools.map_bottom(bottom, data, origin=None)[source]#

Reduce the plot map from the top assumes to start at 0. to the bottom value.

Parameters:
  • bottom – float, is the bottom value from which the plot must be end

  • data – the list of layers thicknesses in meters

  • origin – The top value for plotting.by the default the origin takes 0. as the starting point

Returns:

the mapping depth from the top to the maximum depth.
  • the index indicated the endpoint of number of layer

    for visualizing.

  • the list of pairs <top-bottom>, ex: [0, bottom]>

  • the value of thicknesses ranged from 0. to the bottom

  • the coverall, which is the cumul sum of the value of

    the thicknesses reduced compared to the total depth.

Note that to avoid raising errors, if coverall not equal to 100%, will return safety default values (original values).

Example:
>>> ex= [ 59.0, 150.0, 590.0, 200.0]
>>> map_bottom(60, ex)
... ((2, [0.0, 60], [59.0, 1.0]), 'coverall = 100.0 %')
watex.utils.geotools.map_top(top, data, end=None)[source]#

Reduce the plot map from the top value to the bottom assumed to be the maximum of investigation depth.

Parameters:
  • top – float, is the top value from which the plot must be starts

  • data – the list of layers thicknesses in meters

  • end – The maximum depth for plotting. Might be reduced, but the default takes the maximum depth investigation depth

Returns:

the mapping depth from the top to the maximum depth.

  • the index indicated the number of layer for visualizing to

    from the top to the max depth.

  • the list of pairs <top-bottom>, ex: [top, max depth]>

  • the value of thicknesses ranged from 0. to the bottom

  • the coverall, which is the cumul sum of the value of

    the thicknesses reduced compared to the total depth. It allows to track a bug issue.

Note that if coverall is different 100%, will return the default values giving values.

Example:
>>> import watex.utils.geotools as GU
>>> ex= [ 59.0, 150.0, 590.0, 200.0] # layers thicknesses
>>> GU.map_top(60, ex)
... ((3, [60, 999.0], [149.0, 590.0, 200.0]), 'coverall = 100.0 %')
watex.utils.geotools.plot_stratalog(thick, layers, station, *, zoom=None, hatch=None, color=None, fig_size=(10, 4), **annot_kws)[source]#

Make the stratalog log with annotate figure.

Parameters:
  • thick (list,) – list of the layers thicknesses , names, patterns and colors.

  • layer (list,) – list of the layers thicknesses , names, patterns and colors.

  • hatch (list,) – list of the layers thicknesses , names, patterns and colors.

  • colors (list,) – list of the layers thicknesses , names, patterns and colors.

  • zoom (float, list) –

    If float value is given, it considered as a

    zoom ratio and it should be ranged between 0 and 1. For isntance:

    • 0.25 –> 25% plot start from 0. to max depth * 0.25 m.

    Otherwise if values given are in the list, they should be composed of two items which are the top and bottom of the plot. For instance:

    • [10, 120] –> top =10m and bottom = 120 m.

    Note that if the length of zoom list is greater than 2, the function will return all the plot and no errors should raised.

    fig_size: tuple, default=(10, 4)

    Figure size

Examples

>>> import watex.utils.geotools as GU
>>> layers= ['$(i)$', 'granite', '$(i)$', 'granite']
>>> thicknesses= [59.0, 150.0, 590.0, 200.0]
>>> hatch =['//.', '.--', '+++.', 'oo+.']
>>> color =[(0.5019607843137255, 0.0, 1.0), 'b', (0.8, 0.6, 1.), 'lime']
>>> GU.plot_stratalog (thicknesses, layers, hatch =hatch ,
                   color =color, station='S00')
>>> GU.plot_stratalog ( thicknesses,layers,hatch =hatch,
                        zoom =0.25, color =color, station='S00')
watex.utils.geotools.print_running_line_prop(obj, inversion_software='modelling softw.')[source]#

print the file in stdout which is currently used “ for pseudostratigraphic plot when extracting station for the plot.

watex.utils.geotools.set_default_hatch_color_values(hatch, color, dhatch='.--', dcolor=(0.5019607843137255, 0.0, 1.0), force=False)[source]#

Set the none hatch or color to their default values.

Parameters:
  • hatch – str or list of layer patterns

  • color – str or list of layers colors

  • dhatch – default hatch

  • dcolor – default color

  • force

    Return only single tuple values otherwise put the RGB tuple values in the list. For instance:

    -if ``False`` color =[(0.5019607843137255, 0.0, 1.0)]
    - if ``True`` color = (0.5019607843137255, 0.0, 1.0)
    

Example:
>>> from watex.utils.geotools as  GU.
>>> hatch =['//.', 'none', '+++.', None]
>>> color =[(0.5019607843137255, 0.0, 1.0), None, (0.8, 0.6, 1.),'lime']
>>> GU.set_default_hatch_color_values(hatch, color))
watex.utils.geotools.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.]))
watex.utils.geotools.smart_zoom(v)[source]#

select the ratio or value for zooming. Don’t raise any error, just return the original size. No shrunk need to be apply when error occurs.

Parameters:

v

str, float or iterable for zoom - str: 0.25% —> mean 25% view

1/4 —> means 25% view

  • iterable: [0, 120]–> the top starts a 0.m and bottom at 120.m

note: terable should contains only the top value and the bottom

value.

Returns:

ratio float value of iteration list value including the the value range (top and the bottom values).

Example:
>>> import watex.utils.geotools as GU
>>> GU.smart_zoom ('1/4')
... 0.25
>>> GU.smart_zoom ([60, 20])
... [20, 60]
watex.utils.geotools.zoom_processing(zoom, data, layers=None, hatches=None, colors=None)[source]#

Zoom the necessary part of the plot.

If some optionals data are given such as hatches, colors, layers, they must be the same size like the data.

Parameters:
  • zoom

    float, list. If float value is given, it’s cnsidered as a zoom ratio than it should be ranged between 0 and 1. For isntance:

    • 0.25 –> 25% plot start from 0. to max depth * 0.25 m.

    Otherwise if values given are in the list, they should be composed of two items which are the top and bottom of the plot. For instance:

    • [10, 120] –> top =10m and bottom = 120 m.

    Note that if the length of list is greater than 2, the function will return the entire plot and no errors should be raised.

  • data – list of composed data. It should be the thickness from the top to the bottom of the plot.

  • layers – optional, list of layers that fits the data

  • hatches – optional, list of hatches that correspond to the data

  • colors – optional, list of colors that fits the data

Returns:

  • top-botom pairs: list composed of top bottom values

  • new_thicknesses: new layers thicknesses computed from top to bottom

  • other optional arguments shrunk to match the number of layers and

    the name of exact layers at the depth.

Example:
>>> import watex.utils.geotools as GU
>>> layers= ['$(i)$', 'granite', '$(i)$', 'granite']
>>> thicknesses= [59.0, 150.0, 590.0, 200.0]
>>> hatch =['//.', 'none', '+++.', None]
>>> color =[(0.5019607843137255, 0.0, 1.0), None, (0.8, 0.6, 1.),'lime']
>>> GU.zoom_processing(zoom=0.5 , data= thicknesses, layers =layers,
                      hatches =hatch, colors =color)
... ([0.0, 499.5],
...     [59.0, 150.0, 290.5],
...     ['$(i)$', 'granite', '$(i)$'],
...     ['//.', 'none', '+++.'],
...     [(0.5019607843137255, 0.0, 1.0), None, (0.8, 0.6, 1.0)])