Lithology

This WellLog – Lithology tutorial covers creating well log lithologies. A lithology is a graphical representation of a type of rock. A lithology is created with a left and right curve to define its boundaries, an array of fillstyles to fill its space and an array of depths that define the dividing lines between the different lithologies in the well log.

Lithologies are very similar to fills. See the WellLog Curve Fill tutorial.

# Create Lithology

This tutorial demonstrates a simple way of adding lithology between 3 depth ranges.

import { Plot } from "@int/geotoolkit/plot/Plot.ts";
import { BorderMode, LineType, LogLithology } from "@int/geotoolkit/welllog/LogLithology.ts";
import { TrackType } from "@int/geotoolkit/welllog/TrackType.ts";
import { HeaderType } from "@int/geotoolkit/welllog/header/LogAxisVisualHeader.ts";
import { PatternFactory } from "@int/geotoolkit/attributes/PatternFactory.ts";
import { from } from "@int/geotoolkit/selection/from.ts";
import { loadResources } from "/src/helpers/resources.ts";
import { createWellLogWidget } from "/src/code/WellLog/utils/common.ts";
loadResources("patterns");
function getLithologyBorderMode(plot) {
  const lithology = from(plot.getRoot()).where((node) => node instanceof LogLithology).selectFirst();
  return lithology != null ? lithology.getBorderMode() : BorderMode.Middle;
}
function setLithologyBorderMode(plot, mode) {
  const lithologies = from(plot.getRoot()).where((node) => node instanceof LogLithology).selectToArray();
  lithologies.forEach((lithology) => {
    lithology.setBorderMode(mode);
  });
}
function createScene(canvas) {
  const widget = createWellLogWidget().setAxisHeaderType(HeaderType.Simple).setDepthLimits(100, 400);
  widget.addTrack(TrackType.IndexTrack);
  const patternFactory = PatternFactory.getInstance();
  const lithology = new LogLithology({
    "depths": [128, 200, 280, 320],
    "titles": ["chert", "shale", "lime"],
    "bordermode": BorderMode.Inside,
    "linetypes": [
      LineType.CONTINUE,
      LineType.CONTINUE,
      LineType.DISCONTINUE,
      LineType.CONTINUE
    ],
    "linestyles": [
      { "color": "rgb(0, 142, 0)", "width": 3 },
      { "color": "rgb(102, 102, 102)", "width": 3 },
      { "color": "rgb(204, 102, 0)", "width": 3 }
    ],
    "fillstyles": [{
      "color": "#7cb342",
      "pattern": patternFactory.getPattern("chert"),
      "foreground": "#dcedc8"
    }, {
      "color": "#bdbdbd",
      "pattern": patternFactory.getPattern("shale")
    }, {
      "color": "#fdd835",
      "pattern": patternFactory.getPattern("lime")
    }]
  });
  widget.addTrack(TrackType.LinearTrack).addChild(lithology);
  widget.addTrack(TrackType.IndexTrack);
  return new Plot({
    "canvaselement": canvas,
    "root": widget
  });
}
export { createScene, getLithologyBorderMode, setLithologyBorderMode };

createScene(document.querySelector('[ref="plot"]'));

# Fill Options

Optionally, WellLog lithology can be filled between two log curves in the track as shown below.

import { Plot } from "@int/geotoolkit/plot/Plot.ts";
import { LogCurve } from "@int/geotoolkit/welllog/LogCurve.ts";
import { LogData } from "@int/geotoolkit/welllog/data/LogData.ts";
import { LogLithology } from "@int/geotoolkit/welllog/LogLithology.ts";
import { TrackType } from "@int/geotoolkit/welllog/TrackType.ts";
import { HeaderType } from "@int/geotoolkit/welllog/header/LogAxisVisualHeader.ts";
import { PatternFactory } from "@int/geotoolkit/attributes/PatternFactory.ts";
import { loadResources } from "/src/helpers/resources.ts";
import { createWellLogWidget } from "/src/code/WellLog/utils/common.ts";
loadResources("patterns");
function createCurve(data) {
  return new LogCurve(data).setNormalizationLimits(0, 100).setLineStyle({
    "color": "#212121",
    "width": 2
  });
}
function createScene(canvas) {
  const widget = createWellLogWidget().setAxisHeaderType(HeaderType.Simple).setDepthLimits(100, 400);
  widget.addTrack(TrackType.IndexTrack);
  const minDepth = 100, maxDepth = 400;
  const vals = [5, 5, 15, 25, 20, 25, 10, 5, 10, 5, 10, 15, 20, 10, 10, 25, 25, 10, 5, 5];
  const depths = vals.map((v, i) => minDepth + i * (maxDepth - minDepth) / (vals.length - 1));
  const data1 = new LogData({
    "name": "CALI",
    "depths": depths,
    "values": vals.map((v) => 40 - v)
  });
  const curve1 = createCurve(data1);
  const data2 = new LogData({
    "name": "CALI",
    "depths": depths,
    "values": vals.map((v) => 60 + v)
  });
  const curve2 = createCurve(data2);
  const patternFactory = PatternFactory.getInstance();
  const lithology = new LogLithology({
    "depths": [128, 200, 280, 320],
    "left": curve1,
    "right": curve2,
    "names": ["chert", "shale", "lime"],
    "linestyles": [
      { "color": "rgb(0, 142, 0)", "width": 3 },
      { "color": "rgb(102, 102, 102)", "width": 3 },
      { "color": "rgb(204, 102, 0)", "width": 3 }
    ],
    "fillstyles": [{
      "color": "#7cb342",
      "pattern": patternFactory.getPattern("chert"),
      "foreground": "#dcedc8"
    }, {
      "color": "#bdbdbd",
      "pattern": patternFactory.getPattern("shale")
    }, {
      "color": "#fdd835",
      "pattern": patternFactory.getPattern("lime")
    }]
  });
  widget.addTrack(TrackType.LinearTrack).addChild([curve1, curve2, lithology]);
  widget.addTrack(TrackType.IndexTrack);
  return new Plot({
    "canvaselement": canvas,
    "root": widget
  });
}
export { createScene };

createScene(document.querySelector('[ref="plot"]'));

# Text Backing Mode

Text backing modes enables managing the visibility of the text (labeling) displayed within the lithology by setting the label fill mode.

import { Plot } from "@int/geotoolkit/plot/Plot.ts";
import { LabelFillMode, LogLithology } from "@int/geotoolkit/welllog/LogLithology.ts";
import { TrackType } from "@int/geotoolkit/welllog/TrackType.ts";
import { HeaderType } from "@int/geotoolkit/welllog/header/LogAxisVisualHeader.ts";
import { PatternFactory } from "@int/geotoolkit/attributes/PatternFactory.ts";
import { loadResources } from "/src/helpers/resources.ts";
import { createWellLogWidget } from "/src/code/WellLog/utils/common.ts";
loadResources("patterns");
function createScene(canvas) {
  const widget = createWellLogWidget().setAxisHeaderType(HeaderType.Simple).setDepthLimits(100, 400);
  widget.addTrack(TrackType.IndexTrack);
  const patternFactory = PatternFactory.getInstance();
  const fillstyles = [{
    "color": "#7cb342",
    "pattern": patternFactory.getPattern("chert"),
    "foreground": "#dcedc8"
  }, {
    "color": "#bdbdbd",
    "pattern": patternFactory.getPattern("shale")
  }, {
    "color": "#fdd835",
    "pattern": patternFactory.getPattern("lime")
  }];
  widget.addTrack(TrackType.LinearTrack).addChild([
    new LogLithology({
      "depths": [128, 200, 280, 320],
      "names": ["chert", "shale", "lime"],
      "fillstyles": fillstyles,
      "labelfillmode": LabelFillMode.SINGLECOLOR
    })
  ]);
  widget.addTrack(TrackType.LinearTrack).addChild([
    new LogLithology({
      "depths": [128, 200, 280, 320],
      "names": ["chert", "shale", "lime"],
      "fillstyles": fillstyles,
      "labelfillmode": LabelFillMode.FILLSTYLE
    })
  ]);
  widget.addTrack(TrackType.LinearTrack).addChild([
    new LogLithology({
      "depths": [128, 200, 280, 320],
      "names": ["chert", "shale", "lime"],
      "fillstyles": fillstyles,
      "labelfillmode": LabelFillMode.NONE
    })
  ]);
  widget.addTrack(TrackType.IndexTrack);
  const plot = new Plot({
    "canvaselement": canvas,
    "root": widget
  });
  widget.setHeaderHeight("auto").fitToWidth().fitToHeight();
  return plot;
}
export { createScene };

createScene(document.querySelector('[ref="plot"]'));

# Text Styles

Each text style can be adjusted so it has different color, size, font and other. If the number of provided styles is less than the labels, they are reapplied from the beginning of the list. To apply the same style to all labels, use the standard textstyle parameter.

import { Plot } from "@int/geotoolkit/plot/Plot.ts";
import { LabelFillMode, LogLithology } from "@int/geotoolkit/welllog/LogLithology.ts";
import { TrackType } from "@int/geotoolkit/welllog/TrackType.ts";
import { HeaderType } from "@int/geotoolkit/welllog/header/LogAxisVisualHeader.ts";
import { PatternFactory } from "@int/geotoolkit/attributes/PatternFactory.ts";
import { BaseLineStyle } from "@int/geotoolkit/attributes/TextStyle.ts";
import { loadResources } from "/src/helpers/resources.ts";
import { createWellLogWidget } from "/src/code/WellLog/utils/common.ts";
loadResources("patterns");
function createScene(canvas) {
  const widget = createWellLogWidget().setAxisHeaderType(HeaderType.Simple).setDepthLimits(100, 400);
  widget.addTrack(TrackType.IndexTrack);
  const fillstyles = [{
    "color": "#7cb342",
    "pattern": PatternFactory.getInstance().getPattern("chert"),
    "foreground": "#dcedc8"
  }, {
    "color": "#bdbdbd",
    "pattern": PatternFactory.getInstance().getPattern("shale")
  }, {
    "color": "#fdd835",
    "pattern": PatternFactory.getInstance().getPattern("lime")
  }];
  widget.addTrack(TrackType.LinearTrack).addChild([
    new LogLithology({
      "depths": [128, 200, 280, 320],
      "names": ["chert", "shale", "lime"],
      "fillstyles": fillstyles,
      "labelfillmode": LabelFillMode.SINGLECOLOR
    })
  ]);
  widget.addTrack(TrackType.LinearTrack).addChild([
    new LogLithology({
      "depths": [128, 200, 280, 320],
      "names": ["chert", "shale", "lime"],
      "fillstyles": fillstyles,
      "textstyle": {
        "color": "red",
        "baseline": BaseLineStyle.Alphabetic
      },
      "labelfillmode": LabelFillMode.SINGLECOLOR
    })
  ]);
  widget.addTrack(TrackType.LinearTrack).addChild([
    new LogLithology({
      "depths": [128, 200, 280, 320],
      "names": ["chert", "shale", "lime"],
      "fillstyles": fillstyles,
      "textstyles": [{
        "color": "#003366",
        "font": "16px Garamond",
        "baseline": BaseLineStyle.Alphabetic
      }, {
        "color": "#4A5E58",
        "font": "16px Georgia",
        "baseline": BaseLineStyle.Alphabetic
      }, {
        "color": "#404040",
        "font": '16px "Lucida Handwriting"',
        "baseline": BaseLineStyle.Alphabetic
      }],
      "labelfillmode": LabelFillMode.SINGLECOLOR
    })
  ]);
  widget.addTrack(TrackType.IndexTrack);
  const plot = new Plot({
    "canvaselement": canvas,
    "root": widget
  });
  widget.setHeaderHeight("auto").fitToWidth().fitToHeight();
  return plot;
}
export { createScene };

createScene(document.querySelector('[ref="plot"]'));

# Name Orientation

Name Orientation options enable managing the orientation of the text (labeling) within the lithology. If the option Auto is specified, then the text will be rotated automatically to fit if it cannot fit the width and the height is bigger than the width. Other options are Regular and Rotated.

import { Plot } from "@int/geotoolkit/plot/Plot.ts";
import { LabelFillMode, LineType, LogLithology, NameOrientation } from "@int/geotoolkit/welllog/LogLithology.ts";
import { TrackType } from "@int/geotoolkit/welllog/TrackType.ts";
import { HeaderType } from "@int/geotoolkit/welllog/header/LogAxisVisualHeader.ts";
import { loadResources } from "/src/helpers/resources.ts";
import { createWellLogWidget } from "/src/code/WellLog/utils/common.ts";
loadResources("patterns");
function createScene(canvas) {
  const widget = createWellLogWidget().setAxisHeaderType(HeaderType.Simple).setDepthLimits(100, 400);
  widget.addTrack(TrackType.IndexTrack);
  const depths = [128, 200, 280, 320];
  const names = ["Short", "Medium Name", "Very long Lithology Name"];
  const lineTypes = [LineType.DISCONTINUE, LineType.CONTINUE, LineType.DISCONTINUE, LineType.DISCONTINUE];
  const fillstyles = ["#7cb342", "#bdbdbd", "#fdd835"];
  widget.addTrack(TrackType.LinearTrack).addChild([
    new LogLithology({
      "depths": depths,
      "fillstyles": fillstyles,
      "linetypes": lineTypes,
      "names": names,
      "nameorientation": NameOrientation.Regular,
      "labelfillmode": LabelFillMode.NONE
    })
  ]);
  widget.addTrack(TrackType.LinearTrack).addChild([
    new LogLithology({
      "depths": depths,
      "fillstyles": fillstyles,
      "linetypes": lineTypes,
      "names": names,
      "nameorientation": NameOrientation.Rotated,
      "labelfillmode": LabelFillMode.NONE
    })
  ]);
  widget.addTrack(TrackType.LinearTrack).setWidth(60).addChild([
    new LogLithology({
      "depths": depths,
      "fillstyles": fillstyles,
      "linetypes": lineTypes,
      "names": names,
      "nameorientation": NameOrientation.Auto,
      "labelfillmode": LabelFillMode.NONE
    })
  ]);
  widget.addTrack(TrackType.IndexTrack);
  const plot = new Plot({
    "canvaselement": canvas,
    "root": widget
  });
  widget.setHeaderHeight("auto").fitToWidth().fitToHeight();
  return plot;
}
export { createScene };

createScene(document.querySelector('[ref="plot"]'));