LogViewer

petrophys.visualization.LogViewer

class LogViewer(
well,
template_xml_path=None,
template_defaults='auto',
strict=False,
figsize=None,
lithology_mapping=None,
lithology_mapping_df=None,
formation_tops=None,
formation_tops_df=None,
formation_name=None,
lithology_intervals=None,
tracks=None,
interpreted=False,
curves=None,
curve_styles=None,
)[source]

PetroPy-style template-driven well log plotter.

Parameters:
  • well (Well) – Local Well object containing a depth array and curves.

  • template_xml_path (str or Path, optional) – XML template file. When omitted, template_defaults is used.

  • template_defaults (str) – Template mode/name. auto builds tracks from available curves. Built-in XML names include raw, petrophysics, minerals and comprehensive (also called geolink_full).

  • strict (bool) – If True, missing curves listed by the template raise ValueError. If False, they are skipped and recorded in warnings.

  • figsize ((float, float), optional) – Figure size in inches. By default the width follows the tracks (at least 11 in) and the height is 14.5 in.

  • interpreted (bool) – True for an interpretation’s well: units are converted for display but values are not screened again, so the plot shows what the interpretation used.

  • lithology_mapping (mapping, optional) – Mapping from lithology code to label for lithology tracks.

  • lithology_mapping_df (DataFrame, optional) – PetroPy-script-compatible mapping table. Columns named Abbreviation and Attribute are recognized. If both label columns exist, Attribute takes precedence over Lithology Attribute. When neither mapping is given, codes use the built-in lithology labels, or the CSV/Excel table named by the PETROPHYS_LITHOLOGY_MAPPING environment variable when it is set.

  • formation_tops (mapping, sequence, DataFrame, or path, optional) – Formation tops to annotate. Accepts mappings of name to depth, (name, depth) pairs, CSV/Excel paths, or tabular objects. Defaults to the formations attached to the well by petrophys.read().

  • formation_tops_df (DataFrame, optional) – Formation tops as a table; when given, it is used in place of formation_tops.

  • formation_name (str, optional) – Formation or interval name to show in the top title beside the well name.

  • lithology_intervals (path or DataFrame, optional) – Single-well CSV/XLSX/table with top,bottom,lithology columns, in the same depth units and datum as the well. Overrides embedded lithology for display only, preserving interval boundaries and unfilled gaps.

  • tracks (sequence of str, optional) – Names of the tracks to draw, in that order; the other tracks are left out. An unknown or repeated name raises ValueError.

  • curves (sequence of str, optional) – Draw only these curves (the well’s own names or standard names such as "GR"), each in its track; curves no track takes go to tracks titled by their names. A name not on the well raises ValueError. Give tracks or curves, not both.

  • curve_styles (mapping, optional) – Style changes per curve, keyed by standard or the well’s own name, e.g. {"GR": {"color": "black", "right": 200}}; the keys are those listed for petrophys.plot(). A name no track draws is recorded in warnings.

Attributes

diagnostics

Structured import/plot diagnostics for notebooks and automation.

well

Plotted copy of the input well in standard units, with the curve names kept (GR_EDTC stays GR_EDTC and fills the GR track through the alias tables); the caller's well is unchanged.

optional_tracks

Optional tracks left out of this plot; name one in tracks= to draw it.

Methods

close

Close the underlying matplotlib figure and release it (frees memory).

create

Create and return (figure, axes).

save

Save the plot to disk.

show

Display the figure.

well

Plotted copy of the input well in standard units, with the curve names kept (GR_EDTC stays GR_EDTC and fills the GR track through the alias tables); the caller’s well is unchanged. With interpreted (an interpretation’s well) values are not screened again, so the plot shows what the interpretation used.

optional_tracks: List[str]

Optional tracks left out of this plot; name one in tracks= to draw it.

create(depth_range=None, top=None, height=None)[source]

Create and return (figure, axes).

depth_range is the (top, bottom) of the plot window, in the well’s depth unit; alternatively top and height give its top and its length. Without either, the window is the template’s, else the logged interval. Giving depth_range with top or height, or a window without height, raises ValueError. A window outside the logged interval is drawn empty, with a warning.

Parameters:
Return type:

Tuple[Figure, List[Axes]]

show()[source]

Display the figure.

Return type:

None

close()[source]

Close the underlying matplotlib figure and release it (frees memory).

Return type:

None

save(filename, dpi=150)[source]

Save the plot to disk.

Outside an interactive session (a script or batch job, where no window shows the figure) the figure is released from pyplot after saving, so plotting many wells does not hold every figure in memory; .fig keeps it, with any changes you made, for further edits and saves.

Parameters:
Return type:

None

property diagnostics: Dict[str, Any]

Structured import/plot diagnostics for notebooks and automation.