label_depths

petrophys.model.label_depths

Also available as petrophys.evaluation.intervals.label_depths

label_depths(
depth,
intervals,
*,
label=None,
top=None,
bottom=None,
overlap='error',
default='',
)[source]

Label each depth with the name of the interval that contains it.

Use it to attach formation, zone or lithology names to log samples, core plugs or any other depths. Each interval covers top <= depth < bottom, so a depth on a shared boundary belongs to the deeper interval.

Parameters:
  • depth (float, array-like or Well) – Depths to label (a well’s depth is used when a Well is given), in the same unit and reference as the intervals.

  • intervals (DataFrame, FormationTops or sequence of Interval) – Interval table, for example from petrophys.read_formations() (top_depth, bottom_depth, formation_name) or petrophys.io.read_lithology_intervals() (top, bottom, lithology). Column names are detected; override them with top, bottom and label.

  • label (str, optional) – Table column, or Interval attribute (default "name"), holding the label. For a table, the first of formation_name, name, zone and lithology that exists is used.

  • top (str, optional) – Top and bottom depth columns of a table.

  • bottom (str, optional) – Top and bottom depth columns of a table.

  • overlap ({"error", "thinnest", "thickest"}, default "error") – What to do where intervals overlap, as in nested tops that list groups and the formations within them. "thinnest" picks the most detailed interval (the formation), "thickest" the broadest (the group). The default raises so that nesting is never resolved silently.

  • default (object, default "") – Label for depths outside every interval. Intervals with a missing (NaN) top or bottom are left out with a warning, so their depths get this label too.

Returns:

One label per depth.

Return type:

ndarray of object

Raises:

ValueError – If intervals overlap and overlap="error", a column cannot be found, or overlap is not a supported rule.

Examples

>>> import pandas as pd
>>> tops = pd.DataFrame({
...     "formation_name": ["BRENT GP.", "Ness Fm.", "Etive Fm."],
...     "top_depth": [2841.0, 2841.0, 2865.0],
...     "bottom_depth": [2958.0, 2865.0, 2958.0]})
>>> label_depths([2830.0, 2850.0, 2900.0], tops, overlap="thinnest").tolist()
['', 'Ness Fm.', 'Etive Fm.']
>>> label_depths([2850.0], tops, overlap="thickest").tolist()
['BRENT GP.']