Plotting Well Logs

Created on 28 Feb 2011

Plotting LIS data requires these components:

  • A PlotConfig object
  • A data set (e.g. a LogPass with a FrameSet).
  • An output driver (e.g. screen, print PDF, web SVG).

User creates a PlotConfig (this reflects a PRES table). This is reusable.

User specifies a data set (from, to, channels etc.).
e.g. Invoke LogPass.setFrameSet(File, theFrameSlice=theFrameSlice, theChList=theChList)
User says ‘plot this data set with this configuration to this output device’.
e.g. Plot(PlotConfig, LogPass, PlotDevice) Plot uses LogPass.genChScValues(ch, sc) to plot individual curves.

Lacunae

Area plotting. Caching (e.g. SVG fragments - is this worth it?)

PlotConfig

PlotTracks

Typically a three track (+depth) have these dimensions in inches:

Track Left Right Width
1 0 2.4 2.4
Depth 2.4 3.2 0.8
2 3.2 5.6 2.4
3 5.6 8.0 2.4

Track names can be split (e.g. LHT1 is left hand track 1) or merged (T23 is spread across tracks two and three).

Examples of PRES and FILM records:

 Table record (type 34) type: PRES

MNEM  OUTP  STAT  TRAC  CODI  DEST  MODE      FILT          LEDG          REDG
-----------------------------------------------------------------------------------

SP    SP    ALLO  T1    LLIN  1     SHIF      0.500000      -80.0000       20.0000
CALI  CALI  ALLO  T1    LDAS  1     SHIF      0.500000       5.00000       15.0000
MINV  MINV  DISA  T1    LLIN  1     SHIF      0.500000       30.0000       0.00000
MNOR  MNOR  DISA  T1    LDAS  1     SHIF      0.500000       30.0000       0.00000
LLD   LLD   ALLO  T23   LDAS  1     GRAD      0.500000      0.200000       2000.00
LLDB  LLD   ALLO  T2    HDAS  1     GRAD      0.500000       2000.00       200000.
LLG   LLG   DISA  T23   LDAS  1     GRAD      0.500000      0.200000       2000.00
LLGB  LLG   DISA  T2    HDAS  1     GRAD      0.500000       2000.00       200000.
LLS   LLS   ALLO  T23   LSPO  1     GRAD      0.500000      0.200000       2000.00
LLSB  LLS   ALLO  T2    HSPO  1     GRAD      0.500000       2000.00       200000.
MSFL  MSFL  ALLO  T23   LLIN  1     GRAD      0.500000      0.200000       2000.00

Table record (type 34) type: FILM

MNEM  GCOD  GDEC  DEST  DSCA
-----------------------------

1     E20   -4--  PF1   D200
2     EEE   ----  PF2   D200 

Table record (type 34) type: PRES

MNEM  OUTP  STAT  TRAC  CODI  DEST  MODE      FILT          LEDG          REDG
-----------------------------------------------------------------------------------

NPHI  NPHI  ALLO  T23   LDAS  1     SHIF      0.500000      0.450000     -0.150000
DRHO  DRHO  ALLO  T3    LSPO  1     NB        0.500000     -0.250000      0.250000
PEF   PEF   ALLO  T23   LGAP  1     SHIF      0.500000       0.00000       10.0000
SGR         DISA  T1    LLIN  1     SHIF      0.500000       0.00000       300.000
CGR         DISA  T1    LGAP  1     SHIF      0.500000       0.00000       300.000
TENS  TENS  DISA  T3    LGAP  1     SHIF      0.500000       14000.0       4000.00
CAL   CALI  ALLO  T1    LSPO  1     SHIF      0.500000       5.00000       15.0000
BS    BS    DISA  T1    LGAP  1     SHIF      0.500000       5.00000       15.0000
FFLS  FFLS  DISA  T1    LLIN  2     NB        0.500000     -0.150000      0.150000
FFSS  FFSS  DISA  T1    LDAS  2     NB        0.500000     -0.150000      0.150000
LSHV  LSHV  DISA  T3    LLIN  2     WRAP      0.500000       2150.00       2250.00
SSHV  SSHV  DISA  T3    LDAS  2     WRAP      0.500000       1950.00       2050.00
FLS   FLS   DISA  T2    LLIN  2     SHIF      0.500000       0.00000       150.000
FSS   FSS   DISA  T2    LDAS  2     SHIF      0.500000       0.00000       150.000
RHOB  RHOB  ALLO  T23   LLIN  1     SHIF      0.500000       1.95000       2.95000
PHIX  PHIX  ALLO  T1    LLIN  1     NB        0.500000      0.500000       0.00000
TotalDepth.util.plot.Plot.COMMENTS_IN_SVG_TRACE = False

Allows detailed trace comments to appear in the SVG

TotalDepth.util.plot.Plot.COMMENTS_IN_SVG_SECTION = True

A few comments in SVG to delinialte header, Grid, Xaxis, curves etc

TotalDepth.util.plot.Plot.COMMENTS_IN_SVG_SECTION_WIDTH = 40

Width of comment for sections

TotalDepth.util.plot.Plot.COMMENTS_IN_SVG_SECTION_LEVEL_TUPLE = ('=', '.', '^')

Map of section level to comment padding character

exception TotalDepth.util.plot.Plot.ExceptionTotalDepthLISPlot

Exception for plotting.

exception TotalDepth.util.plot.Plot.ExceptionTotalDepthPlotRoll

Exception for plotting.

class TotalDepth.util.plot.Plot.CurvePlotScale

Holds a minimal amount of curve plot scale and so on for the layout of the scale pane at each end of the log.

halfTrackStart is the start of the curve for a standard three track log T1=0, TD=2, T2=4, T3=6

halfTracks is the curve span as an integer so T23=4 LHT1=1 and so on.

class TotalDepth.util.plot.Plot.ScaleSliceCurve

ScaleSliceCurve(slice, curveName, start, span)

curveName

Alias for field number 1

slice

Alias for field number 0

span

Alias for field number 3

start

Alias for field number 2

class TotalDepth.util.plot.Plot.CurvePlotScaleSlotMap(theCpsS)

Keeps track of which slots are available for putting the curve scales in at the top and bottom of the log. This scale are is divided into slices that span the plot from left to right. These slices are subdivided into slots that correspond to a half-track in that slice.

reset()

Clears the slot map for the current slice.

canFit(theCps)

Returns True if I can fit the CurvePlotScale object in the current slice.

fit(theCps)

Populates slots from a CurvePlotScale, caller should call canFit() first.

genScaleSliceCurve()

Generates a ordered list of ScaleSliceCurve objects laid out in a ‘nice’ fashion.

class TotalDepth.util.plot.Plot.PlotRoll(theXStart, theXStop, theScale, theLegendDepth, theHeadDepth=Dim(value=0, units='in'), theTailDepth=Dim(value=0, units='in'), plotUp=True, theWidth=Dim(value=8.5, units='in'), theMargin=Margin(left=Dim(value=0.25, units='in'), right=Dim(value=0.25, units='in'), top=Dim(value=0.25, units='in'), bottom=Dim(value=0.25, units='in')))

Describes the plot canvas as if it were a roll of paper. This can compute the various dimensions and positions of plot panes:

Legend:

  • ... - The plot within margins.
  • *** - Optional headers and trailers.
  • +++ - The upper and lower headers for scales (legends).
  • ^^^ - The main plotting area.

In this diagram adjacent lines overlay:

|--------------------------------------------------------------------|
|                           Plot margin                              |
|   ..............................................................   |
|   .************************************************************.   |
|   .*                                                          *.   |
|   .*            Optional header e.g. API header               *.   |
|   .*                                                          *.   |
|   .************************************************************.   |
|   .++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.   |
|   .+                                                          +.   |
|   .+       Scales (legends) at the top of the plot.           +.   |
|   .+                                                          +.   |
|   .++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.   |
|   .^^^^^^^^^^^^^^^ -- X Stop (if up log) -- ^^^^^^^^^^^^^^^^^^^.   |
|   .^                                                          ^.   |
|   .^                                                          ^.   |
|   .^                                                          ^.   |
|   .^                  Main log plotted here                   ^.   |
|   .^                                                          ^.   |
|   .^                                                          ^.   |
|   .^                                                          ^.   |
|   .^^^^^^^^^^^^^^^^ -- X Start (if up log) -- ^^^^^^^^^^^^^^^^^.   |
|   .++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.   |
|   .+                                                          +.   |
|   .+       Scales (legends) at the bottom of the plot.        +.   |
|   .+                                                          +.   |
|   .++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++.   |
|   .************************************************************.   |
|   .*                                                          *.   |
|   .*         Optional trailer e.g. calibration record         *.   |
|   .*                                                          *.   |
|   .************************************************************.   |
|   ..............................................................   |
|                           Plot margin                              |
|--------------------------------------------------------------------|
viewBox

The overall size of the plot.

width

The overall width as a number in PlotConstants.DEFAULT_PLOT_UNITS.

depth

The overall width as a number in PlotConstants.DEFAULT_PLOT_UNITS.

widthDim

The overall width as a Coord.Dim().

depthDim

The overall width as a Coord.Dim().

trackTopLeft

“A Coord.Pt() that is the top left of the pane that tracks are plotted within.

mainPanePlotDepth

The depth of the plot of the main pane as a Coord.Dim().

availableWidth

The available width inside the margins.

retHeadPane()

Returns a pair of top-left Coord.Pt(), Coord.Box() for the top header where the header goes.

retLegendPane(isTop)

Returns a pair of top-left Coord.Pt(), Coord.Box() for the top or bottom legend pane where the scales go.

retMainPane()

Returns a pair of top-left Coord.Pt(), Coord.Box() for the pane where the main log goes.

retTailPane()

Returns a pair of top-left Coord.Pt(), Coord.Box() for the pane where the trailer goes.

xDepth(theX)

Returns a Coord.Dim() on the main pane that corresponds to theX as a number or an EngVal. If this is a number it is expected to be in the units of the xStart/xStop in the constructor.

polyLinePt(theX, theTracPos)

Returns a Coord.Pt from theX axis value (or EngVal) and theTracPos that is a value in DEFAULT_PLOT_UNITS, for example given by a tracValueFunction. The Coord.Pt() will be scaled by VIEW_BOX_UNITS_PER_PLOT_UNITS.

retMainPaneStart()

Returns the start Coord.Pt() for the pane where the main log goes. For and upPlot this will be pane-bottom-left, for a downPlot this will be pane-top-left.

class TotalDepth.util.plot.Plot.Plot(theFilmCfg, thePresCfg, theScale=0)

Defines a plot configuration. The basic architecture follows the data. The constructor takes all the static data, typically this can be obtained from the PRES and FILE tables. The dynamic (or user selected data) is passed in to plotLogPassLIS(). This is intended as a single Plot object might be used multiple times (e.g. on ‘scroll up’).

TITLE_FONT_FAMILY = 'Verdana'

Title font

TITLE_FONT_SIZE = 10

Title font size

LEGEND_DEPTH_PER_CURVE = Dim(value=0.5, units='in')

How much depth to give each legend (curve scale) at the top and bottom of the log

LEGEND_DEPTH_SPARE = Dim(value=0.5, units='in')

How much spare depth to give over the legend (curve scale) sections at the top and bottom of the log

LEGEND_HORIZONTAL_LINE_DEPTH_PROPORTION = 0.625

Where the curve line in the legend section appears as a proportion of LEGEND_DEPTH_PER_CURVE

LEGEND_ARROW_DISPLAY = True

Arrow heads on legend scales

LEGEND_ARROW_WIDTH = Dim(value=0.08, units='in')

Arrow head width on legend scales

LEGEND_ARROW_DEPTH = Dim(value=0.04, units='in')

Arrow head depth on legend scales

LEGEND_ARROW_WIDTH_PX = 0.75

Arrow head line width on legend scales

CURVE_LEGEND_FONT_FAMILY = 'Courier'

Legend font.

CURVE_LEGEND_FONT_SIZE = 9

Legend font family.

MICRO_MARGIN = Dim(value=0.04, units='in')

This is just a very small margin to provide a tiny bit of whitespace between elements in certain places

MAX_BACKUP_TRACK_CROSSING_LINES = 4

Maximum number of backup lines that can cross a single track in a single X step See the source of _filterCrossLineList() for an explanation.

xScale(theFilmID)

Returns the X axis scale as a number given the FILM ID.

filmIdS()

Returns an unordered list of FILM IDs.

hasDataToPlotLIS(theLogPass, theFilmId)

Returns True if a call to plotLogPassLIS() is likely to lead to some plot data being produced.

plotLogPassLIS(theLisFile, theLogPass, theXStart, theXStop, theFilmId, theFpOut, frameStep=1, title='', lrCONS=None, timerS=None)

Plot a part of a LogPass and returns a list of Channel IDs plotted.

theLisFile - The LIS File object.

theLogPass - A LogPass object, the FrameSet will be populated here.

theXStart - The start X axis position as an EngVal.

theXStop - The stop X axis position as an EngVal.

theFilmId - The ID of the output device from the film table

theFpOut - A file path for the output SVG.

frameStep - Integer number of frame steps, 1 is all frames.

title - A string for the title that will appear in LEGEND_DEPTH_SPARE

lrCONS - A CONS Logical Record that will be used to plot an API header in SVG.

timerS - Optional ExecTimer.ExecTimerList for performance measurement.

TODO: If title is empty do not use the space self.LEGEND_DEPTH_SPARE

hasDataToPlotLAS(theLasFile, theFilmId)

Returns True if a call to plotLogPassLIS() is likely to lead to some plot data being produced.

plotLogPassLAS(theLasFile, theXStart, theXStop, theFilmId, theFpOut, frameStep=1, title='', plotHeader=False, timerS=None)

Plot a part of a LogPass and returns a list of Channel IDs plotted.

theLisFile - The LIS File object.

theLogPass - A LogPass object, the FrameSet will be populated here.

theXStart - The start X axis position as an EngVal.

theXStop - The stop X axis position as an EngVal.

theFilmId - The ID of the output device from the film table

theFpOut - A file path for the output SVG.

frameStep - Integer number of frame steps, 1 is all frames.

title - A string for the title that will appear in LEGEND_DEPTH_SPARE

lrCONS - A CONS Logical Record that will be used to plot an API header in SVG.

timerS - Optional ExecTimer.ExecTimerList for performance measurement.

TODO: If title is empty do not use the space self.LEGEND_DEPTH_SPARE

class TotalDepth.util.plot.Plot.PlotReadLIS(lrFILM, lrPRES, lrAREA=None, lrPIP=None, theScale=0)

A subclass of Plot that is configured from FILM, PRES and (optionally) AREA, PIP Logical Records.

class TotalDepth.util.plot.Plot.PlotReadXML(uniqueId, theScale=0)

A subclass of Plot that is configured from XML file(s) using LgFormat.

Table Of Contents

Previous topic

Plotting Well Log API headers

Next topic

A Bag Full of TODO’s

This Page