Stratigraphic#

Construct layers model from given layers properties such as density , porosity permeability, transmissivity, resistivity , patches and so on … Build Statigraphic model from Inversion models blocks. This should be used to predict the log under each station as well as the thicknesses from the collected true boreholes and well resistivity data in the survey area.

class watex.geology.stratigraphic.GeoStrataModel(beta=5, ptol=0.1, n_epochs=100, tres=None, eta=0.0001, kind='linear', degree=1, build=False, **kwargs)[source]#

Bases: Base

Create a stratigraphic model from inversion models blocks.

The Inversion model block is two dimensional array of shape (n_vertical_nodes, n_horizontal_nodes ). Can use external packages to build blocks and provide the 2Dblock into crm parameter.

The challenge of this class is firstly to delineate with much accuracy the existing layer boundary (top and bottom) and secondly, to predict the stratigraphy log before the drilling operations at each station. Moreover, it’s a better way to select the right drilling location and also to estimate the thickness of existing layer such as water table layer as well as to figure out the water reservoir rock in the case of groundwater exploration.

Note that if the model blocks is build from externam softwares. You may as in the keywordsr argumments of GeoStrataModel the following attributes:

  • model_res2D resitivity model of (n_vertical_nodes, n_horizontal_nodes)

    If crm is given , no need to provided it.

  • geo_depth: Is the depth the surface to the bottom of each layer that

    composed the pseudo-boreholes. Note the N-vertical nodes values

  • input_resistivities: list of input resistivities. If the tres is passed

    not need to given.

Parameters:
  • crm (ndarray of shape(n_vertical_nodes, n_horizontal_nodes ),) – Array-like of inversion two dimensional model blocks. Note that the n_vertical_nodes is the node from the surface to the depth while n_horizontal_nodes must include the station location (sites/stations)

  • beta (int,) – Value to divide into the CRM blocks to improve the computation times. default is`5`

  • n_epochs (int,) – Number of iterations. default is 100

  • tres (array_like,) – Truth values of resistivities. Refer to Geodrill for more details

  • ptols (float,) – Existing tolerance error between the tres values given and the calculated resistivity in crm

  • input_layers (list or array_like) – True input_layers names : geological informations of collected in the area.

  • kind (str) – Kind of model function to compute the best fit model to replace the value in crm . Can be ‘linear’ or ‘polynomial’. if polynomial is set, specify the `degree. Default is ‘linear’.

  • alpha (float ,) – Learning rate for gradient descent computing. Default is 1e+4 for linear. If kind is set to polynomial the default value should be 1e-8.

  • degree (int,) – Polynomial function degree to implement gradient descent algorithm. If kind is set to Polynomial the default degree is 3. and details sequences

  • **nm** (ndarray) – The NM matrix with the same dimension with crm model blocks.

Examples

>>> from watex.geology.stratigraphic import GeoStrataModel
>>> # Works with occam2d inversion files if 'pycsamt' or 'mtpy' is installed
>>> # will call the module Geodrill from pycsamt to make occam2d 2D resistivity
>>> # block for our demo. It presumes pycsamt is installed.
>>> from pycsamt.geodrill.geocore import Geodrill
>>> path=r'data/inversfiles/inver_res/K4' # path to inversion files
>>> inversion_files = {'model_fn':'Occam2DModel',
...                   'mesh_fn': 'Occam2DMesh',
...                    "iter_fn":'ITER27.iter',
...                   'data_fn':'OccamDataFile.dat'
...                    }
>>> input_resistivity_values =[10, 66, 70, 180, 1000, 2000,
...                           3000, 50, 7]
>>> input_resistivity_values =[10, 66, 70, 180, 1000, 2000,
...                               3000, 7000, 15000 ]
>>> input_layer_names =['river water', 'fracture zone', 'granite']
>>> inversion_files = {key:os.path.join(path, vv) for key,
                vv in inversion_files.items()}
>>> gdrill= Geodrill (**inversion_files,
                     input_resistivities=input_resistivity_values
                     )
>>> # we can collect the 'model_res' and 'geo_depth_attributes' from
>>> # `gdrill object` and passed to 'GeoStrataModel' fit method as
>>> geosObj = GeoStrataModel(ptol =0.1).fit(crm = model_res ,
                     input_resistivities=gdrill.input_resistivity_values
                     geo_depth= gdrill.geo_depth )
>>> zmodel = geosObj._zmodel
>>> geosObj.nm # resistivity 2D model block is constructed

Notes

Modules work properly with occam2d inversion files if ‘pycsamt’ or ‘mtpy’ is installed and inherits the Base package which works with occam2d model. Occam2d inversion files are also acceptables for building model blocks. However the MODEM resistivity files development is still ongoing

property beta#

Block constructor param

property build#

Trigger the NM build and return the NM building option

fit(crm=None, beta=5, ptol=0.1, **kws)[source]#

Fit, populate attributes and construct the new stratigraphic model (NM)

Parameters:
  • crm (ndarray of shape(n_vertical_nodes, n_horizontal_nodes ),) – Array-like of inversion two dimensional model blocks. Note that the n_vertical_nodes is the node from the surface to the depth while n_horizontal_nodes must include the station location (sites/stations)

  • beta (int,) – Value to divide into the CRM blocks to improve the computation times. default is`5`

  • n_epochs (int,) – Number of iterations. default is 100

  • ptols (float,) – Existing tolerance error between the tres values given and the calculated resistivity in crm

Returns:

``self`` – return self for methods chaining.

Return type:

watex.geology.stratigraphic.GeoStrataModel.

classmethod geoArgumentsParser(config_file=None)[source]#

Read and parse the GeoStrataModel arguments files from the config [JSON|YAML] file. :param config_file: configuration file. Can be [JSON|YAML]

Example:
>>> GeoStrataModel.geoArgumentsParser(
    'data/saveJSON/cj.data.json')
>>> GeoStrataModel.geoArgumentsParser(
    'data/saveYAML/cy.data.yml')
static gradient_descent(z, s, alpha, n_epochs, **kws)[source]#

Gradient descent algorithm to fit the best model parameter.

Parameters:
  • z – vertical nodes containing the values of depth V

  • s – vertical vector containin the resistivity values

  • alpha – step descent parameter or learning rate. Default is ``0.01`

  • n_epochs – number of iterations. Default is 100 Can be changed to other values

Returns:

  • F: New model values with the best W parameters found.

  • W: vector containing the parameters fits

  • cost_history: Containing the error at each Itiretaions.

Example:
>>> z= np.array([0, 6, 13, 20, 29 ,39, 49, 59, 69, 89, 109, 129,
                 149, 179])
>>> res= np.array( [1.59268,1.59268,2.64917,3.30592,3.76168,
                    4.09031,4.33606, 4.53951,4.71819,4.90838,
      5.01096,5.0536,5.0655,5.06767])
>>> fz, weights, cost_history = gradient_descent(z=z, s=res,
                                     n_epochs=10,
                                     alpha=1e-8,
                                     degree=2)
>>> import matplotlib.pyplot as plt
>>> plt.scatter (z, res)
>>> plt.plot(z, fz)
property inspect#

Inspect object whether is fitted or not

property n_epochs#

Iteration numbers

static plotPseudostratigraphic(station, zoom=None, annotate_kws=None, **kws)[source]#

Build the pseudostratigraphic log. :param station: station to visualize the plot. :param zoom: float represented as visualization ratio

ex: 0.25 –> 25% view from top =0.to 0.25* investigation depth or a list composed of list [top, bottom].

Example:
>>> input_resistivity_values =[10, 66,  700, 1000, 1500,  2000,
                        3000, 7000, 15000 ]
>>> input_layer_names =['river water', 'fracture zone', 'granite']
# Run it to create your model block alfter that you can only use
#  `plotPseudostratigraphic` only
# >>> obj= quick_read_geomodel(lns = input_layer_names,
#                             tres = input_resistivity_values)
>>> plotPseudostratigraphic(station ='S00')
property ptol#

Tolerance parameter

strataModel(kind='nm', **kwargs)[source]#

Visualize the strataModel after nm creating using decorator from :class:’~.geoplot2d’.

Parameters:
  • kind – can be : - nm mean new model plots after inputs the tres - crm means calculated resistivity from occam model blocks default is nm.

  • plot_misft – Set to True if you want to visualise the error between the nm and crm.

  • scale – Can be m or km for plot scale

  • in_percent` – Set to True to see your plot map scaled in %.

Example:
>>> from watex.geology.stratigraphic import GeostrataModel
>>> geosObj = GeostrataModel().fit(**inversion_files,
                      input_resistivities=input_resistivity_values,
                      input_layers=input_layer_names)
>>> geosObj.strataModel(kind='nm', misfit_G =False)
property subblocks#

Model subblocks divised by beta

property tres#

Input true resistivity