The SeismicWidget and the SeismicViewWidget display the "TraceNumber" as the default x-axis. This tutorial demonstrates how to customize this axis to display other seismic trace headers.
# Display Seismic Trace Headers in Axis
This example shows how to create a seismic MemoryReader which has two trace headers, XLINE and INLINE. The example then shows how to create a Seismic pipeline with this reader and add the pipline to the Seismic widget.
The next steps are to set the visibility of the desired trace headers to 'true' and add the Seismic widget to the canvas.
import { SeismicViewWidget } from "@int/geotoolkit/seismic/widgets/SeismicViewWidget.ts";
import { SeismicColors } from "@int/geotoolkit/seismic/util/SeismicColors.ts";
import { SeismicPipeline } from "@int/geotoolkit/seismic/pipeline/SeismicPipeline.ts";
import { FieldDesc } from "@int/geotoolkit/seismic/data/FieldDesc.ts";
import { MemoryReader } from "@int/geotoolkit/seismic/data/MemoryReader.ts";
import { Plot } from "@int/geotoolkit/plot/Plot.ts";
const createSeismicReader = function() {
const sampleRate = 1;
const sampleCount = 350;
const traceCount = 500;
const reader = new MemoryReader({
"numberoftraces": traceCount,
"numberofsamples": sampleCount,
"samplerate": sampleRate
}).setTraceProcessor({
"getTraceData": function(reader2, trace, traceId) {
const thickness = 30;
const start = 80;
for (let i = start; i < start + thickness; i++) {
trace[i + Math.round(thickness * Math.cos(traceId / 64))] = Math.cos(i / 2);
}
},
"getDataStatistics": function() {
return {
"average": 0,
"min": -1,
"max": 1,
"rms": Math.sqrt(2) / 2
};
},
"getTraceHeaderFields": function() {
return [
new FieldDesc(0, "XLINE"),
new FieldDesc(1, "INLINE"),
new FieldDesc(2, "OFFSET")
];
},
"getTraceHeader": function(reader2, header, headerData, traceId) {
headerData[0] = traceId + 2085;
headerData[1] = traceId + 1085;
headerData[2] = traceId;
}
});
return reader;
};
const createPipeline = function(reader) {
const pipeline = new SeismicPipeline({
"name": "MemorySeismic",
"reader": reader,
"statistics": reader.getStatistics()
});
const colorProvider = SeismicColors.getDefault();
pipeline.setOptions({
"colors": {
"colormap": colorProvider.createNamedColorMap("RedWhiteBlue")
},
"plot": {
"type": {
"wiggle": true,
"interpolateddensity": true
},
"decimationspacing": 5
},
"traceoffset": 15.2
});
return pipeline;
};
function createWidget(pipeline) {
const widget = new SeismicViewWidget(
{
"pipeline": pipeline,
"layouttype": "inside",
"axes": {
"headers": {
"options": {
"minimumspan": 50,
"color": "gray"
},
"fields": [
{
"name": "TraceNumber",
"visible": false,
"color": "black"
},
{
"name": "XLINE",
"visible": true
},
{
"name": "INLINE",
"visible": true
},
{
"name": "OFFSET",
"title": "OFFSET (m)",
"visible": true
}
]
}
}
}
);
return widget;
}
function createScene(canvas) {
const seismicReader = createSeismicReader();
const pipeline = createPipeline(seismicReader);
const widget = createWidget(pipeline);
return new Plot({
"canvaselement": canvas,
"root": widget
});
}
export { createScene };
createScene(document.querySelector('[ref="plot"]'));