FormationTops¶
petrophys.model.FormationTops
Also available as petrophys.evaluation.intervals.FormationTops
- class FormationTops(intervals=None)[source]¶
Manager for a collection of formation/zone intervals.
Provides loading from CSV (simple, NPD, Danish formats), validation (overlap detection), querying by depth/name, and export to DataFrame/CSV.
Examples
>>> import petrophys as pp >>> tops = FormationTops.from_csv(pp.sample("formations_30_6-5")) >>> tops.validate() [] >>> tops.get_by_name("BRENT GP.").top_depth 2841.0 >>> [fm.name for fm in tops.get_at_depth(2850.0)] ['BRENT GP.', 'Ness Fm.']
Attributes
Methods
Add an interval and re-sort.
Return a new FormationTops with intervals clipped to well depth range.
Return intervals of a specific kind.
Find overlapping peers, allowing explicitly linked parent containment.
Read bounded intervals through the shared geology importer.
Read a table using the same validation as CSV and plotting.
Create from a list of dictionaries.
Return all intervals containing this depth.
Get first interval matching name (case-insensitive).
Return intervals overlapping with [top, bottom] range.
Return True if any intervals of the same kind overlap.
Remove first interval matching name.
Export intervals to CSV (depths at full precision).
Convert intervals to a pandas DataFrame.
Validate intervals: check for overlaps within same kind.
- classmethod from_csv(
- filepath,
- well_name=None,
- format='auto',
- interval_kind=IntervalKind.FORMATION,
- *,
- terminal_depth=None,
- rank=None,
- **read_options,
Read bounded intervals through the shared geology importer.
Simple, NPD and Danish headers share one validated schema. Top-only files require an explicit terminal_depth to derive intervals; no bottom is invented. Select rank before deriving intervals from hierarchical picks. read_options accepts the read_formations table/depth controls.
- Parameters:
- Return type:
- classmethod from_dict(data, interval_kind=IntervalKind.FORMATION)[source]¶
Create from a list of dictionaries.
Each dict must have keys: “name”, “top_depth”, “bottom_depth”. Optional keys: “lithology”, “age”, “parent_formation”, “parent_zone”.
- Parameters:
interval_kind (IntervalKind)
- Return type:
- classmethod from_dataframe(
- df,
- name_col='name',
- top_col='top_depth',
- bottom_col='bottom_depth',
- lithology_col='lithology',
- interval_kind=IntervalKind.FORMATION,
- *,
- terminal_depth=None,
- rank=None,
- **read_options,
Read a table using the same validation as CSV and plotting.
- Parameters:
- Return type:
- validate()[source]¶
Validate intervals: check for overlaps within same kind.
- Returns:
Validation issues (empty if all OK)
- Return type:
- Raises:
ValueError – If overlapping intervals are found
- filter_by_kind(kind)[source]¶
Return intervals of a specific kind.
- Parameters:
kind (IntervalKind)
- Return type:
- clip_to_well(well)[source]¶
Return a new FormationTops with intervals clipped to well depth range.
Intervals completely outside the well range are excluded. Partially overlapping intervals are clipped to well boundaries. Intervals whose
metadata["depth_unit"]is the other length unit (“m” or “ft”) thanwell.depth_unitare converted to the well unit first.- Parameters:
well (Well) – Well object with depth array
- Return type: