pycsamt.interp.borehole#

Borehole — ground-truth data model for EM geological interpretation.

A Borehole stores the depth-interval log collected during or after drilling operations. Intervals carry the true resistivity (TRES) measured in the lab or from downhole logging, and a lithology name. Both are used by ModelCalibrator to constrain 2-D inversion models.

Supported input formats#

  • CSV — single file with columns top, bottom, lithology[, resistivity]

  • LAS 2.0 — industry well-log ASCII standard

  • dict / list — programmatic construction

Example

>>> bh = Borehole.from_csv("K1_borehole.csv", name="Bo", x=1050.0)
>>> bh.tres_at_depth(95.0)
180.0

Classes

Borehole(name, x, intervals, *[, ...])

Borehole / well log with depth-interval data.

Interval(top, bottom, lithology[, resistivity])

A single depth interval in a borehole log.

class pycsamt.interp.borehole.Interval(top, bottom, lithology, resistivity=None)[source]#

Bases: object

A single depth interval in a borehole log.

Parameters:
  • top (float) – Depth to the top of the interval, metres.

  • bottom (float) – Depth to the bottom of the interval, metres.

  • lithology (str) – Geological formation / lithology name.

  • resistivity (float or None) – True resistivity (TRES) in Ω·m (linear, not log₁₀). None when no electrical measurement is available.

top: float#
bottom: float#
lithology: str#
resistivity: float | None = None#
property thickness: float[source]#
contains(z)[source]#
Parameters:

z (float)

Return type:

bool

class pycsamt.interp.borehole.Borehole(name, x, intervals, *, collar_elevation=0.0)[source]#

Bases: object

Borehole / well log with depth-interval data.

Parameters:
  • name (str) – Well / borehole identifier.

  • x (float) – Position along the survey profile, metres.

  • collar_elevation (float) – Surface elevation at the borehole collar, metres a.s.l. Used only when elevation-corrected exports are requested.

  • intervals (list of Interval) – Depth-interval log, sorted ascending by top.

intervals: list[Interval]#
interval_at_depth(z)[source]#

Return the interval that contains depth z, or None.

Parameters:

z (float)

Return type:

Interval | None

tres_at_depth(z)[source]#

Return TRES (Ω·m) at depth z, or None if unknown.

Parameters:

z (float)

Return type:

float | None

lithology_at_depth(z)[source]#

Return the lithology name at depth z, or None.

Parameters:

z (float)

Return type:

str | None

tres_column(z_centers)[source]#

Return TRES values at z_centers as a float array.

Depths not covered by any interval are nan.

Parameters:

z_centers (ndarray)

Return type:

ndarray

property max_depth: float[source]#
property min_depth: float[source]#
classmethod from_csv(path, *, name=None, x=0.0, collar_elevation=0.0, delimiter=',', top_col='top', bottom_col='bottom', lithology_col='lithology', resistivity_col='resistivity')[source]#

Load from a CSV file.

Expected columns (case-insensitive header): top, bottom, lithology[, resistivity]

Parameters:
  • path (path-like)

  • name (str, optional) – Defaults to the file stem.

  • x (float) – Profile position.

  • collar_elevation (float)

  • delimiter (str)

  • top_col (str) – Column header names.

  • bottom_col (str) – Column header names.

  • lithology_col (str) – Column header names.

  • resistivity_col (str) – Column header names.

Return type:

Borehole

classmethod from_las(path, *, x=0.0, collar_elevation=0.0, depth_curve='DEPT', resistivity_curve='RESD', lithology_curve='LITH', null_value=-9999.25, step=None)[source]#

Load from a LAS 2.0 well-log file.

Converts the continuous depth log into discrete intervals by grouping consecutive samples with the same lithology code.

Parameters:
  • path (path-like)

  • x (float) – Profile position.

  • depth_curve (str) – Curve mnemonics. lithology_curve may be None to assign a generic label.

  • resistivity_curve (str) – Curve mnemonics. lithology_curve may be None to assign a generic label.

  • lithology_curve (str | None) – Curve mnemonics. lithology_curve may be None to assign a generic label.

  • null_value (float) – LAS null sentinel replaced with nan.

  • step (float, optional) – If provided, override the step value from the LAS header.

  • collar_elevation (float)

Return type:

Borehole

to_dataframe()[source]#

Return intervals as a pandas.DataFrame.

to_dict()[source]#
Return type:

dict