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,
PetroPy-style template-driven well log plotter.
- Parameters:
well (Well) – Local
Wellobject containing a depth array and curves.template_xml_path (str or Path, optional) – XML template file. When omitted,
template_defaultsis used.template_defaults (str) – Template mode/name.
autobuilds tracks from available curves. Built-in XML names includeraw,petrophysics,mineralsandcomprehensive(also calledgeolink_full).strict (bool) – If True, missing curves listed by the template raise
ValueError. If False, they are skipped and recorded inwarnings.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
AbbreviationandAttributeare recognized. If both label columns exist,Attributetakes precedence overLithology Attribute. When neither mapping is given, codes use the built-in lithology labels, or the CSV/Excel table named by thePETROPHYS_LITHOLOGY_MAPPINGenvironment 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 bypetrophys.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,lithologycolumns, 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 raisesValueError. Givetracksorcurves, 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 forpetrophys.plot(). A name no track draws is recorded inwarnings.
Attributes
Structured import/plot diagnostics for notebooks and automation.
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 left out of this plot; name one in
tracks=to draw it.Methods
Close the underlying matplotlib figure and release it (frees memory).
Create and return
(figure, axes).Save the plot to disk.
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.
- create(depth_range=None, top=None, height=None)[source]¶
Create and return
(figure, axes).depth_rangeis the(top, bottom)of the plot window, in the well’s depth unit; alternativelytopandheightgive its top and its length. Without either, the window is the template’s, else the logged interval. Givingdepth_rangewithtoporheight, or a window without height, raisesValueError. A window outside the logged interval is drawn empty, with a warning.
- 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;
.figkeeps it, with any changes you made, for further edits and saves.