inputs module

This module contains functions to load and save ArchPy models and results.

exception inputs.GeolInconsistencyError

Bases: Exception

inputs.bhs_analysis(db, Strat_ID='Strat_ID', Facies_ID='Facies_ID', top_col='top', bot_col='bot', ax=None)

Function to plot the facies proportions in boreholes and return the values in a dataframe

Parameters:
  • db (pandas dataframe) – dataframe containing the geological database, each row is an interval observed The dataframe is composed of at least the following columns:

    • Strat_ID: name of the column containing the stratigraphic ID

    • Facies_ID: name of the column containing the facies ID

    • top: name of the column containing the top altitude of the interval

    • bot: name of the column containing the bot altitude of the interval

  • Strat_ID (str, optional) – name of the column containing the name of the stratigraphic unit

  • Facies_ID (str, optional) – name of the column containing the name of the facies

  • top_col (str, optional) – name of the column containing the top of the interval

  • bot_col (str, optional) – name of the column containing the bottom of the interval

  • ax (matplotlib axis, optional) – axis to plot the results

Returns:

dataframe containing the facies proportions in each stratigraphic unit

Return type:

pandas dataframe

inputs.create_d_f_covmodels(unit)
inputs.create_d_facies(self)
inputs.create_d_pile(pile)
inputs.create_d_piles(ArchTable)
inputs.create_d_prop(prop)
inputs.create_d_properties(ArchTable)
inputs.create_d_unit(unit, ws)
inputs.create_d_units(ArchTable)
class inputs.drawPoly

Bases: object

Class to draw a polygon on a specified figure (ax) and return the coordinates of the polygon. First the object must be create and after the draw function can be called. It takes as inputs a figure (ax) and a type of drawing (rectangle or polygon)

draw(ax, typ='rectangle')

Draw a polygon on a specified figure (ax) and return the coordinates of the polygon. It takes as inputs a figure (ax) and a type of drawing (rectangle or polygon)

Parameters:
  • ax (matplotlib axes object) – axes on which the polygon will be drawn

  • typ (str, optional) – type of drawing, by default “rectangle”. Can be “rectangle” or “polygon”.

f(x)
f_rect(eclick, erelease)
inputs.extract_bhs(df, list_bhs, ArchTable, units_to_ignore=(), facies_to_ignore=(), extract_units=True, extract_facies=True, ignore2None=True, fill_gaps=True, vb=0)

Return a list of ArchTable boreholes from final database of load_bh_files

Parameters:
  • df (pandas dataframe) – final database of load_bh_files

  • list_bhs (pandas dataframe) – list of boreholes dataframe with appropriate column name (generally use second output of load_bh_files())

  • ArchTable (base.Arch_table object) – Arch_table object

  • units_to_ignore (sequence of string, optional) – unit identifiers to ignore in the database df. The default is ().

  • facies_to_ignore (sequence of string, optional) – facies identifiers to ignore in the database df. The default is ().

  • extract_units (bool, optional) – extracting unit info. The default is True.

  • extract_facies (bool, optional) – extracting facies info. The default is True.

  • ignore2None (bool, optional) – Ignoring units and facies are considered as None (i.e. gaps). The default is True.

  • fill_gaps (bool, optional) – if possible, gaps are filled. It means that if you have a gap in the data, the unit/facies is considered as the one above. The default is True.

  • vb (int, optional) – verbose. The default is 0.

Returns:

list of boreholes objects

Return type:

list of base.borehole objects

inputs.imp_cm(covmodel_dic, ws=None)

Function to import a geone covmodel given the dictionnary written in the yaml file

Note

The dictionnary must contain the following keys: - elem : list of tuples containing the elementary structures - alpha : list of floats, anisotropy ratios - beta : list of floats, anisotropy ratios - gamma : list of floats, anisotropy ratios

Warning

Does not work if the variogram is a pure nugget

Parameters:

covmodel_dic (dict) – dictionnary containing the covmodel parameters

Return type:

geone.covModel

inputs.import_d_facies(dic_project)

Import a dictionary of facies objects from the dictionary of the project that was imported from the yaml file

Parameters:

dic_project (dict) – Dictionary of the project imported from the yaml file

Returns:

Dictionary of facies objects

Return type:

dict

inputs.import_d_piles(dic_project, d_units)

Import a dictionary of pile objects from the given dictionary project

Parameters:
  • dic_project (dict) – Dictionary of the project imported from the yaml file

  • d_units (dict) – Dictionary of units objects (see import_d_units())

inputs.import_d_prop(dic_project, d_fa)

Import a dictionary of property objects

Parameters:
  • dic_project (dict) – Dictionary of the project imported from the yaml file

  • d_fa (dict) – Dictionary of facies objects (see import_d_facies())

inputs.import_d_units(dic_project, all_facies, ws=None)

Import a dictionary of unit objects

Parameters:
  • dic_project (dict) – Dictionary of the project imported from the yaml file

  • all_facies (dict) – Dictionary of all facies objects

  • ws (str, optional) – Path to the working directory, by default None

Returns:

Dictionary of units objects

Return type:

dict

inputs.import_project(project_name, ws, import_bhs=True, import_results=True, import_grid=True)

Load an ArchPy project (Arch_table) with the specified name (project_name) and in the working_directory (ws)

Note

All the configurations files must be in the working directory

Parameters:
  • project_name (str) – Name of the project –> name of the yaml file

  • ws (str) – Path to the working directory where all files are stored

  • import_bh (bool, optional) – Flag to indicate to import borehole files, by default True

  • import_results (bool, optional) – Flag to indicate to import result files, by default True

  • import_grid (bool, optional) – Flag to indicate to import grid, by default True

Return type:

ArchPy.base.Arch_table object

inputs.load_bh_files(list_bhs, facies_data, units_data, lbhs_bh_id_col='bh_ID', u_bh_id_col='bh_ID', fa_bh_id_col='bh_ID', u_top_col='top', u_bot_col='bot', u_ID='Strat', fa_top_col='top', fa_bot_col='bot', fa_ID='facies_ID', bhx_col='bh_x', bhy_col='bh_y', bhz_col='bh_z', bh_depth_col='bh_depth', dic_units_names={}, dic_facies_names={}, altitude=True, vb=1)

This function merges unit and facies databases in only one, each row of the output dataframe corresponds to a layer information about units and facies

Parameters:
  • list_bhs (panda dataframe) – list of boreholes in ArchPy format

  • facies_data (panda dataframe) – facies data file in ArchPy format

  • units_data (panda dataframe) – unit data file in ArchPy format

  • lbhs_bh_id_col (str, optional) – column name of borehole identifier in list_bhs data file, by default “bh_ID”

  • u_bh_id_col (str, optional) – column name of borehole identifier in unit data file, by default “bh_ID”

  • fa_bh_id_col (str, optional) – column name of borehole identifier in facies data file, by default “bh_ID”

  • u_top_col (str, optional) – column name of top elevation info in unit data file, by default “top”

  • u_bot_col (str, optional) – column name of bot elevation info in unit data file, by default “bot”

  • u_ID (str, optional) – column name of unit identifier info in unit data file, by default “Strat”

  • fa_top_col (str, optional) – column name of top elevation info in facies data file, by default “top”

  • fa_bot_col (str, optional) – column name of bot elevation info in facies data file, by default “bot”

  • fa_ID (str, optional) – column name of top elevation info in facies data file, by default “facies_ID”

  • dic_units_names (dictionary, optional) – dictionary of units names, by default {}

  • dic_facies_names (dictionary, optional) – dictionary of facies names, by default {}

  • altitude (bool, optional) – if True, the elevation of the boreholes is taken into account, by default True

  • vb (int, optional) – verbose, by default 1

Returns:

dataframe with unit and facies information merged

Return type:

panda dataframe

inputs.load_results(ArchTable, surfs=None, surfs_bot=None, units=None, facies=None, props=None)

Load ArchTable results. If external results must be imported, path of these files (e.g. surf argument) can be passed directly All files must be pickle binary files with appropriate format (see below).

Parameters:
  • ArchTable (base.Arch_table) – ArchTable object

  • surf (str,) – Path to the surface results file The surfaces original format must be a dictionary with 2D arrays containing surfaces as values and associated pile objects as keys.

  • surf_bot (str,) – Path to the surface bot results file The surfaces original format must be a dictionary with 2D arrays containing surfaces as values and associated pile objects as keys.

  • units (str,) – Path to the units results file The units original format must be a 4D array of size (nreal, nz, ny, nx) with unit IDs as values.

  • facies (str,) – Path to the facies results file The facies original format must be a 5D array of size (nreal_units, nreal_facies, nz, ny, nx) with facies IDs as values.

  • props (str,) – Path to the properties results file The properties original format must be a dictionary with property names as keys and 6D array of size (nreal_units, nreal_facies, nreal_prop, nz, ny, nx) with prop values as values.

Returns:

ArchTable – ArchTable object with results loaded

Return type:

base.Arch_table

inputs.save_project(ArchTable, results=True)

Save an Arch_table object in a yaml file and other supplementary files (images, numpy arrays, gslib files) in a folder.

Parameters:
  • ArchTable (base.Arch_table) – Arch_table object to save

  • results (bool, optional) – flag to save results or not

inputs.save_results(ArchTable)

Save ArchTable results

inputs.write_bh_files(ArchTable, fake_bhs=False, vb=0)

Write input files from an existing ArchTable project