read_formations

petrophys.io.read_formations

Also available as petrophys.read_formations

read_formations(
source,
*,
columns=None,
well_name=None,
well=None,
depth_unit=None,
depth_reference=None,
datum=None,
sheet_name=None,
sep=None,
encoding='utf-8-sig',
rank=None,
)[source]

Read formation picks or bounded intervals into one canonical table.

Required columns are formation_name,top_depth; bottom_depth is optional and is never invented. CSV/TSV/Excel, DataFrames, FormationTops, interval lists, name/depth mappings and pairs are supported. columns maps canonical names to source headers. Multiwell inputs require selection. Rank, parent, age and lithology are preserved. Depth metadata and a structured import report are stored in DataFrame.attrs. With well, compatible length units are converted; incompatible reference/datum joins are rejected. rank (e.g. "formation") keeps one stratigraphic level of a hierarchical table; NPD-style names (“Etive Fm.”) carry their rank.

Returns:

One row per formation, sorted by top_depth: formation_name, top_depth and those of bottom_depth, lithology, age, rank, parent, well, depth_unit, depth_reference and datum the source gives. Depths are numbers in the source’s unit, or in the depth unit of well when it is given. DataFrame.attrs holds depth_unit, depth_reference, datum and import_report.

Return type:

DataFrame

Raises:
  • FileNotFoundError – If a source file does not exist.

  • ValueError – If a required column is missing, a depth is not a finite number, a top is not above its bottom, a table of several wells is given without well_name or well, no row matches the well or rank, or the depth reference or datum does not match the well’s.