@webviz/well-log-viewer 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/SyncLogViewer.d.ts +14 -5
- package/dist/SyncLogViewer.js +47 -21
- package/dist/SyncLogViewer.js.map +1 -1
- package/dist/WellLogViewer.d.ts +5 -0
- package/dist/WellLogViewer.js +31 -20
- package/dist/WellLogViewer.js.map +1 -1
- package/dist/components/CallbackManager.d.ts +7 -3
- package/dist/components/CallbackManager.js +3 -2
- package/dist/components/CallbackManager.js.map +1 -1
- package/dist/components/DefaultSyncLogViewerLayout.js +5 -2
- package/dist/components/DefaultSyncLogViewerLayout.js.map +1 -1
- package/dist/components/LocalMenus.js +32 -111
- package/dist/components/LocalMenus.js.map +1 -1
- package/dist/components/PlotDialog.d.ts +3 -3
- package/dist/components/PlotDialog.js +12 -35
- package/dist/components/PlotDialog.js.map +1 -1
- package/dist/components/TrackDialog.js +2 -20
- package/dist/components/TrackDialog.js.map +1 -1
- package/dist/components/WellLogAxesPanel.d.ts +2 -2
- package/dist/components/WellLogAxesPanel.js +9 -45
- package/dist/components/WellLogAxesPanel.js.map +1 -1
- package/dist/components/WellLogTypes.d.ts +5 -1
- package/dist/components/WellLogView.d.ts +22 -8
- package/dist/components/WellLogView.js +34 -12
- package/dist/components/WellLogView.js.map +1 -1
- package/dist/components/WellLogViewWithScroller.d.ts +3 -0
- package/dist/utils/tracks.d.ts +4 -4
- package/dist/utils/tracks.js +198 -249
- package/dist/utils/tracks.js.map +1 -1
- package/dist/utils/well-log.d.ts +76 -0
- package/dist/utils/well-log.js +126 -0
- package/dist/utils/well-log.js.map +1 -0
- package/dist/utils/well-log.test.d.ts +1 -0
- package/dist/utils/well-log.test.js +232 -0
- package/dist/utils/well-log.test.js.map +1 -0
- package/package.json +1 -1
- package/dist/Storybook/helpers/MuiComponents.d.ts +0 -52
- package/dist/Storybook/helpers/MuiComponents.js +0 -140
- package/dist/Storybook/helpers/MuiComponents.js.map +0 -1
- package/dist/Storybook/helpers/MuiComponentsTabHelper.d.ts +0 -5
- package/dist/Storybook/helpers/MuiComponentsTabHelper.js +0 -89
- package/dist/Storybook/helpers/MuiComponentsTabHelper.js.map +0 -1
package/dist/utils/tracks.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface ExtPlotOptions extends GradientFillPlotOptions {
|
|
|
9
9
|
}
|
|
10
10
|
import type WellLogView from "../components/WellLogView";
|
|
11
11
|
import type { TemplatePlotType, TemplateTrack, TemplatePlot, TemplateStyle } from "../components/WellLogTemplateTypes";
|
|
12
|
-
import type {
|
|
12
|
+
import type { WellLogSet, WellLogMetadataDiscreteObjects } from "../components/WellLogTypes";
|
|
13
13
|
import type { ColorMapFunction } from "../components/ColorMapFunction";
|
|
14
14
|
export declare function indexOfElementByName(array: Named[], name: string): number;
|
|
15
15
|
declare class TracksInfo {
|
|
@@ -23,7 +23,7 @@ declare class TracksInfo {
|
|
|
23
23
|
type Named = {
|
|
24
24
|
name: string;
|
|
25
25
|
};
|
|
26
|
-
export declare function getAvailableAxes(
|
|
26
|
+
export declare function getAvailableAxes(wellLog: WellLogSet[], axisMnemos: Record<string, string[]>): string[];
|
|
27
27
|
import type { Plot } from "@equinor/videx-wellog";
|
|
28
28
|
export declare function getPlotType(plot: Plot): TemplatePlotType;
|
|
29
29
|
export declare function addOrEditGraphTrackPlot(wellLogView: WellLogView, track: GraphTrack, plot: Plot | null, templatePlot: TemplatePlot): void;
|
|
@@ -37,7 +37,7 @@ export declare function getDiscreteColorAndName(value: number | string | null, c
|
|
|
37
37
|
color: number[];
|
|
38
38
|
name: string;
|
|
39
39
|
};
|
|
40
|
-
export declare function getDiscreteMeta(
|
|
40
|
+
export declare function getDiscreteMeta(wellLogSet: WellLogSet, name: string): DiscreteMeta | null;
|
|
41
41
|
export interface TrackOptionsEx extends TrackOptions {
|
|
42
42
|
__template: TemplateTrack;
|
|
43
43
|
}
|
|
@@ -51,7 +51,7 @@ export interface AxesInfo {
|
|
|
51
51
|
titles: Record<string, string>;
|
|
52
52
|
mnemos: Record<string, string[]>;
|
|
53
53
|
}
|
|
54
|
-
export declare function createTracks(
|
|
54
|
+
export declare function createTracks(wellLog: WellLogSet[], axes: AxesInfo, templateTracks: TemplateTrack[], // Part of JSON
|
|
55
55
|
templateStyles: TemplateStyle[] | undefined, // Part of JSON
|
|
56
56
|
colorMapFunctions: ColorMapFunction[]): TracksInfo;
|
|
57
57
|
export declare function addOrEditGraphTrack(wellLogView: WellLogView, track: GraphTrack | null, templateTrack: TemplateTrack, trackCurrent: Track, bAfter: boolean): GraphTrack;
|
package/dist/utils/tracks.js
CHANGED
|
@@ -17,6 +17,9 @@ import { createScale } from "./graph/factory";
|
|
|
17
17
|
import { checkMinMaxValue, checkMinMax, roundMinMax, roundLogMinMax, } from "./minmax";
|
|
18
18
|
import { updateLegendRows } from "./log-viewer";
|
|
19
19
|
import { deepCopy } from "./deepcopy";
|
|
20
|
+
import { createPlotType } from "@equinor/videx-wellog";
|
|
21
|
+
import { defaultPlotFactory } from "@equinor/videx-wellog";
|
|
22
|
+
import { getAxisIndices, getDiscreteMetaDataByName, getAllWellLogCurves, findSetAndCurveIndex, } from "./well-log";
|
|
20
23
|
export function indexOfElementByName(array, name) {
|
|
21
24
|
if (array && name) {
|
|
22
25
|
const nameUpper = name.toUpperCase();
|
|
@@ -42,15 +45,6 @@ function indexOfElementByNames(array, names) {
|
|
|
42
45
|
}
|
|
43
46
|
return -1;
|
|
44
47
|
}
|
|
45
|
-
function elementByKeyName(meta, name) {
|
|
46
|
-
name = name.toUpperCase();
|
|
47
|
-
for (const key in meta) {
|
|
48
|
-
if (key.toUpperCase() === name)
|
|
49
|
-
// search case insensitive!
|
|
50
|
-
return meta[key];
|
|
51
|
-
}
|
|
52
|
-
return null;
|
|
53
|
-
}
|
|
54
48
|
const __colors = [
|
|
55
49
|
"red",
|
|
56
50
|
"blue",
|
|
@@ -113,12 +107,11 @@ function shortDescription(description) {
|
|
|
113
107
|
}
|
|
114
108
|
return description;
|
|
115
109
|
}
|
|
116
|
-
function makeTrackHeader(
|
|
110
|
+
function makeTrackHeader(curves, templateTrack) {
|
|
117
111
|
if (templateTrack.title)
|
|
118
112
|
return templateTrack.title;
|
|
119
113
|
const templatePlots = templateTrack.plots;
|
|
120
114
|
if (templatePlots && templatePlots[0]) {
|
|
121
|
-
const curves = welllog.curves;
|
|
122
115
|
// get the first curve name
|
|
123
116
|
const templatePlot = templatePlots[0];
|
|
124
117
|
const iCurve = indexOfElementByName(curves, templatePlot.name);
|
|
@@ -147,15 +140,13 @@ class TracksInfo {
|
|
|
147
140
|
this.secondaries = new Float32Array(0);
|
|
148
141
|
}
|
|
149
142
|
}
|
|
150
|
-
export function getAvailableAxes(
|
|
143
|
+
export function getAvailableAxes(wellLog, axisMnemos) {
|
|
151
144
|
const result = [];
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
result.push(key);
|
|
158
|
-
}
|
|
145
|
+
const curves = getAllWellLogCurves(wellLog);
|
|
146
|
+
for (const key in axisMnemos) {
|
|
147
|
+
const i = indexOfElementByNames(curves, axisMnemos[key]);
|
|
148
|
+
if (i >= 0)
|
|
149
|
+
result.push(key);
|
|
159
150
|
}
|
|
160
151
|
return result;
|
|
161
152
|
}
|
|
@@ -230,6 +221,19 @@ function getTemplatePlotProps(templatePlot, templateStyles) {
|
|
|
230
221
|
}
|
|
231
222
|
return options;
|
|
232
223
|
}
|
|
224
|
+
function isStackedTrack(templateTrack, templateStyles) {
|
|
225
|
+
var _a, _b;
|
|
226
|
+
// Stacked tracks only render the first plot, so we only care about the first
|
|
227
|
+
const firstTrackPlot = (_a = templateTrack.plots[0]) !== null && _a !== void 0 ? _a : {};
|
|
228
|
+
if (firstTrackPlot.type === "stacked")
|
|
229
|
+
return true;
|
|
230
|
+
if (!firstTrackPlot.style || !templateStyles)
|
|
231
|
+
return false;
|
|
232
|
+
const iStyle = indexOfElementByName(templateStyles, firstTrackPlot.style);
|
|
233
|
+
if (iStyle < 0)
|
|
234
|
+
return false;
|
|
235
|
+
return ((_b = templateStyles[iStyle]) === null || _b === void 0 ? void 0 : _b.type) === "stacked";
|
|
236
|
+
}
|
|
233
237
|
class __dataAccessor {
|
|
234
238
|
constructor(iData) {
|
|
235
239
|
this.iData = iData;
|
|
@@ -414,9 +418,7 @@ function updateStackedTrackScale(track) {
|
|
|
414
418
|
//}
|
|
415
419
|
//if (!track.options.scale) throw Error("Invalid track.options.scale!");
|
|
416
420
|
//track.trackScale = createScale(track.options.scale, track.options.domain);
|
|
417
|
-
//
|
|
418
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
419
|
-
track.xscale;
|
|
421
|
+
// track.xscale;
|
|
420
422
|
}
|
|
421
423
|
function addGraphTrackPlot(wellLogView, track, templatePlot) {
|
|
422
424
|
const templateTrack = getTrackTemplate(track);
|
|
@@ -426,53 +428,24 @@ function addGraphTrackPlot(wellLogView, track, templatePlot) {
|
|
|
426
428
|
];
|
|
427
429
|
const axes = wellLogView.getAxesInfo();
|
|
428
430
|
const plotFactory = track.options.plotFactory;
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
const dimensions = curve.dimensions === undefined ? 1 : curve.dimensions;
|
|
441
|
-
if (dimensions !== 1)
|
|
442
|
-
console.log("curve.dimensions !== 1");
|
|
443
|
-
if (curve.valueType === "string")
|
|
444
|
-
console.log('curve.valueType === "string"');
|
|
445
|
-
const plotData = preparePlotData(data, iCurve, iPrimaryAxis);
|
|
446
|
-
checkMinMax(minmaxPrimaryAxis, plotData.minmaxPrimaryAxis);
|
|
447
|
-
const minmax = [
|
|
448
|
-
plotData.minmax[0],
|
|
449
|
-
plotData.minmax[1],
|
|
450
|
-
];
|
|
451
|
-
const plotDatas = track.options.data;
|
|
452
|
-
const plots = track.plots;
|
|
453
|
-
const colorMapFunctions = wellLogView.props.colorMapFunctions;
|
|
454
|
-
let iCurve2 = -1;
|
|
455
|
-
let curve2 = undefined;
|
|
456
|
-
let plotData2 = undefined;
|
|
457
|
-
if (templatePlot.type === "differential") {
|
|
458
|
-
iCurve2 = templatePlot.name2
|
|
459
|
-
? indexOfElementByName(curves, templatePlot.name2)
|
|
460
|
-
: -1;
|
|
461
|
-
curve2 = iCurve2 >= 0 ? curves[iCurve2] : undefined;
|
|
462
|
-
plotData2 = preparePlotData(data, iCurve2, iPrimaryAxis);
|
|
463
|
-
if (!curve2)
|
|
464
|
-
console.error("templatePlot.name2 '" + templatePlot.name2 + "' not found");
|
|
465
|
-
checkMinMax(minmaxPrimaryAxis, plotData2.minmaxPrimaryAxis);
|
|
466
|
-
checkMinMax(minmax, plotData2.minmax);
|
|
467
|
-
}
|
|
431
|
+
const wellLog = wellLogView.wellLogSets;
|
|
432
|
+
const colorMapFunctions = wellLogView.props.colorMapFunctions;
|
|
433
|
+
const plotDatas = track.options.data;
|
|
434
|
+
const plots = track.plots;
|
|
435
|
+
if (plotFactory && wellLog.length) {
|
|
436
|
+
const plotSetup = setupPlot(wellLog, templatePlot.name, axes);
|
|
437
|
+
if (!plotSetup)
|
|
438
|
+
return minmaxPrimaryAxis;
|
|
439
|
+
const { plotData, curve, iCurve, minmax, iSet } = plotSetup;
|
|
440
|
+
const plotSetup2 = maybeSetupPlot2(wellLog, templatePlot, axes);
|
|
441
|
+
checkSetupMinMax(plotSetup, plotSetup2, minmaxPrimaryAxis);
|
|
468
442
|
// Make full props
|
|
469
443
|
const templatePlotProps = getTemplatePlotProps(templatePlot,
|
|
470
444
|
/*templateStyles*/ []);
|
|
471
|
-
const p = getPlotConfig(iCurve
|
|
445
|
+
const p = getPlotConfig(`${iSet}-${iCurve}`, templatePlotProps, templateTrack.scale, minmax, curve, plotDatas.length, plotSetup2 === null || plotSetup2 === void 0 ? void 0 : plotSetup2.curve, plotDatas.length + 1, colorMapFunctions);
|
|
472
446
|
plotDatas.push(plotData.data);
|
|
473
|
-
if (
|
|
474
|
-
plotDatas.push(
|
|
475
|
-
}
|
|
447
|
+
if (plotSetup2)
|
|
448
|
+
plotDatas.push(plotSetup2.plotData.data);
|
|
476
449
|
// GraphTrack
|
|
477
450
|
const createPlot = plotFactory[p.type];
|
|
478
451
|
if (!createPlot)
|
|
@@ -495,53 +468,24 @@ function editGraphTrackPlot(wellLogView, track, plot, templatePlot) {
|
|
|
495
468
|
];
|
|
496
469
|
const axes = wellLogView.getAxesInfo();
|
|
497
470
|
const plotFactory = track.options.plotFactory;
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
const
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
const iCurve =
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
const curve = curves[iCurve];
|
|
509
|
-
const dimensions = curve.dimensions === undefined ? 1 : curve.dimensions;
|
|
510
|
-
if (dimensions !== 1)
|
|
511
|
-
console.log("curve.dimensions !== 1");
|
|
512
|
-
if (curve.valueType === "string")
|
|
513
|
-
console.log('curve.valueType === "string"');
|
|
514
|
-
const plotData = preparePlotData(data, iCurve, iPrimaryAxis);
|
|
515
|
-
checkMinMax(minmaxPrimaryAxis, plotData.minmaxPrimaryAxis);
|
|
516
|
-
const minmax = [
|
|
517
|
-
plotData.minmax[0],
|
|
518
|
-
plotData.minmax[1],
|
|
519
|
-
];
|
|
520
|
-
const plotDatas = track.options.data;
|
|
521
|
-
const plots = track.plots;
|
|
471
|
+
const wellLog = wellLogView.wellLogSets;
|
|
472
|
+
const plotDatas = track.options.data;
|
|
473
|
+
const plots = track.plots;
|
|
474
|
+
if (plotFactory && wellLog.length) {
|
|
475
|
+
const plotSetup = setupPlot(wellLog, templatePlot.name, axes);
|
|
476
|
+
if (!plotSetup)
|
|
477
|
+
return minmaxPrimaryAxis;
|
|
478
|
+
const { plotData, curve, iCurve, iSet, minmax } = plotSetup;
|
|
479
|
+
const plotSetup2 = maybeSetupPlot2(wellLog, templatePlot, axes);
|
|
480
|
+
checkSetupMinMax(plotSetup, plotSetup2, minmaxPrimaryAxis);
|
|
522
481
|
const colorMapFunctions = wellLogView.props.colorMapFunctions;
|
|
523
|
-
let iCurve2 = -1;
|
|
524
|
-
let curve2 = undefined;
|
|
525
|
-
let plotData2 = undefined;
|
|
526
|
-
if (templatePlot.type === "differential") {
|
|
527
|
-
iCurve2 = templatePlot.name2
|
|
528
|
-
? indexOfElementByName(curves, templatePlot.name2)
|
|
529
|
-
: -1;
|
|
530
|
-
curve2 = iCurve2 >= 0 ? curves[iCurve2] : undefined;
|
|
531
|
-
if (!curve2)
|
|
532
|
-
console.error("templatePlot.name2 '" + templatePlot.name2 + "' not found");
|
|
533
|
-
plotData2 = preparePlotData(data, iCurve2, iPrimaryAxis);
|
|
534
|
-
checkMinMax(minmaxPrimaryAxis, plotData2.minmaxPrimaryAxis);
|
|
535
|
-
checkMinMax(minmax, plotData2.minmax);
|
|
536
|
-
}
|
|
537
482
|
// Make full props
|
|
538
483
|
const templatePlotProps = getTemplatePlotProps(templatePlot,
|
|
539
484
|
/*templateStyles*/ []);
|
|
540
|
-
const p = getPlotConfig(iCurve
|
|
485
|
+
const p = getPlotConfig(`${iSet}-${iCurve}`, templatePlotProps, templateTrack.scale, minmax, curve, plotDatas.length, plotSetup2 === null || plotSetup2 === void 0 ? void 0 : plotSetup2.curve, plotDatas.length + 1, colorMapFunctions);
|
|
541
486
|
plotDatas.push(plotData.data);
|
|
542
|
-
if (
|
|
543
|
-
plotDatas.push(
|
|
544
|
-
}
|
|
487
|
+
if (plotSetup2)
|
|
488
|
+
plotDatas.push(plotSetup2.plotData.data);
|
|
545
489
|
// GraphTrack
|
|
546
490
|
const createPlot = plotFactory[p.type];
|
|
547
491
|
if (!createPlot)
|
|
@@ -765,32 +709,25 @@ function createStackData(data, colorMapFunction, meta) {
|
|
|
765
709
|
function newStackedTrack(options) {
|
|
766
710
|
return new StackedTrack(undefined, options);
|
|
767
711
|
}
|
|
768
|
-
export function getDiscreteMeta(
|
|
769
|
-
const
|
|
770
|
-
if (
|
|
771
|
-
//
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
iCode: iCode,
|
|
784
|
-
iColor: iColor,
|
|
785
|
-
objects: table.objects, // [attr1,attr2] ,
|
|
786
|
-
};
|
|
787
|
-
}
|
|
712
|
+
export function getDiscreteMeta(wellLogSet, name) {
|
|
713
|
+
const metadataTable = getDiscreteMetaDataByName(wellLogSet, name);
|
|
714
|
+
if (metadataTable) {
|
|
715
|
+
// there is a metadata for given log name
|
|
716
|
+
const attributes = metadataTable.attributes; // ["color", "code"]
|
|
717
|
+
if (attributes) {
|
|
718
|
+
const iCode = attributes.indexOf("code");
|
|
719
|
+
const iColor = attributes.indexOf("color");
|
|
720
|
+
if (iColor >= 0 && iCode >= 0)
|
|
721
|
+
// all values are OK
|
|
722
|
+
return {
|
|
723
|
+
iCode: iCode,
|
|
724
|
+
iColor: iColor,
|
|
725
|
+
objects: metadataTable.objects, // [attr1,attr2] ,
|
|
726
|
+
};
|
|
788
727
|
}
|
|
789
728
|
}
|
|
790
729
|
return null; // something went wrong
|
|
791
730
|
}
|
|
792
|
-
import { createPlotType } from "@equinor/videx-wellog";
|
|
793
|
-
import { defaultPlotFactory } from "@equinor/videx-wellog";
|
|
794
731
|
const plotFactory = Object.assign(Object.assign({}, defaultPlotFactory), { gradientfill: createPlotType(GradientFillPlot) });
|
|
795
732
|
const defaultOptions = {
|
|
796
733
|
plotFactory: plotFactory,
|
|
@@ -835,92 +772,123 @@ export function getScaleTrackNum(tracks) {
|
|
|
835
772
|
}
|
|
836
773
|
return n;
|
|
837
774
|
}
|
|
838
|
-
function
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
const
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
if (
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
info
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
775
|
+
function getAxisTitle(axes, axisName) {
|
|
776
|
+
return axes.titles ? axes.titles[axisName] : axisName;
|
|
777
|
+
}
|
|
778
|
+
function addScaleTracks(info, axesInfo, wellLog) {
|
|
779
|
+
// All sets is assumed to include the main axis curve, so we just look at the first curve well log set here
|
|
780
|
+
const data = wellLog[0].data;
|
|
781
|
+
const curves = wellLog[0].curves;
|
|
782
|
+
const axisIndices = getAxisIndices(curves, axesInfo);
|
|
783
|
+
if (axisIndices.primary < 0)
|
|
784
|
+
return; // Axis curves are missing
|
|
785
|
+
const idxPrimary = axisIndices.primary;
|
|
786
|
+
const titlePrimary = getAxisTitle(axesInfo, axesInfo.primaryAxis);
|
|
787
|
+
const curvePrimary = curves[idxPrimary];
|
|
788
|
+
if (axisIndices.secondary >= 0) {
|
|
789
|
+
addDualScaleTrack(info, axesInfo, curves, data, axisIndices);
|
|
790
|
+
}
|
|
791
|
+
else {
|
|
792
|
+
info.tracks.push(newScaleTrack(titlePrimary, curvePrimary.name, curvePrimary.unit));
|
|
793
|
+
}
|
|
794
|
+
}
|
|
795
|
+
function addDualScaleTrack(info, axes, curves, data, axisIndices) {
|
|
796
|
+
const idxPrimary = axisIndices.primary;
|
|
797
|
+
const idxSecondary = axisIndices.secondary;
|
|
798
|
+
const titlePrimary = getAxisTitle(axes, axes.primaryAxis);
|
|
799
|
+
const titleSecondary = getAxisTitle(axes, axes.secondaryAxis);
|
|
800
|
+
const curvePrimary = curves[idxPrimary];
|
|
801
|
+
const curveSecondary = curves[idxSecondary];
|
|
802
|
+
info.tracks.push(newDualScaleTrack(0, titlePrimary, curvePrimary.name, curvePrimary.unit), newDualScaleTrack(1, titleSecondary, curveSecondary.name, curveSecondary.unit));
|
|
803
|
+
info.primaries = new Float32Array(data.length); // 32 bits should be enough
|
|
804
|
+
info.secondaries = new Float32Array(data.length);
|
|
805
|
+
{
|
|
806
|
+
let count = 0;
|
|
807
|
+
for (const row of data) {
|
|
808
|
+
const secondary = row[idxSecondary];
|
|
809
|
+
checkMinMaxValue(info.minmaxSecondaryAxis, secondary);
|
|
810
|
+
if (secondary !== null) {
|
|
811
|
+
const primary = row[idxPrimary];
|
|
812
|
+
if (primary !== null) {
|
|
813
|
+
info.secondaries[count] = secondary;
|
|
814
|
+
info.primaries[count] = primary;
|
|
815
|
+
count++;
|
|
867
816
|
}
|
|
868
817
|
}
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
818
|
+
}
|
|
819
|
+
if (count < info.primaries.length) {
|
|
820
|
+
// resize arrays to actual size used
|
|
821
|
+
info.primaries = info.primaries.subarray(0, count);
|
|
822
|
+
info.secondaries = info.secondaries.subarray(0, count);
|
|
874
823
|
}
|
|
875
824
|
}
|
|
876
|
-
|
|
877
|
-
|
|
825
|
+
}
|
|
826
|
+
function setupPlot(wellLog, plotName, axesInfo) {
|
|
827
|
+
var _a;
|
|
828
|
+
const { iCurve, iSet } = findSetAndCurveIndex(wellLog, plotName);
|
|
829
|
+
if (iCurve < 0)
|
|
830
|
+
return null;
|
|
831
|
+
const sourceLogSet = wellLog[iSet];
|
|
832
|
+
const data = sourceLogSet.data;
|
|
833
|
+
const curves = sourceLogSet.curves;
|
|
834
|
+
const curve = curves[iCurve];
|
|
835
|
+
const dimensions = (_a = curve.dimensions) !== null && _a !== void 0 ? _a : 1;
|
|
836
|
+
if (dimensions !== 1)
|
|
837
|
+
return null;
|
|
838
|
+
if (curve.valueType === "string")
|
|
839
|
+
return null;
|
|
840
|
+
const axisIndices = getAxisIndices(sourceLogSet.curves, axesInfo);
|
|
841
|
+
const plotData = preparePlotData(data, iCurve, axisIndices.primary);
|
|
842
|
+
const minmax = [plotData.minmax[0], plotData.minmax[1]];
|
|
843
|
+
return {
|
|
844
|
+
iCurve,
|
|
845
|
+
iSet,
|
|
846
|
+
sourceLogSet,
|
|
847
|
+
curve,
|
|
848
|
+
plotData,
|
|
849
|
+
minmax,
|
|
850
|
+
};
|
|
851
|
+
}
|
|
852
|
+
function maybeSetupPlot2(wellLog, templatePlot, axesInfo) {
|
|
853
|
+
if (templatePlot.type !== "differential")
|
|
854
|
+
return null;
|
|
855
|
+
else
|
|
856
|
+
return setupPlot(wellLog, templatePlot.name2, axesInfo);
|
|
857
|
+
}
|
|
858
|
+
function checkSetupMinMax(setup1, setup2, primaryAxisMinMax) {
|
|
859
|
+
checkMinMax(primaryAxisMinMax, setup1.plotData.minmaxPrimaryAxis);
|
|
860
|
+
if (setup2) {
|
|
861
|
+
checkMinMax(setup1.minmax, setup2.minmax);
|
|
862
|
+
checkMinMax(primaryAxisMinMax, setup2.plotData.minmaxPrimaryAxis);
|
|
878
863
|
}
|
|
879
864
|
}
|
|
880
|
-
function addGraphTrack(info,
|
|
865
|
+
function addGraphTrack(info, wellLog, axesInfo, templateTrack, templateStyles, colorMapFunctions) {
|
|
881
866
|
const plotDatas = [];
|
|
882
867
|
const plots = [];
|
|
868
|
+
// Saving the curves so it can be used for title generation
|
|
869
|
+
const curvesUsed = [];
|
|
883
870
|
if (templateTrack.plots)
|
|
884
871
|
for (const templatePlot of templateTrack.plots) {
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
const
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
continue;
|
|
893
|
-
if (curve.valueType === "string")
|
|
894
|
-
continue;
|
|
895
|
-
const plotData = preparePlotData(data, iCurve, iPrimaryAxis);
|
|
896
|
-
checkMinMax(info.minmaxPrimaryAxis, plotData.minmaxPrimaryAxis);
|
|
897
|
-
const minmax = [
|
|
898
|
-
plotData.minmax[0],
|
|
899
|
-
plotData.minmax[1],
|
|
900
|
-
];
|
|
901
|
-
let iCurve2 = -1;
|
|
902
|
-
let curve2 = undefined;
|
|
903
|
-
let plotData2 = undefined;
|
|
904
|
-
if (templatePlot.type === "differential") {
|
|
905
|
-
iCurve2 = templatePlot.name2
|
|
906
|
-
? indexOfElementByName(curves, templatePlot.name2)
|
|
907
|
-
: -1;
|
|
908
|
-
curve2 = iCurve2 >= 0 ? curves[iCurve2] : undefined;
|
|
909
|
-
plotData2 = preparePlotData(data, iCurve2, iPrimaryAxis);
|
|
910
|
-
checkMinMax(info.minmaxPrimaryAxis, plotData2.minmaxPrimaryAxis);
|
|
911
|
-
checkMinMax(minmax, plotData2.minmax);
|
|
912
|
-
}
|
|
872
|
+
const plotSetup = setupPlot(wellLog, templatePlot.name, axesInfo);
|
|
873
|
+
if (!plotSetup)
|
|
874
|
+
continue; // Plot couldnt be set up, skip adding this track
|
|
875
|
+
const { plotData, curve, minmax, iCurve, iSet } = plotSetup;
|
|
876
|
+
const plotSetup2 = maybeSetupPlot2(wellLog, templatePlot, axesInfo);
|
|
877
|
+
// Apply min-max index values to entire track
|
|
878
|
+
checkSetupMinMax(plotSetup, plotSetup2, info.minmaxPrimaryAxis);
|
|
913
879
|
// make full props
|
|
914
880
|
const templatePlotProps = getTemplatePlotProps(templatePlot, templateStyles);
|
|
915
|
-
const p = getPlotConfig(iCurve
|
|
881
|
+
const p = getPlotConfig(`${iSet}-${iCurve}`, templatePlotProps, templateTrack.scale, minmax, curve, plotDatas.length, plotSetup2 === null || plotSetup2 === void 0 ? void 0 : plotSetup2.curve, plotDatas.length + 1, colorMapFunctions);
|
|
882
|
+
plots.push(p);
|
|
883
|
+
curvesUsed.push(curve);
|
|
916
884
|
plotDatas.push(plotData.data);
|
|
917
|
-
if (
|
|
918
|
-
|
|
885
|
+
if (plotSetup2) {
|
|
886
|
+
curvesUsed.push(plotSetup2.curve);
|
|
887
|
+
plotDatas.push(plotSetup2.plotData.data);
|
|
919
888
|
}
|
|
920
|
-
plots.push(p);
|
|
921
889
|
}
|
|
922
890
|
if (plots.length || templateTrack.required) {
|
|
923
|
-
const label = makeTrackHeader(
|
|
891
|
+
const label = makeTrackHeader(curvesUsed, templateTrack);
|
|
924
892
|
const options = {
|
|
925
893
|
data: plotDatas,
|
|
926
894
|
plots: plots,
|
|
@@ -932,26 +900,22 @@ function addGraphTrack(info, welllog, curves, data, iPrimaryAxis, templateTrack,
|
|
|
932
900
|
info.tracks.push(track);
|
|
933
901
|
}
|
|
934
902
|
}
|
|
935
|
-
function addStackedTrack(info,
|
|
903
|
+
function addStackedTrack(info, wellLog, axesInfo, templateTrack, templateStyles, colorMapFunctions) {
|
|
904
|
+
var _a;
|
|
936
905
|
const templatePlot = templateTrack.plots[0];
|
|
937
906
|
const name = templatePlot.name;
|
|
938
|
-
const
|
|
939
|
-
if (
|
|
940
|
-
return; // curve not found
|
|
941
|
-
const curve = curves[iCurve];
|
|
942
|
-
const dimensions = curve.dimensions === undefined ? 1 : curve.dimensions;
|
|
943
|
-
if (dimensions !== 1)
|
|
907
|
+
const plotSetup = setupPlot(wellLog, name, axesInfo);
|
|
908
|
+
if (!plotSetup)
|
|
944
909
|
return;
|
|
945
|
-
const plotData
|
|
946
|
-
checkMinMax(info.minmaxPrimaryAxis, plotData.minmaxPrimaryAxis);
|
|
910
|
+
const { plotData, curve, sourceLogSet } = plotSetup;
|
|
947
911
|
// make full props
|
|
948
912
|
const templatePlotProps = getTemplatePlotProps(templatePlot, templateStyles);
|
|
949
913
|
const templateTrackFullPlot = deepCopy(templateTrack);
|
|
950
|
-
const label = makeTrackHeader(
|
|
914
|
+
const label = makeTrackHeader([curve], templateTrack);
|
|
915
|
+
const meta = getDiscreteMeta(sourceLogSet, name);
|
|
951
916
|
templateTrackFullPlot.title = label;
|
|
952
917
|
templateTrackFullPlot.plots[0].type = templatePlotProps.type;
|
|
953
918
|
// curve.valueType could be "integer", "string"
|
|
954
|
-
const meta = getDiscreteMeta(welllog, name);
|
|
955
919
|
if (!meta && curve.valueType === "integer")
|
|
956
920
|
console.log("Discrete meta information for '" +
|
|
957
921
|
name +
|
|
@@ -979,9 +943,9 @@ function addStackedTrack(info, welllog, curves, data, iPrimaryAxis, templateTrac
|
|
|
979
943
|
}
|
|
980
944
|
const plot = templateTrackFullPlot.plots[0];
|
|
981
945
|
if (plot) {
|
|
982
|
-
plot.showLabels = showLabels;
|
|
983
|
-
plot.showLines = showLines;
|
|
984
|
-
plot.labelRotation = labelRotation !== null &&
|
|
946
|
+
plot.showLabels = templatePlotProps.showLabels;
|
|
947
|
+
plot.showLines = templatePlotProps.showLines;
|
|
948
|
+
plot.labelRotation = (_a = templatePlotProps.labelRotation) !== null && _a !== void 0 ? _a : 0;
|
|
985
949
|
}
|
|
986
950
|
const options = {
|
|
987
951
|
abbr: name, // name of the only plot
|
|
@@ -991,41 +955,23 @@ function addStackedTrack(info, welllog, curves, data, iPrimaryAxis, templateTrac
|
|
|
991
955
|
setStackedTrackOptionsFromTemplate(options, templateTrackFullPlot);
|
|
992
956
|
const track = newStackedTrack(options);
|
|
993
957
|
updateStackedTrackScale(track);
|
|
958
|
+
checkMinMax(info.minmaxPrimaryAxis, plotData.minmaxPrimaryAxis);
|
|
994
959
|
info.tracks.push(track);
|
|
995
960
|
}
|
|
996
|
-
function
|
|
997
|
-
if (!templateTrack.plots)
|
|
998
|
-
return undefined;
|
|
999
|
-
const templatePlot = templateTrack.plots[0];
|
|
1000
|
-
if (!templatePlot)
|
|
1001
|
-
return undefined;
|
|
1002
|
-
const templatePlotProps = getTemplatePlotProps(templatePlot, templateStyles);
|
|
1003
|
-
return templatePlotProps;
|
|
1004
|
-
}
|
|
1005
|
-
export function createTracks(welllog, axes, templateTracks, // Part of JSON
|
|
961
|
+
export function createTracks(wellLog, axes, templateTracks, // Part of JSON
|
|
1006
962
|
templateStyles, // Part of JSON
|
|
1007
963
|
colorMapFunctions // JS code or JSON color table
|
|
1008
964
|
) {
|
|
965
|
+
if (!(wellLog === null || wellLog === void 0 ? void 0 : wellLog.length))
|
|
966
|
+
return new TracksInfo();
|
|
1009
967
|
const info = new TracksInfo();
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
// scale tracks are needed
|
|
1018
|
-
addScaleTracks(info, axes, curves, data, iPrimaryAxis);
|
|
1019
|
-
if (templateTracks) {
|
|
1020
|
-
for (const templateTrack of templateTracks) {
|
|
1021
|
-
const templatePlotProps = getTemplateTrackFirstPlotProps(templateTrack, templateStyles);
|
|
1022
|
-
if (templatePlotProps && templatePlotProps.type === "stacked") {
|
|
1023
|
-
addStackedTrack(info, welllog, curves, data, iPrimaryAxis, templateTrack, templateStyles, colorMapFunctions, templatePlotProps.showLines, templatePlotProps.showLabels, templatePlotProps.labelRotation);
|
|
1024
|
-
}
|
|
1025
|
-
else {
|
|
1026
|
-
addGraphTrack(info, welllog, curves, data, iPrimaryAxis, templateTrack, templateStyles, colorMapFunctions);
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
968
|
+
addScaleTracks(info, axes, wellLog);
|
|
969
|
+
for (const templateTrack of templateTracks) {
|
|
970
|
+
if (isStackedTrack(templateTrack, templateStyles)) {
|
|
971
|
+
addStackedTrack(info, wellLog, axes, templateTrack, templateStyles, colorMapFunctions);
|
|
972
|
+
}
|
|
973
|
+
else {
|
|
974
|
+
addGraphTrack(info, wellLog, axes, templateTrack, templateStyles, colorMapFunctions);
|
|
1029
975
|
}
|
|
1030
976
|
}
|
|
1031
977
|
return info;
|
|
@@ -1099,19 +1045,22 @@ export function addOrEditGraphTrack(wellLogView, track, templateTrack, trackCurr
|
|
|
1099
1045
|
export function addOrEditStackedTrack(wellLogView, track, templateTrack, trackCurrent, bAfter) {
|
|
1100
1046
|
var _a;
|
|
1101
1047
|
const props = wellLogView.props;
|
|
1102
|
-
const
|
|
1048
|
+
const wellLog = wellLogView.wellLogSets;
|
|
1103
1049
|
const templatePlot = templateTrack.plots[0];
|
|
1104
|
-
if (!
|
|
1050
|
+
if (!wellLog || !templatePlot)
|
|
1105
1051
|
return null;
|
|
1106
1052
|
const name = templatePlot.name;
|
|
1107
1053
|
const templateStyles = props.template.styles;
|
|
1108
1054
|
// make full props
|
|
1109
1055
|
const templatePlotProps = getTemplatePlotProps(templatePlot, templateStyles);
|
|
1110
1056
|
const colorMapFunctionName = (_a = props.colorMapFunctions) === null || _a === void 0 ? void 0 : _a.find((colorMapFunction) => colorMapFunction.name === templatePlotProps.colorMapFunctionName);
|
|
1111
|
-
const
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
const
|
|
1057
|
+
const { iCurve, iSet } = findSetAndCurveIndex(wellLog, name);
|
|
1058
|
+
if (iCurve < 0)
|
|
1059
|
+
return null; // curve not found
|
|
1060
|
+
const sourceLogSet = wellLog[iSet];
|
|
1061
|
+
const meta = getDiscreteMeta(sourceLogSet, name);
|
|
1062
|
+
const data = sourceLogSet.data;
|
|
1063
|
+
const curves = sourceLogSet.curves;
|
|
1115
1064
|
const axes = wellLogView.getAxesInfo();
|
|
1116
1065
|
const iPrimaryAxis = indexOfElementByNames(curves, axes.mnemos[axes.primaryAxis]);
|
|
1117
1066
|
const plotData = preparePlotData(data, iCurve, iPrimaryAxis);
|
|
@@ -1120,7 +1069,7 @@ export function addOrEditStackedTrack(wellLogView, track, templateTrack, trackCu
|
|
|
1120
1069
|
// edit existing track
|
|
1121
1070
|
{
|
|
1122
1071
|
// force to clear stacked areas
|
|
1123
|
-
track.data = null; // workarond for videx
|
|
1072
|
+
track.data = null; // workarond for videx well log component to force redraw areas with new options (showLines, ...)
|
|
1124
1073
|
if (wellLogView.logController)
|
|
1125
1074
|
wellLogView.logController.updateTracks();
|
|
1126
1075
|
}
|