Package GeoCore

Module Geodrill

This file is part of pyCSAMT.

pyCSAMT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

pyCSAMT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with pyCSAMT. If not, see <https://www.gnu.org/licenses/>.


Created on Sat Sep 19 12:37:42 2020 @author: Daniel03

class pycsamt.geodrill.geoCore.geodrill.Drill(well_filename=None, auto=True, **kwargs)[source]

This class is focus on well logs . How to generate well Log for Oasis:

Methods

dhGeology([dh_geomask])

Method to build geology drillhole log.

dhSample([path_to_agso_codefile, dh_sampmask])

Method to build Sample log.

dhSurveyElevAz([add_elevation, add_azimuth])

Method to build Elevation & Azimuth DH logs. if add_elevation and . add_azimuth are set . The programm will ignore the computated azimuth, and it will replace to the new azimuth provided . all elevation will be ignore and set by the new elevation . *kwargs arguments {add_elevation , add-azimuth } must match the same size like the number of Drillholes . Each one must be on ndarray(num_of_holes, 1).

writeDHData([data2write])

Method to write allDH logs. It depends to the users to sort which data want to export and which format. the program support only two format (.xlsx and .csv) if one is set , it will ouptput the convenience format. Users can give a list of the name of log he want to export. Program is dynamic and flexible. It tolerates quite symbols number to extract data logs.

dhGeology(dh_geomask=None)[source]

Method to build geology drillhole log. The name of input rock must feell exaction accordinag to a convention AGSO file . If not sure for the name of rock and Description and label. You may consult the geocode folder before building the well_filename. If the entirely rock name is given , program will search on the AGSO file the corresponding Label and code . If the rock name is founc then it will take its CODE else it will generate exception.

Parameters
* dh_geomasknp.ndarray, optional

geology mask. send mask value can take exactly the np.ndarray(num_of_geology set ,). The better way to set geology maskis to fill on the wellfilename. if not , programm will take the general mask value. The default is None.

Returns
pd.DataFrame

geology drillhole log.

dhSample(path_to_agso_codefile=None, dh_sampmask=None)[source]

Method to build Sample log. This method focuses on the sample obtained during the DH trip.it may georeferenced as the well_filename needed. A main thing is to set the AGSO_STCODES file. AGSO_STCODES is the conventional code of structurals sample. If you have an own AGSO_STCODES , you may provide the path * kwargs=path_to_ags_codefile * . the program will read and generate logs according to the DESCRIPTION and STCODES figured. if None, the program will take it STCODES and set the samplelogs. When you set the Sample code aor sample name , make sur that the name match the same name on STCODES. If not , program will raises an error.

Parameters
* path_to_agso_codefilestr, optional

path to conventional AGSO_STRUCTURAL CODES. The default is None.

  • dh_sampmasknp.ndarray, optional

    Structural mask. The default is None.

Returns
pd.DataFrame

Sample DH log.

dhSurveyElevAz(add_elevation=None, add_azimuth=None, **kwargs)[source]

Method to build Elevation & Azimuth DH logs. if add_elevation and . add_azimuth are set . The programm will ignore the computated azimuth, and it will replace to the new azimuth provided . all elevation will be ignore and set by the new elevation . *kwargs arguments {add_elevation , add-azimuth } must match the same size like the number of Drillholes . Each one must be on ndarray(num_of_holes, 1).

Parameters
* add_elevationnp.nadarray , optional

elevation data (num_of_holes, 1) The default is None.

  • add_azimuthnp.ndarray , optional

    azimuth data (num_of_holes,1). The default is None.

  • DH_RL :np.float or np.ndarray(num_of_hole,1),

    if not provided , it’s set to 0. means No topography is added’.

Returns
pd.Dataframe

Elevation DH log .

pd.DataFrame

Azimuth DH log.

writeDHData(data2write=None, **kwargs)[source]

Method to write allDH logs. It depends to the users to sort which data want to export and which format. the program support only two format (.xlsx and .csv) if one is set , it will ouptput the convenience format. Users can give a list of the name of log he want to export. Program is dynamic and flexible. It tolerates quite symbols number to

extract data logs.

Parameters
* data2writestr or list , optional

the search key. The default is None.

  • datafn :str

    savepath to exported file Default is current work directory.

  • write_index_on_sheetbool,

    choice to write the sheet with pandas.Dataframe index.

  • writeTypestr ,

    file type . its may .csv or *.xlsx . *Default is *.xlsx

  • add_headerbool,

    add head on exported sheet. set False to mask heads. Default is True.

  • csv_separateTypestr ,

    Indicated for csv exported files , the type of comma delimited . defaut is ‘,’.

class pycsamt.geodrill.geoCore.geodrill.GeoStratigraphy(crm=None, eta=5, ptol=0.1, n_epochs=100, **kwargs)[source]

Inherit the pycsamt.geodrill.geoCore.geodrill to create new model NM using the model get from occam 2D inversion results.

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.

Attributes
eta

Block constructor param

n_epochs

Iteration numbers

ptol

Tolerance parameter

subblocks

Model subblocks divised by eta

tres

Input true resistivity

Methods

geo_build_strata_logs([input_resistivities, ...])

"

geo_replace_rho([input_resistivity_range, ...])

Allow ro replace the calculated resistivities from model to real resistivites obtained on survey area with other companies.

get_average_rho(data_array[, transpose])

Function to average rho to one point to onother . It show the lowest point and the maximum point averaged . Function averaged rho value between local maximum and local minima values . if data values of station are located on columnlines , set transpose to True then rotate the matrix to find minima and maxima locals value then calculated averaged rho after will return matrix transpose as the same shape as inputted . .Defaut is False .

get_geo_formation_properties(...[, ...])

Get the list of stuctures and their names of after replaced , flexible tools. wherever structures provided, the name, color , as well as the pattern .if constrained electrical properties if True , will keep the resistivities with their corresponding layers as reference. If the layer names if found on the data Base then , will return its pattern and color else defaultcolor is black and patter is "+.-". If constrained_electrical_properties_of_rocks is False , will check under data base to find the resistivities that match better the layers.

get_structure(resistivities_range)

function to get according the range of resistivities values , the corresponding associated geological rocks The list of electrical properties of rocks is not exhaustive , can be fill by others

gradient_descent(z, s, alpha_, n_epochs, **kws)

Gradient descent algorithm to fit the best model parameter.

set_geodata([iter2dat_fn, model_fn, ...])

Readmodel data and collected from each site its value from surface to depth

strataModel([kind])

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

stratigraphyModel([kind, misfit_G])

Make stratigraphy model

to_golden_software([input_resistivities, ...])

Output average files, rehoreplaced files, spseudosequennces files and station locations files will generate 3 outputs for Golden software plots

to_oasis_montaj([model_fn, iter_fn, ...])

write output to oasis montaj when station loocation and profile coordinates are provided . We assune before using this method , you are already the coordinates files at disposal(*stn), if not use the method to_golden_software.Coordinated files are Easting Northing value not in degree decimals . It uses occam 2D outputfiles or Bo Yang iter2Dat file also add profile XY coordinates (utm_zone ).

property eta

Block constructor param

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 n_epochs

Iteration numbers

property ptol

Tolerance parameter

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

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

Parameters
  • kind – can be : - nms 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 pycsamt.geodrill.geoCore.geodrill import Geostratigraphy
>>> geosObj = GeoStratigraphy(**inversion_files,
                      input_resistivities=input_resistivity_values,
                      input_layers=input_layer_names)
>>> geosObj.strataModel(kind='nm', plot_misfit =False)
stratigraphyModel(kind='nm', misfit_G=False, **kwargs)[source]

Make stratigraphy model

Parameters
  • kind

    • nms mean new model plots after inputs the tres

    • crm means calculated resistivity from occam model blocks

  • misfit_G – bool, compute error between CRM and NM if set to True

property subblocks

Model subblocks divised by eta

property tres

Input true resistivity

class pycsamt.geodrill.geoCore.geodrill.Geodrill(iter2dat_fn=None, model_fn=None, data_fn=None, iter_fn=None, mesh_fn=None, bln_fn=None, **kwargs)[source]

Class to manage data from Occam2D and Model so to create section of each sites and it depth.

Each station constitues an attribute framed by two closest point of station offsets from model resistivities. Deal with True resistivities get on the survey or with others firms. In fact , input truth resistivities values into our model , produce an accuracy underground map.The challenge to build pseudolog allow to know how layers are disposal in underground so to emphasize the large conductive zone especially in the case of groundwater exploration. Program works in combinaison with geophysic data especially Occam 2D inversion data, and geological data. Actually the program deal only with Occam 2D inversion files or Bo Yang (x,y,z) files. We intend to extend later with other external softares but can generate output directly see use with Golder sofware(‘surfer’). If user

has a golder software installed on its computer , It can use output files generated here to produce 2D map so to compare both maps to see how far

is the difference between Model map and detail-sequences map ) “pseudosequences model” could match better the reality of underground). Details sequences map is most closest to the reality When {step descent} parameter is not too small at all. Indeed True geological data allow to harmonize the value of resistivity produced by Occam2D model so to force the pogramm to make a correlation between data fromtruth layers and the model values.

Methods

geo_build_strata_logs([input_resistivities, ...])

"

geo_replace_rho([input_resistivity_range, ...])

Allow ro replace the calculated resistivities from model to real resistivites obtained on survey area with other companies.

get_average_rho(data_array[, transpose])

Function to average rho to one point to onother . It show the lowest point and the maximum point averaged . Function averaged rho value between local maximum and local minima values . if data values of station are located on columnlines , set transpose to True then rotate the matrix to find minima and maxima locals value then calculated averaged rho after will return matrix transpose as the same shape as inputted . .Defaut is False .

get_geo_formation_properties(...[, ...])

Get the list of stuctures and their names of after replaced , flexible tools. wherever structures provided, the name, color , as well as the pattern .if constrained electrical properties if True , will keep the resistivities with their corresponding layers as reference. If the layer names if found on the data Base then , will return its pattern and color else defaultcolor is black and patter is "+.-". If constrained_electrical_properties_of_rocks is False , will check under data base to find the resistivities that match better the layers.

get_structure(resistivities_range)

function to get according the range of resistivities values , the corresponding associated geological rocks The list of electrical properties of rocks is not exhaustive , can be fill by others

set_geodata([iter2dat_fn, model_fn, ...])

Readmodel data and collected from each site its value from surface to depth

to_golden_software([input_resistivities, ...])

Output average files, rehoreplaced files, spseudosequennces files and station locations files will generate 3 outputs for Golden software plots

to_oasis_montaj([model_fn, iter_fn, ...])

write output to oasis montaj when station loocation and profile coordinates are provided . We assune before using this method , you are already the coordinates files at disposal(*stn), if not use the method to_golden_software.Coordinated files are Easting Northing value not in degree decimals . It uses occam 2D outputfiles or Bo Yang iter2Dat file also add profile XY coordinates (utm_zone ).

geo_build_strata_logs(input_resistivities=None, input_layers=None, step_descent=None, **kwargs)[source]

” Read resistivits data got on survey area and build geological strata block. If constrained_electrical_properties_of_rocks is False , will build a log by considering the conventional electrical property of rocks can be find through this link.

Parameters
* input_resistivity :array_like

an array of resistivity on the site

  • step_descentfloat

    depth value to averaged rho . Must be smaller as possible if None , it take the 2% times the investigation depth

  • input_layerslist or array

    layers_names , eg granite, fault, river

Returns
obj ,

Build stratigraphy log obj

A Sample of electrical_properties_of_rocks is below

Rocks

Max Rho

Min Rho (ohm-m)

igneous rocks

10^6

10^3

duricrust

5.10^3

5.10^2

gravel and sand

10^4

10^2.90(800)

conglomerate

10^4

10^1.95(90)

dolomite/limestone

10^5

10^3

permafrost

10^5

10^2.62(750)

metamorphic rocks

5.10^2

10.^1

tills

8.10^2

10^1.93(85)

standstone conglomerate

10^4

10^1.92 (80)

lignite/coal

10^2.89(790)

10^1

shales

10^1.7(50)

10^1.48(30)

clays

10^2

10^1.7(50)

saprolite

10^2.08(120)

10^1.48(30)

sedimentary rocks

10^4

10^0

fresh water

3.10^2

10^0

salt water

10^0

10^-0.15

massive sulfide

10^0

10^-2

sea water

10^-0.09(0.8)

10^-1

ore minerals

10^0

10^-4

Graphite

10^-2.5

10^-3.5

See also

https://www.eoas.ubc.ca/ubcgif/iag/foundations/properties/resistivity.htm list is not exhaustive and depend of the geological formations of survey area.

Note

list is not Exhaustive, use the data base script to populate most of goeological electrical properties.

geo_replace_rho(input_resistivity_range=None, input_layers=None, **kwargs)[source]

Allow ro replace the calculated resistivities from model to real resistivites obtained on survey area with other companies. The accuracy depend the significant values of input resistivites. More input resitivities are,more accuracy in the design of underground model geostratigrapyhy model should be.

Parameters
  • input_resistivity_range (array_like) – an array of resistivity on the site

  • input_layers – layers_names , eg .`granite`, fault, `river `

  • input_layers – list or arrays

  • depth_range – array _of depth of specific layer

static get_average_rho(data_array, transpose=False)[source]

Function to average rho to one point to onother . It show the lowest point and the maximum point averaged . Function averaged rho value between local maximum and local minima values . if data values of station are located on columnlines , set transpose to True then rotate the matrix to find minima and maxima locals value then calculated averaged rho after will return matrix transpose

as the same shape as inputted . .Defaut is False .

Parameters

data_array (ndarray) – data of resistivities collected at the site point

static get_geo_formation_properties(structures_resistivities, real_layer_names=None, constrained_electrical_properties_of_rocks=True, **kwargs)[source]

Get the list of stuctures and their names of after replaced , flexible tools. wherever structures provided, the name, color ,

as well as the pattern .if constrained electrical properties if True , will keep the resistivities with their corresponding layers

as reference. If the layer names if found on the data Base then , will return its pattern and color else defaultcolor is black and patter is “+.-”. If constrained_electrical_properties_of_rocks

is False , will check under data base to find the

resistivities that match better the layers.

Parameters
* structures resistivitiesarray_like,

resistivities of structures

  • real_layer_namesarray_like |list

    names of layer of survey area if not provided , will use resistivities to find the closet layer that match

    the best the resistivities

  • constrained_electrical_properties_of_rocks: bool

    set to True mean the realy_layer is provided. if not program will enforce to False , will use default conventional layers Default is False, assume to povided layer names for accuracy.

Returns
f_name: array_like

names of formations find with their corresponding rho

f_pattern: array_like

patter of differents geological formations

f_color: array_like

color of differents geological formations

static get_structure(resistivities_range)[source]

function to get according the range of resistivities values , the corresponding associated geological rocks The list of electrical properties of rocks is not exhaustive , can be fill by others

Parameters

resistivities_range (array_like,) – array of input_resistivities

Returns

the list of geological structures form go_electrical _rocks properties

Return type

list

set_geodata(iter2dat_fn=None, model_fn=None, data_fn=None, iter_fn=None, mesh_fn=None, **kwargs)[source]

Readmodel data and collected from each site its value from surface to depth

  1. Read with Occam 2D outputs files

Example
>>> form pycsamt.geodrill import Geodrill
>>> path_occam2d = os.path.join(os.environ ['pyCSAMT'],
...                                 'data', 'occam2D')
>>> path_i2d =os.path.join(os.environ ['pyCSAMT'],
...                            'data', '_iter2dat_2')
>>> geo_obj =Geodrill(
...      model_fn  = os.path.join(path_occam2d,'Occam2DModel'),
...      mesh_fn = os.path.join(path_occam2d, 'Occam2DMesh'),
...      iter_fn = os.path.join(path_occam2d, 'ITER17.iter'),
...     data_fn = os.path.join(path_occam2d, 'OccamDataFile.dat'))
  1. Read with only iter2dat file and bln file

Example
>>> form pycsamt.geodrill import Geodrill
>>> geo_obj =Geodrill(iter2dat_fn  = os.path.join(path_i2d, 'K1.iter.dat'),
...                  bln_fn = os.path.join(path_i2d, 'K1.bln'),)
>>> geo_model_off = geo_obj.model_x_nodes
>>> geo_model_res= geo_obj.model_res
>>> geoS01 = geo_obj.geo_name_S01
>>> geoS00= geo_obj.geo_name_S00
>>> geoS46=geo_obj.geo_name_S46
to_golden_software(input_resistivities=None, input_layers=None, step_descent=None, filename=None, savepath=None, **kwargs)[source]

Output average files, rehoreplaced files, spseudosequennces files and station locations files will generate 3 outputs for Golden software plots

  1. One model for rho averaged (*_aver), transitory data betwen

    the calculated rho and true rho.

  2. second for rho value replaced . Replaced calcualted model

    structures resistivities

to their closest resistivities as resistivities reference from

input resistivities.

  1. the most important files: the cut out resistivities value

    with step descent (._sd) show most dominant stratigraphy sequences .

  2. the station location file (.bln)

Plot the 3 files in Golden software to see transition from model calculation to truthsequence detail models which is most closest to reality.

Parameters
* input_resistivitiesarray_like

Truth values of resistivities

  • filename :str

    name of output file

  • step_descentfloat,
    Step to cut out data and to force resistivites calcualted

    to match the reference data as input resistivities if not provided the step will be 20% of D0I.

  • input_layersarray_like
    True input_layers names ( geological informations of

    encountered layers )

  • savepathstr,

    full path to the savepath , if None , will create folder name to savepath

Returns
obj , str

golden software outputfiles _rr.dat, _aver.dat, _sd.dat.

Holding a followings informations:
to_oasis_montaj(model_fn=None, iter_fn=None, profile_fn=None, mesh_fn=None, data_fn=None, filename=None, savepath=None, **kwargs)[source]

write output to oasis montaj when station loocation and profile coordinates are provided . We assune before using this method , you are already the coordinates files at disposal(*stn), if not use the method to_golden_software.Coordinated files are Easting Northing value not in degree decimals . It uses occam 2D outputfiles or Bo Yang iter2Dat file also add profile XY coordinates (utm_zone ).

Parameters
* model_fnstr

full path to Occam2D model file

  • mesh_fnstr

    full path to Occam2D mesh file

  • data_fnstr

    full path to Occam2D data file

  • iter_fnstr

    full path to Occam2D iteration file OR Bo Yang (x, y, z ) files

  • iter2dat_fnstr

    full path to iter2dat file (see _occam2d module to see which file is it. or call

    occam2d.Iter2Dat.__doc__)

  • blnstr

    full path to satation location file profile files (Easting , Northing Coordinates) , “see :ref:module-cs”

  • profile_fn: str

    full path to station profile file . You can useProfile module to rewrite _coordinate files

  • write_negative_depth: bool

    output negative depth. Default is True

  • scalled_east_north: tuple

    scalled the easting and northing. Substract or add value to easting or northing values. first index1 equal easting and index2 equal Nothing.*Default* is (0,0).

Returns
obj , str

oasis outputfiles .xlxs, .csv

Holding a followings informations:
class pycsamt.geodrill.geoCore.geodrill.Geosurface(path=None, **kwargs)[source]

Read Multidata from oasis montaj output files generated by geodrill module . Class to Build a depth surface map for imaging .

Attributes
extension_file

Methods

get_depth_surfaces([path, depth_values])

get the depth surfaces for multi-lines and build the numpy corresponding array at that depth .

read_oasis_files([path])

Method to get depth spacing , station info data infos, Each line becomes it own attributes components of info values are Stations, Easting_X_m,`Northing_Y_m`, v_H_m,`x_m` Norm_h_m,`sets_m` DOI_max_m.

write_file([path, depth_values, fileformat])

Write output files.

get_depth_surfaces(path=None, depth_values=None)[source]

get the depth surfaces for multi-lines and build the numpy corresponding array at that depth .

Parameters
  • depth_values (float or array_like) – array of depth

  • path (str) – full path to oasis outputfiles .

read_oasis_files(path=None)[source]

Method to get depth spacing , station info data infos, Each line becomes it own attributes components of info values are Stations, Easting_X_m,`Northing_Y_m`, v_H_m,`x_m` Norm_h_m,`sets_m` DOI_max_m.

Parameters

path (str) – full path to the oasis files .

Example
>>> from pycsamt.geodrill.geoCore.geodrill  import Geosurface
>>> path =  r'F:/__main__csamt__\oasis data\OASISWORKSll_data'
>>> geo_surface_obj = Geosurface( path =path )
>>> geo_surface_obj.read_oasis_files()
>>> geofilenames = geo_surface_obj.filenames
… note::To get the values of line K1_cor_oas “K1_cor_oas.csv

do k1_obj = geo_surface_obj.K1_cor_oas

write_file(path=None, depth_values=None, fileformat='.csv', **kwargs)[source]

Write output files. Output files are .xlsx or .csv .

Parameters
  • path (str) – full path to geodrill ouput files

  • depth_value (float or array_like) – depth values for imaging

:param fileformat:xlsx or csv are actually the acceptable formats. :type fileformat: str

pycsamt.geodrill.geoCore.geodrill.ascertain_layers_with_its_resistivities(real_layer_names, real_layer_resistivities)[source]

Assert the length of of real resistivites with their corresponding layers. If length of resistivities of larger that the layer’s names, then will add layer that match the best the remained resistivities. If the length of layer is larger than resistivities , to avoid miscomputation , will cut out this more layer and work only the length of resistivities provided.

Parameters
* real_layer_names: array_like , list

list of input layer names as real layers names encountered in area

  • real_layer_resistivities :array_like , list

    list of resistivities get on survey area

Returns
list

real_layer_names, new list of input layers

pycsamt.geodrill.geoCore.geodrill.display_infos(infos, **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 pycsamt.geodrill.geoCore.geodrill 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='~')
pycsamt.geodrill.geoCore.geodrill.geoModel(**kwargs)[source]

Get the type of geoData and plot the model . func will call the decorator pycsamt.wiewer.plot.geoplot2d. Decorator can be filled by using matplotlib properties. To plot geomodel misfit `, please change the `reason argument to misfit.

See also:

see documentation of decorator _geoplot2d.__doc__

Parameters
  • kwargs – kwargs arguments of “Geodrill obj”

  • etaCoef (int) – cofficent to divide the model blocks

  • input_resistivities (array_like or list) – Truth values of resistivities

  • plot_misfit (bool) – plot misfit of geodata

Params

Type

Description

geodtype

str

Plot geodata type, can be rr for stratigraphy log, sd for roughnness model and aver for rho average model. *default*plot is rr.

iter_fn

str

full path to occam iteration file

mesh_fn

str

full path to mesh_fn file

data_fn

str

full path to occam_data file

doi

str

depth of investigation might be float or str like “1km” =1000

depth_scale

str

scale of imaging depth can be “km” or “m”. Default is”m”

step_descent

float

block size for roughning , if not provided the step will be 20% of D0I

input_layers

list

true input_layers names : geological informations of encountered layers

Example
>>> from pycsamt.geodrill.geoCore.geodrill import geoModel
>>> path=r'F:\ThesisImp\occam2D\invers+files\inver_res\K1'
>>> inversion_files = {'model_fn':'Occam2DModel',
...                   'mesh_fn': 'Occam2DMesh',
...                    "iter_fn":'ITER17.iter',
...                   'data_fn':'OccamDataFile.dat'
...                    }
>>> 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()}
>>> geoModel(**inversion_files,
...            input_resistivities=input_resistivity_values,
...         input_layers=input_layer_names, geodtype ='rr',
...            plot_misfit=True
...         )
pycsamt.geodrill.geoCore.geodrill.geo_length_checker(main_param, optional_param, force=False, param_names=('input_resistivities', 'input_layers'), **kws)[source]

Geo checker is a function to check differents length of different params.

the length of optional params depend of the length of main params . if the length of optional params is larger than the length of main params, the length of optional params will be reduce to the length of main params .If the optional params length is shorther than the length of main params, will filled it either with “None” if dtype param is string of 0.if dtype params is float or 0 if integer.if Force is set True , it will absolutely check if the main params and the optional params have the same length. if not the case , will generate an error .

Parameters
* main_paramarray_like, list

main parameter that must took its length as reference length

  • optional paramsarray_like, list

    optional params, whom length depend to the length of main params

  • param_namestuple or str

    names of main params and optional params so to generate error if exits.

  • fill_value: str, float, optional

    Default value to fill thearray in the case where the length of optional param is less than the length of the main param .If None , will fill according to array dtype

Returns
array_like

optional param truncated according to the man params

class pycsamt.geodrill.geoCore.geodrill.geostrike[source]

Class to deal with computation with profile angle and geo_electrical strike. Compute Profile angle and strike angle

Need to import scipy.stats as one module . Sometimes import scipy

differently with stats may not work . either import scipy.stats rather than import scipy as sp to use :

sp.stats.linregress .

Methods

compute_geoelectric_strike([profile_angle, ...])

Compute geoelectric strike

compute_profile_angle([easting, northing])

Essentially dedicated to compute geoprofile angle.

static compute_geoelectric_strike(profile_angle=None, easting=None, northing=None, **kws)[source]

Compute geoelectric strike

Parameters
* profile_anglefloat

If not provided , will comput with easting and northing coordinates

  • eastingarray_like

    Easting coordiantes values

  • northingarray_like

    Northing coordinates values

  • geo_strikefloat

    strike value , if provided, will recomputed geo_electric strike .

Returns
——–
float

profile_angle in degree E of N

float

geo_electric_strike in degrees E of N

str

message of return

static compute_profile_angle(easting=None, northing=None)[source]

Essentially dedicated to compute geoprofile angle.

Parameters
* eastingarray_like

easting coordiantes values

  • northingarray_like

    northing coordinates values

Returns
float

profile_angle

float

geo_electric_strike

str

message of return

pycsamt.geodrill.geoCore.geodrill.get_closest_value(values_range, input_value)[source]

Fonction to get closest values when input values is not in the values range we assume that values are single on array. if the same value is repeated will take the first index and the value at that index

Parameters
  • values_range (array_like) – values to get

  • input_value (float,) – specific value

Returns

the closest value and its index

Rtye

float

pycsamt.geodrill.geoCore.geodrill.makeBlockSites(station_location, x_nodes, block_model)[source]

Build block that contains only the station locations values

Parameters
  • station_location – array of stations locations. Must be self contains on the horizontal nodes (x_nodes)

  • x_nodes – Number of nodes in horizontal

  • block_model – Resistivity blocks model

Returns

  • stationblocks: Block that contains only the

station location values.

Example
>>> from pycsamt.geodrill.geoCore.geodrill import makeBlockSite
>>> mainblocks= get_location_value(
    station_location=geosObj.makeBlockSite,
     x_nodes=geosObj.model_x_nodes, block_model=geosObj.model_res )

Module Structural

This file is part of pyCSAMT.

pyCSAMT is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

pyCSAMT is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with pyCSAMT. If not, see <https://www.gnu.org/licenses/>.

:synopsis:class for geological structural analysis

contains some conventional structure can populate the data

Created on Sat Nov 28 21:19:13 2020

@author: @Daniel03

class pycsamt.geodrill.geoCore.structural.Geo_formation(agso_file=None, **kwargs)[source]

This class is an axilliary class to supplement geodatabase , if the GeodataBase doesnt reply to SQL request , then use this class to secah information about structures . If SQL is done as well , program won’t call this class as rescure . Containers of more than 150 geological strutures.

Note

replace in attributes param “**” by the name of struture

Attributes

Type

Explanation

names

array_like

names of all geological strutures

codes

array_like

names of all geological codes

**code

str

code of specific geological structure

**label

str

label of specific structure

**name

str

label of specific structure

**pattern

str

pattern of specific structure

**pat_size

str

pattern size of specific structure

**pat_density

str

pattern density l of specific structure

**pat_thickness

str

pttern thickess of specific structure

**color

str

color of specific structure

  1. To see the names of strutures , write the script below

Example
>>> from pycsamt.geodrill.geoCore.strutural import Geo_formation as gf
>>> geo_structure = gf()
>>> geo_structure.names
  1. To extract color and to get the code of structure like amphibolite

Example
>>> from pycsamt.geodrill.geoCore.strutural import Geo_formation as gf
>>> geo_structure = gf()
>>> geo_structure.amphibolite['color']
>>> geo_structure.amphibolite['code']
>>> geoformation_obj.AMP['color']
... 'R128G128'
Attributes
agso_fn
class pycsamt.geodrill.geoCore.structural.Structure(**kwargs)[source]

Class for typical geological strutural conventions for AGSO_STCODES . All geological structural informations are geostructral object.

Holds the following information:

More attributes can be added by inputing a key word dictionary

Example
>>> from pycsamt.geodrill.geoCore.structural import Structure
>>> structural=Structure()
>>> boudin=boudin_axis()
>>> print(boudin.code)
>>> print(structural.boudin_axis.name)
>>> print(structural.boudin_axis.color)
class pycsamt.geodrill.geoCore.structural.banding_gneissosity(**kwargs)[source]

Special class for banding_gneissosity

Holds the following information:

Attributes

Type

Explanation

code

str

conventional code

label

str

named label

size

str

drawing size

pattern

str

drawing pattern

density

str

elmts density

thickness

str

drawing thickness

color

str

color set

More attributes can be added by inputing a key word dictionary

class pycsamt.geodrill.geoCore.structural.boudin_axis(**kwargs)[source]

Special class for boudins_axis

Holds the following information:

Attributes

Type

Explanation

code

str

conventional code

label

str

named label

size

str

drawing size

pattern

str

drawing pattern

density

str

elmts density

thickness

str

drawing thickness

color

str

color set

More attributes can be added by inputing a key word dictionary

class pycsamt.geodrill.geoCore.structural.fault_plane(**kwargs)[source]

Special class for fault_plane

Holds the following information:

Attributes

Type

Explanation

code

str

conventional code

label

str

named label

size

str

drawing size

pattern

str

drawing pattern

density

str

elmts density

thickness

str

drawing thickness

color

str

color set

More attributes can be added by inputing a key word dictionary

class pycsamt.geodrill.geoCore.structural.fold_axial_plane(**kwargs)[source]

Special class for fold_axial_plane

Holds the following information:

Attributes

Type

Explanation

code

str

conventional code

label

str

named label

size

str

drawing size

pattern

str

drawing pattern

density

str

elmts density

thickness

str

drawing thickness

color

str

color set

More attributes can be added by inputing a key word dictionary

class pycsamt.geodrill.geoCore.structural.fracture_joint_set(**kwargs)[source]

Special class for fracture_joint_set

Holds the following information:

Attributes

Type

Explanation

code

str

conventional code

label

str

named label

size

str

drawing size

pattern

str

drawing pattern

density

str

elmts density

thickness

str

drawing thickness

color

str

color set

More attributes can be added by inputing a key word dictionary

class pycsamt.geodrill.geoCore.structural.geo_pattern[source]

Singleton class to deal with geopattern with other modules. It is and exhaustive pattern dict, can be add and change. This pattern will be depreacted later , to create for pyCSAMT, its owwn geological pattern in coformity with the conventional geological swatches .

deal with USGS(US Geological Survey ) swatches- references and FGDC (Digital cartographic

Standard for Geological Map Symbolisation -FGDCgeostdTM11A2_A-37-01cs2.eps)

make _pattern:{‘/’, ‘’, ‘|’, ‘-’, ‘+’, ‘x’, ‘o’, ‘O’, ‘.’, ‘*’}

/ - diagonal hatching - back diagonal | - vertical - - horizontal + - crossed x - crossed diagonal o - small circle O - large circle . - dots * - stars

pycsamt.geodrill.geoCore.structural.get_color_palette(RGB_color_palette)[source]

Convert RGB color into matplotlib color palette. In the RGB color system two bits of data are used for each color, red, green, and blue. That means that each color runs on a scale from 0 to 255. Black would be 00,00,00, while white would be 255,255,255. Matplotlib has lots of pre-defined colormaps for us . They are all normalized to 255, so they run from 0 to 1. So you need only normalize data, then we can manually select colors from a color map

Parameters

RGB_color_palette (str) – str value of RGB value

Returns

rgba, tuple of (R, G, B)

Return type

tuple

Example
>>> from pycsamt.geodrill.geoCore.structural import get_color_palette
>>> get_color_palette (RGB_color_palette ='R128B128')
class pycsamt.geodrill.geoCore.structural.s_fabric(**kwargs)[source]

Special class for s_fabric

Holds the following information:

Attributes

Type

Explanation

code

str

conventional code

label

str

named label

size

str

drawing size

pattern

str

drawing pattern

density

str

elmts density

thickness

str

drawing thickness

color

str

color set

More attributes can be added by inputing a key word dictionary

class pycsamt.geodrill.geoCore.structural.sharp_contact(**kwargs)[source]

Special class for sharp_contact

Holds the following information:

More attributes can be added by inputing a key word dictionary

class pycsamt.geodrill.geoCore.structural.undifferentiated_plane(**kwargs)[source]

Special class for undifferentiated_plane

Holds the following information:

Attributes

Type

Explanation

code

str

conventional code

label

str

named label

size

str

drawing size

pattern

str

drawing pattern

density

str

elmts density

thickness

str

drawing thickness

color

str

color set

More attributes can be added by inputing a key word dictionary

Module Strata