@webviz/well-log-viewer 2.4.4 → 2.4.6
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/components/PlotDialog.js +9 -9
- package/dist/components/WellLogView.js +2 -2
- package/dist/utils/color-function.d.ts +2 -2
- package/dist/utils/color-function.js +7 -7
- package/dist/utils/color-table.d.ts +2 -2
- package/dist/utils/color-table.js +8 -8
- package/dist/utils/gradientfill-plot-legend.js +14 -14
- package/dist/utils/gradientfill-plot.js +9 -9
- package/dist/utils/log-viewer.d.ts +4 -4
- package/dist/utils/log-viewer.js +6 -6
- package/dist/utils/plots.d.ts +4 -4
- package/dist/utils/plots.js +15 -14
- package/dist/utils/plots.js.map +1 -1
- package/dist/utils/tracks.d.ts +10 -10
- package/dist/utils/tracks.js +23 -23
- package/dist/utils/well-log.d.ts +1 -1
- package/dist/utils/well-log.js +6 -6
- package/package.json +40 -41
- package/dist/utils/well-log.test.d.ts +0 -1
- package/dist/utils/well-log.test.js +0 -232
- package/dist/utils/well-log.test.js.map +0 -1
|
@@ -57,16 +57,16 @@ function createColorItems() {
|
|
|
57
57
|
export function createBooleanItems() {
|
|
58
58
|
return _createItems(booleanItems);
|
|
59
59
|
}
|
|
60
|
-
function createColorFunctionItems(
|
|
60
|
+
function createColorFunctionItems(colormapFunctions) {
|
|
61
61
|
const nodes = [];
|
|
62
|
-
if (!
|
|
63
|
-
console.error("
|
|
62
|
+
if (!colormapFunctions || !colormapFunctions.length) {
|
|
63
|
+
console.error("colormapFunctions are missed or empty in createColorFunctionItems()");
|
|
64
64
|
}
|
|
65
65
|
else {
|
|
66
|
-
for (const
|
|
67
|
-
const name =
|
|
66
|
+
for (const colormapFunction of colormapFunctions) {
|
|
67
|
+
const name = colormapFunction.name;
|
|
68
68
|
if (!name) {
|
|
69
|
-
console.error("
|
|
69
|
+
console.error("colormapFunction.name is empty in createColorFunctionItems()");
|
|
70
70
|
}
|
|
71
71
|
nodes.push(React.createElement("option", { key: name }, name));
|
|
72
72
|
}
|
|
@@ -222,12 +222,12 @@ export class PlotPropertiesDialog extends Component {
|
|
|
222
222
|
];
|
|
223
223
|
}
|
|
224
224
|
else if (type === "gradientfill") {
|
|
225
|
-
const
|
|
225
|
+
const colormapFunctions = this.props.wellLogView.props.colorMapFunctions;
|
|
226
226
|
return [
|
|
227
|
-
this.createSelectControl("colorMapFunctionName", "Fill Color function/table", createColorFunctionItems(
|
|
227
|
+
this.createSelectControl("colorMapFunctionName", "Fill Color function/table", createColorFunctionItems(colormapFunctions)),
|
|
228
228
|
React.createElement(FormControl, { fullWidth: true, key: "211" }),
|
|
229
229
|
React.createElement(FormControl, { fullWidth: true, key: "212" }),
|
|
230
|
-
this.createSelectControl("inverseColorMapFunctionName", "Inverse Color function/table", createColorFunctionItems(
|
|
230
|
+
this.createSelectControl("inverseColorMapFunctionName", "Inverse Color function/table", createColorFunctionItems(colormapFunctions), true),
|
|
231
231
|
];
|
|
232
232
|
}
|
|
233
233
|
return [];
|
|
@@ -310,9 +310,9 @@ export function getWellPicks(wellLogView) {
|
|
|
310
310
|
const vMD = d[md];
|
|
311
311
|
const vPrimary = primaryAxis === "md" ? vMD : scaleInterpolator === null || scaleInterpolator === void 0 ? void 0 : scaleInterpolator.forward(vMD);
|
|
312
312
|
const vSecondary = primaryAxis === "md" ? scaleInterpolator === null || scaleInterpolator === void 0 ? void 0 : scaleInterpolator.reverse(vMD) : vMD;
|
|
313
|
-
const
|
|
313
|
+
const colormapFunction = wellpick.colorMapFunctions.find((colormapFunction) => colormapFunction.name === wellpick.colorMapFunctionName);
|
|
314
314
|
const meta = getDiscreteMeta(wellpick.wellpick, wellpick.name);
|
|
315
|
-
const { color } = getDiscreteColorAndName(d[c],
|
|
315
|
+
const { color } = getDiscreteColorAndName(d[c], colormapFunction, meta);
|
|
316
316
|
const wp = { vMD, vPrimary, vSecondary, horizon, color };
|
|
317
317
|
wps.push(wp);
|
|
318
318
|
}
|
|
@@ -5,5 +5,5 @@ export type ColorFunction = {
|
|
|
5
5
|
func: (v: number) => [number, number, number];
|
|
6
6
|
};
|
|
7
7
|
export type ColorMapFunction = colorTablesObj | ColorFunction;
|
|
8
|
-
export declare function isFunction(
|
|
9
|
-
export declare function
|
|
8
|
+
export declare function isFunction(colormapFunction: ColorMapFunction | undefined): boolean;
|
|
9
|
+
export declare function getColormapFunction(functionName?: string, colormapFunctions?: ColorMapFunction[]): ColorMapFunction | undefined;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { elementByName } from "./arrays";
|
|
2
|
-
export function isFunction(
|
|
3
|
-
if (!
|
|
2
|
+
export function isFunction(colormapFunction) {
|
|
3
|
+
if (!colormapFunction)
|
|
4
4
|
return false;
|
|
5
|
-
return !!
|
|
5
|
+
return !!colormapFunction.func;
|
|
6
6
|
}
|
|
7
|
-
export function
|
|
7
|
+
export function getColormapFunction(functionName, colormapFunctions) {
|
|
8
8
|
if (!functionName)
|
|
9
9
|
return undefined;
|
|
10
|
-
if (!
|
|
10
|
+
if (!colormapFunctions) {
|
|
11
11
|
console.error("No color functions provided for graph!");
|
|
12
|
-
|
|
12
|
+
colormapFunctions = [];
|
|
13
13
|
}
|
|
14
|
-
const colorFunction = elementByName(
|
|
14
|
+
const colorFunction = elementByName(colormapFunctions, functionName);
|
|
15
15
|
if (!colorFunction) {
|
|
16
16
|
console.error(`Color function '${functionName}' not found`);
|
|
17
17
|
}
|
|
@@ -2,5 +2,5 @@ import { type ColorMapFunction } from "./color-function";
|
|
|
2
2
|
export declare function colorToString(color: [number, number, number] | undefined, // [r,g,b]
|
|
3
3
|
cDefault: string): string;
|
|
4
4
|
export declare function color4ToString(color: [number, number, number, number]): string;
|
|
5
|
-
export declare function getInterpolatedColor(
|
|
6
|
-
export declare function getInterpolatedColorString(
|
|
5
|
+
export declare function getInterpolatedColor(colormapFunction: ColorMapFunction, v: number): [number, number, number];
|
|
6
|
+
export declare function getInterpolatedColorString(colormapFunction: ColorMapFunction, v: number): string;
|
|
@@ -65,12 +65,12 @@ export function getExactColor(
|
|
|
65
65
|
/*
|
|
66
66
|
get HTML string with interpolated color value in #xxxxxx format
|
|
67
67
|
*/
|
|
68
|
-
export function getInterpolatedColor(
|
|
69
|
-
if (isFunction(
|
|
70
|
-
const func =
|
|
68
|
+
export function getInterpolatedColor(colormapFunction, v) {
|
|
69
|
+
if (isFunction(colormapFunction)) {
|
|
70
|
+
const func = colormapFunction;
|
|
71
71
|
return func.func(v);
|
|
72
72
|
}
|
|
73
|
-
const table =
|
|
73
|
+
const table = colormapFunction;
|
|
74
74
|
// TODO: Do not compute these 3 constants (cNaN, cBelow, cAbove) every time!
|
|
75
75
|
const cNaN = table.colorNaN
|
|
76
76
|
? table.colorNaN
|
|
@@ -101,12 +101,12 @@ export function getInterpolatedColor(colorMapFunction, v) {
|
|
|
101
101
|
/*
|
|
102
102
|
get HTML string with interpolated color value in #xxxxxx format
|
|
103
103
|
*/
|
|
104
|
-
export function getInterpolatedColorString(
|
|
105
|
-
if (isFunction(
|
|
106
|
-
const func =
|
|
104
|
+
export function getInterpolatedColorString(colormapFunction, v) {
|
|
105
|
+
if (isFunction(colormapFunction)) {
|
|
106
|
+
const func = colormapFunction;
|
|
107
107
|
return colorToString(func.func(v), "#ffffff");
|
|
108
108
|
}
|
|
109
|
-
const colorTable =
|
|
109
|
+
const colorTable = colormapFunction;
|
|
110
110
|
// TODO: Do not compute these 3 constants (cNaN, cBelow, cAbove) every time!
|
|
111
111
|
const cNaN = colorToString(colorTable.colorNaN, "#ffffff"); // "white"
|
|
112
112
|
if (Number.isNaN(v))
|
|
@@ -4,7 +4,7 @@ import { isFunction } from "./color-function";
|
|
|
4
4
|
import { getInterpolatedColorString } from "./color-table";
|
|
5
5
|
import { color4ToString } from "./color-table";
|
|
6
6
|
let __idGradient = 0;
|
|
7
|
-
function createGradient(g,
|
|
7
|
+
function createGradient(g, colormapFunction, rLogarithmic) {
|
|
8
8
|
const id = "grad" + ++__idGradient; // generate unique id
|
|
9
9
|
const lg = g
|
|
10
10
|
.append("defs")
|
|
@@ -22,25 +22,25 @@ function createGradient(g, colorMapFunction, rLogarithmic) {
|
|
|
22
22
|
const fraction = i / nIntervals;
|
|
23
23
|
const y = 1 + fraction * d;
|
|
24
24
|
const v = Math.log(y) / yDelta;
|
|
25
|
-
const c = getInterpolatedColorString(
|
|
25
|
+
const c = getInterpolatedColorString(colormapFunction, v);
|
|
26
26
|
lg.append("stop")
|
|
27
27
|
.attr("offset", fraction * 100.0 + "%")
|
|
28
28
|
.style("stop-color", c);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
else {
|
|
32
|
-
if (isFunction(
|
|
32
|
+
if (isFunction(colormapFunction)) {
|
|
33
33
|
const nIntervals = 25; // set some not very big value to smooth filling
|
|
34
34
|
for (let i = 0; i <= nIntervals; i++) {
|
|
35
35
|
const fraction = i / nIntervals;
|
|
36
|
-
const c = getInterpolatedColorString(
|
|
36
|
+
const c = getInterpolatedColorString(colormapFunction, fraction);
|
|
37
37
|
lg.append("stop")
|
|
38
38
|
.attr("offset", fraction * 100.0 + "%")
|
|
39
39
|
.style("stop-color", c);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
else {
|
|
43
|
-
const table =
|
|
43
|
+
const table = colormapFunction;
|
|
44
44
|
const colors = table.colors;
|
|
45
45
|
for (let i = 0; i < colors.length; i++) {
|
|
46
46
|
const color = colors[i];
|
|
@@ -75,21 +75,21 @@ export default function renderGradientFillPlotLegend(g, bounds, legendInfo, plot
|
|
|
75
75
|
? options.inverseColor
|
|
76
76
|
: plot.options.color;
|
|
77
77
|
/* Start GradientFill code */
|
|
78
|
-
let
|
|
78
|
+
let colormapFunction = useMinAsBase && minIsLeft
|
|
79
79
|
? options.colorMapFunction
|
|
80
80
|
: options.inverseColorMapFunction;
|
|
81
|
-
if (
|
|
82
|
-
const id = createGradient(g,
|
|
81
|
+
if (colormapFunction) {
|
|
82
|
+
const id = createGradient(g, colormapFunction, options.scale === "linear" && options.colorScale === "log"
|
|
83
83
|
? max / min
|
|
84
84
|
: undefined);
|
|
85
85
|
fillNrm = "url(#" + id + ")";
|
|
86
86
|
}
|
|
87
|
-
|
|
87
|
+
colormapFunction =
|
|
88
88
|
useMinAsBase && minIsLeft
|
|
89
89
|
? options.inverseColorMapFunction
|
|
90
90
|
: options.colorMapFunction;
|
|
91
|
-
if (
|
|
92
|
-
const id = createGradient(g,
|
|
91
|
+
if (colormapFunction) {
|
|
92
|
+
const id = createGradient(g, colormapFunction, options.scale === "linear" &&
|
|
93
93
|
(options.inverseColorScale || options.colorScale) === "log"
|
|
94
94
|
? max / min
|
|
95
95
|
: undefined);
|
|
@@ -116,10 +116,10 @@ export default function renderGradientFillPlotLegend(g, bounds, legendInfo, plot
|
|
|
116
116
|
else {
|
|
117
117
|
let fillNrm = plot.options.color; // see area-plot-legend.ts! should be? plot.options.fill || plot.options.color;
|
|
118
118
|
/* Start GradientFill code */
|
|
119
|
-
const
|
|
120
|
-
if (
|
|
119
|
+
const colormapFunction = options.colorMapFunction;
|
|
120
|
+
if (colormapFunction) {
|
|
121
121
|
const [min, max] = plot.scale.domain();
|
|
122
|
-
const id = createGradient(g,
|
|
122
|
+
const id = createGradient(g, colormapFunction, options.scale === "linear" && options.colorScale === "log"
|
|
123
123
|
? max / min
|
|
124
124
|
: undefined);
|
|
125
125
|
fillNrm = "url(#" + id + ")";
|
|
@@ -5,7 +5,7 @@ import { getInterpolatedColorString } from "./color-table";
|
|
|
5
5
|
/*
|
|
6
6
|
* Create gradient based on ColorTable/ColorFunction
|
|
7
7
|
*/
|
|
8
|
-
function createGradient(ctx, yscale, horizontal, plotdata, xscale,
|
|
8
|
+
function createGradient(ctx, yscale, horizontal, plotdata, xscale, colormapFunction, scale // "linear" | "log"
|
|
9
9
|
) {
|
|
10
10
|
const dataFrom = plotdata[0];
|
|
11
11
|
const dataTo = plotdata[plotdata.length - 1];
|
|
@@ -24,7 +24,7 @@ function createGradient(ctx, yscale, horizontal, plotdata, xscale, colorMapFunct
|
|
|
24
24
|
const stop = (data[0] - xFrom) / xDelta;
|
|
25
25
|
if (0 <= stop && stop <= 1.0) {
|
|
26
26
|
const v = (Math.log(data[1]) - yFrom) / yDelta;
|
|
27
|
-
const c = getInterpolatedColorString(
|
|
27
|
+
const c = getInterpolatedColorString(colormapFunction, v);
|
|
28
28
|
gradient.addColorStop(stop, c);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
@@ -41,7 +41,7 @@ function createGradient(ctx, yscale, horizontal, plotdata, xscale, colorMapFunct
|
|
|
41
41
|
const stop = (data[0] - xFrom) / xDelta;
|
|
42
42
|
if (0 <= stop && stop <= 1.0) {
|
|
43
43
|
const v = (data[1] - yFrom) / yDelta;
|
|
44
|
-
const c = getInterpolatedColorString(
|
|
44
|
+
const c = getInterpolatedColorString(colormapFunction, v);
|
|
45
45
|
gradient.addColorStop(stop, c);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
@@ -117,9 +117,9 @@ export default class GradientFillPlot extends Plot {
|
|
|
117
117
|
inverseAreaFunction(plotdata);
|
|
118
118
|
ctx.fillStyle = options.inverseColor || "";
|
|
119
119
|
/* Start GradientFill code */
|
|
120
|
-
const
|
|
121
|
-
if (
|
|
122
|
-
ctx.fillStyle = createGradient(ctx, scale, options.horizontal, plotdata, xscale,
|
|
120
|
+
const colormapFunction = options.inverseColorMapFunction;
|
|
121
|
+
if (colormapFunction)
|
|
122
|
+
ctx.fillStyle = createGradient(ctx, scale, options.horizontal, plotdata, xscale, colormapFunction, options.inverseColorScale ||
|
|
123
123
|
options.colorScale ||
|
|
124
124
|
options.scale);
|
|
125
125
|
/* End GradientFill code */
|
|
@@ -130,9 +130,9 @@ export default class GradientFillPlot extends Plot {
|
|
|
130
130
|
ctx.lineWidth = options.width || 0.0;
|
|
131
131
|
ctx.fillStyle = options.fill || options.color || "";
|
|
132
132
|
/* Start GradientFill code */
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
135
|
-
ctx.fillStyle = createGradient(ctx, scale, options.horizontal, plotdata, xscale,
|
|
133
|
+
const colormapFunction = options.colorMapFunction;
|
|
134
|
+
if (colormapFunction)
|
|
135
|
+
ctx.fillStyle = createGradient(ctx, scale, options.horizontal, plotdata, xscale, colormapFunction, options.colorScale || options.scale);
|
|
136
136
|
/* End GradientFill code */
|
|
137
137
|
ctx.fill();
|
|
138
138
|
ctx.globalAlpha = 1;
|
|
@@ -145,10 +145,10 @@ export declare function updateLegendRows(logViewer: VidexLogViewer): void;
|
|
|
145
145
|
* @param position The new track's position in the log viewer
|
|
146
146
|
* @param axesInfo Information about the axis curves in the log
|
|
147
147
|
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
148
|
-
* @param
|
|
148
|
+
* @param colormapFunctions An array of color map functions to apply to the track
|
|
149
149
|
* @returns The new track if successful, otherwise `null`
|
|
150
150
|
*/
|
|
151
|
-
export declare function createNewViewTrack(logViewer: VidexLogViewer, template: TemplateTrack, position: number, axesInfo: AxesInfo, wellLogSets: WellLogSet[],
|
|
151
|
+
export declare function createNewViewTrack(logViewer: VidexLogViewer, template: TemplateTrack, position: number, axesInfo: AxesInfo, wellLogSets: WellLogSet[], colormapFunctions?: ColorMapFunction[]): Track<TrackOptions> | null;
|
|
152
152
|
/**
|
|
153
153
|
* Modifies a videx track with a new template configuration.
|
|
154
154
|
* @param logViewer A videx log view controller
|
|
@@ -156,10 +156,10 @@ export declare function createNewViewTrack(logViewer: VidexLogViewer, template:
|
|
|
156
156
|
* @param template A modified template config to apply to the track
|
|
157
157
|
* @param axesInfo Information about the axis curves in the log
|
|
158
158
|
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
159
|
-
* @param
|
|
159
|
+
* @param colormapFunctions An array of color map functions to apply to the track
|
|
160
160
|
* @returns The modified track
|
|
161
161
|
*/
|
|
162
|
-
export declare function editViewTrack(logViewer: VidexLogViewer, track: Track, newTemplate: TemplateTrack, axesInfo: AxesInfo, wellLogSets: WellLogSet[],
|
|
162
|
+
export declare function editViewTrack(logViewer: VidexLogViewer, track: Track, newTemplate: TemplateTrack, axesInfo: AxesInfo, wellLogSets: WellLogSet[], colormapFunctions?: ColorMapFunction[]): Track;
|
|
163
163
|
/**
|
|
164
164
|
* Removes a videx track from a log viewer.
|
|
165
165
|
* @param logViewer A videx log view controller
|
package/dist/utils/log-viewer.js
CHANGED
|
@@ -320,11 +320,11 @@ function addTrackAtIndex(logViewer, track, position) {
|
|
|
320
320
|
* @param position The new track's position in the log viewer
|
|
321
321
|
* @param axesInfo Information about the axis curves in the log
|
|
322
322
|
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
323
|
-
* @param
|
|
323
|
+
* @param colormapFunctions An array of color map functions to apply to the track
|
|
324
324
|
* @returns The new track if successful, otherwise `null`
|
|
325
325
|
*/
|
|
326
|
-
export function createNewViewTrack(logViewer, template, position, axesInfo, wellLogSets,
|
|
327
|
-
const newTrack = createTrack(wellLogSets, axesInfo, template,
|
|
326
|
+
export function createNewViewTrack(logViewer, template, position, axesInfo, wellLogSets, colormapFunctions = []) {
|
|
327
|
+
const newTrack = createTrack(wellLogSets, axesInfo, template, colormapFunctions);
|
|
328
328
|
if (!newTrack)
|
|
329
329
|
return null;
|
|
330
330
|
addTrackAtIndex(logViewer, newTrack, position);
|
|
@@ -340,11 +340,11 @@ export function createNewViewTrack(logViewer, template, position, axesInfo, well
|
|
|
340
340
|
* @param template A modified template config to apply to the track
|
|
341
341
|
* @param axesInfo Information about the axis curves in the log
|
|
342
342
|
* @param wellLogSets A well-log JSON data set to source curve data from
|
|
343
|
-
* @param
|
|
343
|
+
* @param colormapFunctions An array of color map functions to apply to the track
|
|
344
344
|
* @returns The modified track
|
|
345
345
|
*/
|
|
346
|
-
export function editViewTrack(logViewer, track, newTemplate, axesInfo, wellLogSets,
|
|
347
|
-
editTrack(track, newTemplate, wellLogSets, axesInfo,
|
|
346
|
+
export function editViewTrack(logViewer, track, newTemplate, axesInfo, wellLogSets, colormapFunctions = []) {
|
|
347
|
+
editTrack(track, newTemplate, wellLogSets, axesInfo, colormapFunctions);
|
|
348
348
|
adjustControllerToModifiedTrack(logViewer, track);
|
|
349
349
|
return track;
|
|
350
350
|
}
|
package/dist/utils/plots.d.ts
CHANGED
|
@@ -65,22 +65,22 @@ export declare function getPlotType(plot: Plot): TemplatePlotType;
|
|
|
65
65
|
* @param plotSetup - The setup information for the primary plot.
|
|
66
66
|
* @param plotSetup2 - The setup information for the secondary plot, if any.
|
|
67
67
|
* @param trackTemplate - The template for the track.
|
|
68
|
-
* @param
|
|
68
|
+
* @param colormapFunctions - An array of color map functions, for coloring the plot.
|
|
69
69
|
* @param iData - The index of the parent track's data array that corresponds to the primary plot.
|
|
70
70
|
* @param iData2 - The index for the secondary curve, if any.
|
|
71
71
|
* @returns The configuration for the plot.
|
|
72
72
|
*/
|
|
73
|
-
export declare function buildPlotConfig(plotSetup: PlotSetup, plotSetup2: PlotSetup | null, trackTemplate: TemplateTrack,
|
|
73
|
+
export declare function buildPlotConfig(plotSetup: PlotSetup, plotSetup2: PlotSetup | null, trackTemplate: TemplateTrack, colormapFunctions: ColorMapFunction[] | undefined, iData: number, iData2: number): PlotConfig;
|
|
74
74
|
/**
|
|
75
75
|
* Creates an array of `AreaData` objects that together form a discrete stacked graph.
|
|
76
76
|
*
|
|
77
77
|
* @param data - An array of key-value tuple rows.
|
|
78
|
-
* @param
|
|
78
|
+
* @param colormapFunction - A function that maps values to colors. Can be undefined.
|
|
79
79
|
* @param meta - Metadata defining how a value is represented (i.e label and color).
|
|
80
80
|
*
|
|
81
81
|
* @returns A promise that resolves to an array of `AreaData` objects.
|
|
82
82
|
*/
|
|
83
|
-
export declare function createStackData(data: [number | null, number | string | null][],
|
|
83
|
+
export declare function createStackData(data: [number | null, number | string | null][], colormapFunction: ColorMapFunction | undefined, meta: DiscreteMeta | undefined | null): Promise<AreaData[]>;
|
|
84
84
|
/**
|
|
85
85
|
* Sets up the plot configuration for a given well log set and template plot.
|
|
86
86
|
*
|
package/dist/utils/plots.js
CHANGED
|
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { LinePlot, AreaPlot, DotPlot, DifferentialPlot, LineStepPlot, } from "@equinor/videx-wellog";
|
|
11
|
-
import {
|
|
11
|
+
import { getColormapFunction } from "./color-function";
|
|
12
12
|
import GradientFillPlot from "./gradientfill-plot";
|
|
13
13
|
import { checkMinMaxValue, roundLogMinMax, roundMinMax } from "./minmax";
|
|
14
14
|
import { getDiscreteColorAndName, findSetAndCurveIndex, getAxisIndices, } from "./well-log";
|
|
@@ -133,27 +133,27 @@ function makeDataAccessorFunc(iData, iData2) {
|
|
|
133
133
|
* @param plotSetup - The setup information for the primary plot.
|
|
134
134
|
* @param plotSetup2 - The setup information for the secondary plot, if any.
|
|
135
135
|
* @param trackTemplate - The template for the track.
|
|
136
|
-
* @param
|
|
136
|
+
* @param colormapFunctions - An array of color map functions, for coloring the plot.
|
|
137
137
|
* @param iData - The index of the parent track's data array that corresponds to the primary plot.
|
|
138
138
|
* @param iData2 - The index for the secondary curve, if any.
|
|
139
139
|
* @returns The configuration for the plot.
|
|
140
140
|
*/
|
|
141
|
-
export function buildPlotConfig(plotSetup, plotSetup2, trackTemplate,
|
|
141
|
+
export function buildPlotConfig(plotSetup, plotSetup2, trackTemplate, colormapFunctions, iData, iData2) {
|
|
142
142
|
var _a;
|
|
143
143
|
const { iCurve, iSet, templatePlot } = plotSetup;
|
|
144
144
|
return {
|
|
145
145
|
id: `${iSet}-${iCurve}`,
|
|
146
146
|
type: (_a = templatePlot.type) !== null && _a !== void 0 ? _a : DEFAULT_PLOT_TYPE,
|
|
147
|
-
options: buildPlotOptions(plotSetup, plotSetup2, trackTemplate,
|
|
147
|
+
options: buildPlotOptions(plotSetup, plotSetup2, trackTemplate, colormapFunctions, iData, iData2),
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
function buildPlotOptions(plotSetup, plotSetup2, trackTemplate,
|
|
150
|
+
function buildPlotOptions(plotSetup, plotSetup2, trackTemplate, colormapFunctions, iData, iData2) {
|
|
151
151
|
var _a;
|
|
152
152
|
const { minmax, templatePlot } = plotSetup;
|
|
153
153
|
const scale = templatePlot.scale || trackTemplate.scale || DEFAULT_SCALE;
|
|
154
154
|
const domain = getScaledDomain(templatePlot, scale, minmax);
|
|
155
|
-
const
|
|
156
|
-
const
|
|
155
|
+
const colormapFunction = getColormapFunction(templatePlot.colorMapFunctionName, colormapFunctions);
|
|
156
|
+
const inverseColormapFunction = getColormapFunction(templatePlot.inverseColorMapFunctionName, colormapFunctions);
|
|
157
157
|
const dataAccessorFunc = makeDataAccessorFunc(iData, plotSetup2 ? iData2 : undefined);
|
|
158
158
|
const legendInfoFunc = makeLegendInfoFunc(plotSetup.curve, plotSetup2 === null || plotSetup2 === void 0 ? void 0 : plotSetup2.curve);
|
|
159
159
|
const fillOpacity = (_a = templatePlot.fillOpacity) !== null && _a !== void 0 ? _a : 0.25;
|
|
@@ -167,8 +167,9 @@ function buildPlotOptions(plotSetup, plotSetup2, trackTemplate, colorMapFunction
|
|
|
167
167
|
fill: templatePlot.fill, // for 'area'!
|
|
168
168
|
fillOpacity, // for 'area' and 'gradientfill'!
|
|
169
169
|
useMinAsBase: true, // for 'area' and 'gradientfill'!
|
|
170
|
-
|
|
171
|
-
|
|
170
|
+
// keep colorMap in returned structure: it is an external API
|
|
171
|
+
colorMapFunction: colormapFunction,
|
|
172
|
+
inverseColorMapFunction: inverseColormapFunction,
|
|
172
173
|
colorScale: templatePlot.colorScale,
|
|
173
174
|
inverseColorScale: templatePlot.inverseColorScale,
|
|
174
175
|
// @ts-expect-error Somethings wrong with the typing here,
|
|
@@ -187,8 +188,8 @@ function buildPlotOptions(plotSetup, plotSetup2, trackTemplate, colorMapFunction
|
|
|
187
188
|
},
|
|
188
189
|
};
|
|
189
190
|
}
|
|
190
|
-
function createAreaData(from, to, value,
|
|
191
|
-
const { color, name } = getDiscreteColorAndName(value,
|
|
191
|
+
function createAreaData(from, to, value, colormapFunction, meta) {
|
|
192
|
+
const { color, name } = getDiscreteColorAndName(value, colormapFunction, meta);
|
|
192
193
|
return {
|
|
193
194
|
from: from,
|
|
194
195
|
to: to,
|
|
@@ -205,12 +206,12 @@ function createAreaData(from, to, value, colorMapFunction, meta) {
|
|
|
205
206
|
* Creates an array of `AreaData` objects that together form a discrete stacked graph.
|
|
206
207
|
*
|
|
207
208
|
* @param data - An array of key-value tuple rows.
|
|
208
|
-
* @param
|
|
209
|
+
* @param colormapFunction - A function that maps values to colors. Can be undefined.
|
|
209
210
|
* @param meta - Metadata defining how a value is represented (i.e label and color).
|
|
210
211
|
*
|
|
211
212
|
* @returns A promise that resolves to an array of `AreaData` objects.
|
|
212
213
|
*/
|
|
213
|
-
export function createStackData(data,
|
|
214
|
+
export function createStackData(data, colormapFunction, meta) {
|
|
214
215
|
return __awaiter(this, void 0, void 0, function* () {
|
|
215
216
|
const arr = new Array();
|
|
216
217
|
let prev = null;
|
|
@@ -253,7 +254,7 @@ export function createStackData(data, colorMapFunction, meta) {
|
|
|
253
254
|
if (!area && value !== null && value !== undefined && p[0] !== null) {
|
|
254
255
|
// new value is not null
|
|
255
256
|
// create new interval colored and labeled for the value
|
|
256
|
-
area = createAreaData(boundary, p[0], value,
|
|
257
|
+
area = createAreaData(boundary, p[0], value, colormapFunction, meta);
|
|
257
258
|
}
|
|
258
259
|
prev = p;
|
|
259
260
|
}
|
package/dist/utils/plots.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plots.js","sourceRoot":"","sources":["../../src/utils/plots.ts"],"names":[],"mappings":";;;;;;;;;AAIA,OAAO,EACH,QAAQ,EACR,QAAQ,EACR,OAAO,EACP,gBAAgB,EAChB,YAAY,GACf,MAAM,uBAAuB,CAAC;AAmB/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,gBAEN,MAAM,qBAAqB,CAAC;AAC7B,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K,CACP,qCAAqC,UAAU,CAAC,IAAI,SAAS,CAChE,CAAC;IACN,CAAC;IAED,OAAO,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC"}
|
package/dist/utils/tracks.d.ts
CHANGED
|
@@ -24,20 +24,20 @@ declare class TracksInfo {
|
|
|
24
24
|
* @param axes The axes to match data to
|
|
25
25
|
* @param templateTracks Templates describing individual tracks
|
|
26
26
|
* @param templateStyles Global styles/options for track plots
|
|
27
|
-
* @param
|
|
27
|
+
* @param colormapFunctions Overview of methods used to color rendered plots
|
|
28
28
|
* @returns An object containing videx tracks and related meta-info
|
|
29
29
|
*/
|
|
30
30
|
export declare function createWellLogTracks(wellLog: WellLogSet[], axes: AxesInfo, templateTracks: TemplateTrack[], // Part of JSON
|
|
31
|
-
|
|
31
|
+
colormapFunctions: ColorMapFunction[]): TracksInfo;
|
|
32
32
|
/**
|
|
33
33
|
* Creates a single well-log viewer track from a template object.
|
|
34
34
|
* @param wellLog Well log data set
|
|
35
35
|
* @param axesInfo Information about data axes to use
|
|
36
36
|
* @param templateTrack Track setup template
|
|
37
|
-
* @param
|
|
37
|
+
* @param colormapFunctions Optional - Functions for coloring the plot
|
|
38
38
|
* @returns A videx well-log track, if the template was valid. Otherwise null
|
|
39
39
|
*/
|
|
40
|
-
export declare function createTrack(wellLog: WellLogSet[], axesInfo: AxesInfo, templateTrack: TemplateTrack,
|
|
40
|
+
export declare function createTrack(wellLog: WellLogSet[], axesInfo: AxesInfo, templateTrack: TemplateTrack, colormapFunctions?: ColorMapFunction[]): Track | null;
|
|
41
41
|
/**
|
|
42
42
|
* Edits a videx track to match a new template.
|
|
43
43
|
* **NOTE:** Mutates the track!
|
|
@@ -45,10 +45,10 @@ export declare function createTrack(wellLog: WellLogSet[], axesInfo: AxesInfo, t
|
|
|
45
45
|
* @param newTemplateTrack The new template to apply
|
|
46
46
|
* @param wellLogSets JSON Well-log containing curve data
|
|
47
47
|
* @param axisInfo Description of the axes to plot data against
|
|
48
|
-
* @param
|
|
48
|
+
* @param colormapFunctions Methods used when coloring the plot
|
|
49
49
|
* @returns The edited track
|
|
50
50
|
*/
|
|
51
|
-
export declare function editTrack(existingTrack: Track, newTemplateTrack: TemplateTrack, wellLogSets: WellLogSet[], axisInfo: AxesInfo,
|
|
51
|
+
export declare function editTrack(existingTrack: Track, newTemplateTrack: TemplateTrack, wellLogSets: WellLogSet[], axisInfo: AxesInfo, colormapFunctions: ColorMapFunction[]): Track;
|
|
52
52
|
/**
|
|
53
53
|
* Adds a new plot to a videx track.
|
|
54
54
|
* **NOTE:** Mutates the track
|
|
@@ -56,9 +56,9 @@ export declare function editTrack(existingTrack: Track, newTemplateTrack: Templa
|
|
|
56
56
|
* @param templatePlot Template object for the new plot,
|
|
57
57
|
* @param wellLogSets JSON Well-log sets to source data from
|
|
58
58
|
* @param axesInfo
|
|
59
|
-
* @param
|
|
59
|
+
* @param colormapFunctions
|
|
60
60
|
*/
|
|
61
|
-
export declare function addPlotToTrack(track: Track, templatePlot: TemplatePlot, wellLogSets: WellLogSet[], axesInfo: AxesInfo,
|
|
61
|
+
export declare function addPlotToTrack(track: Track, templatePlot: TemplatePlot, wellLogSets: WellLogSet[], axesInfo: AxesInfo, colormapFunctions: ColorMapFunction[]): void;
|
|
62
62
|
/**
|
|
63
63
|
* Modifies one of the plots in a videx track.
|
|
64
64
|
* **NOTE:** Mutates the track!
|
|
@@ -67,9 +67,9 @@ export declare function addPlotToTrack(track: Track, templatePlot: TemplatePlot,
|
|
|
67
67
|
* @param templatePlot The new template to apply
|
|
68
68
|
* @param wellLogSets JSON Well-log sets to source data from
|
|
69
69
|
* @param axesInfo Description of the axes to plot data against
|
|
70
|
-
* @param
|
|
70
|
+
* @param colormapFunctions Methods used when coloring the plot
|
|
71
71
|
*/
|
|
72
|
-
export declare function editTrackPlot(track: Track, oldPlot: Plot, templatePlot: TemplatePlot, wellLogSets: WellLogSet[], axesInfo: AxesInfo,
|
|
72
|
+
export declare function editTrackPlot(track: Track, oldPlot: Plot, templatePlot: TemplatePlot, wellLogSets: WellLogSet[], axesInfo: AxesInfo, colormapFunctions: ColorMapFunction[]): void;
|
|
73
73
|
/**
|
|
74
74
|
* Removes a plot from a videx track.
|
|
75
75
|
* **NOTE:** Mutates the track!
|
package/dist/utils/tracks.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*
|
|
8
8
|
*/
|
|
9
9
|
import { ScaleTrack, DualScaleTrack, GraphTrack, StackedTrack, } from "@equinor/videx-wellog";
|
|
10
|
-
import {
|
|
10
|
+
import { getColormapFunction } from "./color-function";
|
|
11
11
|
import { createScale } from "./graph/factory";
|
|
12
12
|
import { stackLegendConfig } from "./stack/stack-legend";
|
|
13
13
|
import { getAxisTitle } from "./axes";
|
|
@@ -101,7 +101,7 @@ function updateStackedTrackScale(track) {
|
|
|
101
101
|
// track.options.domain = plot.options.domain;
|
|
102
102
|
//}
|
|
103
103
|
//if (!track.options.domain) {
|
|
104
|
-
// // could be on
|
|
104
|
+
// // could be on required track with missed data
|
|
105
105
|
// console.log("Empty track.options.domain!");
|
|
106
106
|
// track.options.domain =
|
|
107
107
|
// track.options.scale === "log" ? [1, 100] : [0, 100];
|
|
@@ -116,11 +116,11 @@ function updateStackedTrackScale(track) {
|
|
|
116
116
|
* @param axes The axes to match data to
|
|
117
117
|
* @param templateTracks Templates describing individual tracks
|
|
118
118
|
* @param templateStyles Global styles/options for track plots
|
|
119
|
-
* @param
|
|
119
|
+
* @param colormapFunctions Overview of methods used to color rendered plots
|
|
120
120
|
* @returns An object containing videx tracks and related meta-info
|
|
121
121
|
*/
|
|
122
122
|
export function createWellLogTracks(wellLog, axes, templateTracks, // Part of JSON
|
|
123
|
-
|
|
123
|
+
colormapFunctions // JS code or JSON color table
|
|
124
124
|
) {
|
|
125
125
|
var _a, _b;
|
|
126
126
|
if (!(wellLog === null || wellLog === void 0 ? void 0 : wellLog.length))
|
|
@@ -129,7 +129,7 @@ colorMapFunctions // JS code or JSON color table
|
|
|
129
129
|
const scaleTracks = setUpScaleTracks(axes, wellLog);
|
|
130
130
|
info.tracks.push(...scaleTracks);
|
|
131
131
|
for (const templateTrack of templateTracks) {
|
|
132
|
-
const track = createTrack(wellLog, axes, templateTrack,
|
|
132
|
+
const track = createTrack(wellLog, axes, templateTrack, colormapFunctions);
|
|
133
133
|
if (!track) {
|
|
134
134
|
console.warn("Could not build track", templateTrack);
|
|
135
135
|
}
|
|
@@ -191,7 +191,7 @@ function maybeGetSecondaryPlotSetup(plotSetups, currIndex) {
|
|
|
191
191
|
}
|
|
192
192
|
return setup2;
|
|
193
193
|
}
|
|
194
|
-
function makeGraphTrackOptions(plotSetups, templateTrack,
|
|
194
|
+
function makeGraphTrackOptions(plotSetups, templateTrack, colormapFunctions, existingOptions = {}) {
|
|
195
195
|
// Only returns a non-required tracks if there's any plot-setups available
|
|
196
196
|
const trackData = [];
|
|
197
197
|
const trackPlots = [];
|
|
@@ -206,7 +206,7 @@ function makeGraphTrackOptions(plotSetups, templateTrack, colorMapFunctions, exi
|
|
|
206
206
|
const plotSetup = plotSetups[index];
|
|
207
207
|
const plotSetup2 = maybeGetSecondaryPlotSetup(plotSetups, index);
|
|
208
208
|
applySetupMinMax(plotSetup, plotSetup2, indexMinMax);
|
|
209
|
-
const plotConfig = buildPlotConfig(plotSetup, plotSetup2, templateTrack,
|
|
209
|
+
const plotConfig = buildPlotConfig(plotSetup, plotSetup2, templateTrack, colormapFunctions, trackData.length, trackData.length + 1);
|
|
210
210
|
trackPlots.push(plotConfig);
|
|
211
211
|
curvesUsed.push(plotSetup.curve);
|
|
212
212
|
trackData.push(plotSetup.plotData.data);
|
|
@@ -219,14 +219,14 @@ function makeGraphTrackOptions(plotSetups, templateTrack, colorMapFunctions, exi
|
|
|
219
219
|
}
|
|
220
220
|
return Object.assign(Object.assign({}, createTrackOptionsFromTemplate(templateTrack, existingOptions)), { __indexMinMax: indexMinMax, label: makeTrackHeader(curvesUsed, templateTrack), data: trackData, plots: trackPlots });
|
|
221
221
|
}
|
|
222
|
-
function makeStackedTrackOptions(plotSetups, templateTrack,
|
|
222
|
+
function makeStackedTrackOptions(plotSetups, templateTrack, colormapFunctions, existingOptions = {}) {
|
|
223
223
|
var _a;
|
|
224
224
|
// ? Why do we not care about "required" here? (@anders2303)
|
|
225
225
|
if (!plotSetups.length)
|
|
226
226
|
throw new Error("Unexpected empty plot list");
|
|
227
227
|
const { curve, plotData, sourceLogSet, templatePlot } = plotSetups[0];
|
|
228
228
|
const meta = getDiscreteMeta(sourceLogSet, curve.name);
|
|
229
|
-
const colorFunc =
|
|
229
|
+
const colorFunc = getColormapFunction((_a = templatePlot.colorMapFunctionName) !== null && _a !== void 0 ? _a : "", colormapFunctions);
|
|
230
230
|
const trackHeader = makeTrackHeader([curve], templateTrack);
|
|
231
231
|
if (!meta && curve.valueType === "integer") {
|
|
232
232
|
console.warn(`Discrete meta information for '${curve.name}' not found. Using default`);
|
|
@@ -244,20 +244,20 @@ function makeStackedTrackOptions(plotSetups, templateTrack, colorMapFunctions, e
|
|
|
244
244
|
* @param wellLog Well log data set
|
|
245
245
|
* @param axesInfo Information about data axes to use
|
|
246
246
|
* @param templateTrack Track setup template
|
|
247
|
-
* @param
|
|
247
|
+
* @param colormapFunctions Optional - Functions for coloring the plot
|
|
248
248
|
* @returns A videx well-log track, if the template was valid. Otherwise null
|
|
249
249
|
*/
|
|
250
|
-
export function createTrack(wellLog, axesInfo, templateTrack,
|
|
250
|
+
export function createTrack(wellLog, axesInfo, templateTrack, colormapFunctions) {
|
|
251
251
|
const plotSetups = setupTrackPlots(wellLog, templateTrack, axesInfo);
|
|
252
252
|
// ! Stacked tracks require one plot to initialize
|
|
253
253
|
if (isStackedTrackTemplate(templateTrack) && plotSetups.length) {
|
|
254
|
-
const stackedOptions = makeStackedTrackOptions(plotSetups, templateTrack,
|
|
254
|
+
const stackedOptions = makeStackedTrackOptions(plotSetups, templateTrack, colormapFunctions);
|
|
255
255
|
const track = newStackedTrack(stackedOptions);
|
|
256
256
|
updateStackedTrackScale(track);
|
|
257
257
|
return track;
|
|
258
258
|
}
|
|
259
259
|
else if (plotSetups.length || templateTrack.required) {
|
|
260
|
-
const graphOptions = makeGraphTrackOptions(plotSetups, templateTrack,
|
|
260
|
+
const graphOptions = makeGraphTrackOptions(plotSetups, templateTrack, colormapFunctions);
|
|
261
261
|
const track = newGraphTrack(graphOptions);
|
|
262
262
|
updateGraphTrackScale(track);
|
|
263
263
|
return track;
|
|
@@ -271,22 +271,22 @@ export function createTrack(wellLog, axesInfo, templateTrack, colorMapFunctions)
|
|
|
271
271
|
* @param newTemplateTrack The new template to apply
|
|
272
272
|
* @param wellLogSets JSON Well-log containing curve data
|
|
273
273
|
* @param axisInfo Description of the axes to plot data against
|
|
274
|
-
* @param
|
|
274
|
+
* @param colormapFunctions Methods used when coloring the plot
|
|
275
275
|
* @returns The edited track
|
|
276
276
|
*/
|
|
277
|
-
export function editTrack(existingTrack, newTemplateTrack, wellLogSets, axisInfo,
|
|
277
|
+
export function editTrack(existingTrack, newTemplateTrack, wellLogSets, axisInfo, colormapFunctions) {
|
|
278
278
|
const newPlotSetups = setupTrackPlots(wellLogSets, newTemplateTrack, axisInfo);
|
|
279
279
|
if (existingTrack instanceof StackedTrack) {
|
|
280
280
|
// ! Hack to force to clear stacked areas
|
|
281
281
|
existingTrack.data = null;
|
|
282
|
-
const newTrackOptions = makeStackedTrackOptions(newPlotSetups, newTemplateTrack,
|
|
282
|
+
const newTrackOptions = makeStackedTrackOptions(newPlotSetups, newTemplateTrack, colormapFunctions, existingTrack.options);
|
|
283
283
|
existingTrack.options = newTrackOptions;
|
|
284
284
|
existingTrack.data = newTrackOptions.data;
|
|
285
285
|
updateStackedTrackScale(existingTrack);
|
|
286
286
|
}
|
|
287
287
|
else if (existingTrack instanceof GraphTrack) {
|
|
288
288
|
// TODO: Deal with new plots being added here. Pass to attachPlotToTrack?
|
|
289
|
-
const newOptions = makeGraphTrackOptions(newPlotSetups, newTemplateTrack,
|
|
289
|
+
const newOptions = makeGraphTrackOptions(newPlotSetups, newTemplateTrack, colormapFunctions, existingTrack.options);
|
|
290
290
|
existingTrack.options = newOptions;
|
|
291
291
|
existingTrack.data = newOptions.data;
|
|
292
292
|
existingTrack.refresh();
|
|
@@ -301,9 +301,9 @@ export function editTrack(existingTrack, newTemplateTrack, wellLogSets, axisInfo
|
|
|
301
301
|
* @param templatePlot Template object for the new plot,
|
|
302
302
|
* @param wellLogSets JSON Well-log sets to source data from
|
|
303
303
|
* @param axesInfo
|
|
304
|
-
* @param
|
|
304
|
+
* @param colormapFunctions
|
|
305
305
|
*/
|
|
306
|
-
export function addPlotToTrack(track, templatePlot, wellLogSets, axesInfo,
|
|
306
|
+
export function addPlotToTrack(track, templatePlot, wellLogSets, axesInfo, colormapFunctions) {
|
|
307
307
|
// ! Currently only supporting graph tracks, but keeping the function ambiguous for now
|
|
308
308
|
if (!(track instanceof GraphTrack))
|
|
309
309
|
throw Error("Can only add tracks to GraphTracks");
|
|
@@ -317,7 +317,7 @@ export function addPlotToTrack(track, templatePlot, wellLogSets, axesInfo, color
|
|
|
317
317
|
throw Error("Invalid plot setup");
|
|
318
318
|
}
|
|
319
319
|
applySetupMinMax(setup1, setup2, existingIndexRange);
|
|
320
|
-
const newPlotConfig = buildPlotConfig(setup1, setup2, existingTemplate,
|
|
320
|
+
const newPlotConfig = buildPlotConfig(setup1, setup2, existingTemplate, colormapFunctions, trackDataPoints.length, trackDataPoints.length + 1);
|
|
321
321
|
const newPlot = buildGraphPlotFromTrackOptions(newPlotConfig, track);
|
|
322
322
|
existingPlots.push(newPlot);
|
|
323
323
|
existingTemplate.plots.push(templatePlot);
|
|
@@ -335,9 +335,9 @@ export function addPlotToTrack(track, templatePlot, wellLogSets, axesInfo, color
|
|
|
335
335
|
* @param templatePlot The new template to apply
|
|
336
336
|
* @param wellLogSets JSON Well-log sets to source data from
|
|
337
337
|
* @param axesInfo Description of the axes to plot data against
|
|
338
|
-
* @param
|
|
338
|
+
* @param colormapFunctions Methods used when coloring the plot
|
|
339
339
|
*/
|
|
340
|
-
export function editTrackPlot(track, oldPlot, templatePlot, wellLogSets, axesInfo,
|
|
340
|
+
export function editTrackPlot(track, oldPlot, templatePlot, wellLogSets, axesInfo, colormapFunctions) {
|
|
341
341
|
if (!(track instanceof GraphTrack))
|
|
342
342
|
throw Error("Can only add tracks to GraphTracks");
|
|
343
343
|
const existingPlots = track.plots;
|
|
@@ -355,7 +355,7 @@ export function editTrackPlot(track, oldPlot, templatePlot, wellLogSets, axesInf
|
|
|
355
355
|
throw Error("Invalid plot setup");
|
|
356
356
|
}
|
|
357
357
|
applySetupMinMax(setup1, setup2, existingIndexRange);
|
|
358
|
-
const newPlotConfig = buildPlotConfig(setup1, setup2, existingTemplate,
|
|
358
|
+
const newPlotConfig = buildPlotConfig(setup1, setup2, existingTemplate, colormapFunctions, trackDataPoints.length, trackDataPoints.length + 1);
|
|
359
359
|
const newPlot = buildGraphPlotFromTrackOptions(newPlotConfig, track);
|
|
360
360
|
existingPlots[iOldPlot] = newPlot; // replace existing plot
|
|
361
361
|
existingTemplate.plots[iOldPlot] = templatePlot;
|
package/dist/utils/well-log.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export interface DiscreteMeta {
|
|
|
81
81
|
objects: WellLogMetadataDiscreteObjects;
|
|
82
82
|
}
|
|
83
83
|
export declare function getDiscreteMeta(wellLogSet: WellLogSet, name: string): DiscreteMeta | null;
|
|
84
|
-
export declare function getDiscreteColorAndName(value: number | string | null,
|
|
84
|
+
export declare function getDiscreteColorAndName(value: number | string | null, colormapFunction: ColorMapFunction | undefined, meta?: DiscreteMeta | null): {
|
|
85
85
|
color: number[];
|
|
86
86
|
name: string;
|
|
87
87
|
};
|
package/dist/utils/well-log.js
CHANGED
|
@@ -156,7 +156,7 @@ export function getDiscreteMeta(wellLogSet, name) {
|
|
|
156
156
|
}
|
|
157
157
|
return null; // something went wrong
|
|
158
158
|
}
|
|
159
|
-
export function getDiscreteColorAndName(value,
|
|
159
|
+
export function getDiscreteColorAndName(value, colormapFunction, meta) {
|
|
160
160
|
let color;
|
|
161
161
|
let name;
|
|
162
162
|
if (value === null)
|
|
@@ -184,9 +184,9 @@ export function getDiscreteColorAndName(value, colorMapFunction, meta) {
|
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
/*if(object)*/ {
|
|
187
|
-
if (
|
|
187
|
+
if (colormapFunction) {
|
|
188
188
|
// get color from the table
|
|
189
|
-
color = getInterpolatedColor(
|
|
189
|
+
color = getInterpolatedColor(colormapFunction, !object
|
|
190
190
|
? Number.NaN
|
|
191
191
|
: // eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
192
192
|
parseFloat(object[iCode].toString()) // parseInt for discrete log
|
|
@@ -200,7 +200,7 @@ export function getDiscreteColorAndName(value, colorMapFunction, meta) {
|
|
|
200
200
|
}
|
|
201
201
|
else {
|
|
202
202
|
name = value.toString();
|
|
203
|
-
if (
|
|
203
|
+
if (colormapFunction) {
|
|
204
204
|
// get color from the table
|
|
205
205
|
if (typeof value === "string") {
|
|
206
206
|
let v;
|
|
@@ -212,10 +212,10 @@ export function getDiscreteColorAndName(value, colorMapFunction, meta) {
|
|
|
212
212
|
v = iStringToNum;
|
|
213
213
|
iStringToNum++;
|
|
214
214
|
}
|
|
215
|
-
color = getInterpolatedColor(
|
|
215
|
+
color = getInterpolatedColor(colormapFunction, v);
|
|
216
216
|
}
|
|
217
217
|
else {
|
|
218
|
-
color = getInterpolatedColor(
|
|
218
|
+
color = getInterpolatedColor(colormapFunction, parseInt(value.toString()));
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
221
|
else {
|
package/package.json
CHANGED
|
@@ -1,43 +1,42 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
"
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
"
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"
|
|
41
|
-
|
|
42
|
-
}
|
|
2
|
+
"name": "@webviz/well-log-viewer",
|
|
3
|
+
"version": "2.4.6",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"transpile": "tsc --project ./tsconfig.json",
|
|
12
|
+
"copy-files": "copyfiles --up 1 \"src/**/*.scss\" dist/",
|
|
13
|
+
"build": "git clean -xdff dist && npm run transpile && npm run copy-files",
|
|
14
|
+
"test_perf": "jest _performance",
|
|
15
|
+
"test_correctness": "jest --coverage --testPathIgnorePatterns='_performance'",
|
|
16
|
+
"test": "jest --coverage",
|
|
17
|
+
"test:update": "npm test -- --u",
|
|
18
|
+
"test:watch": "npm test -- --watch",
|
|
19
|
+
"doc": "git clean -xdff docs && typedoc src"
|
|
20
|
+
},
|
|
21
|
+
"author": "Equinor <opensource@equinor.com>",
|
|
22
|
+
"license": "MPL-2.0",
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@emerson-eps/color-tables": "^0.4.92",
|
|
25
|
+
"@equinor/videx-wellog": "^0.11.3",
|
|
26
|
+
"@webviz/wsc-common": "1.2.4",
|
|
27
|
+
"convert-units": "^2.3.4",
|
|
28
|
+
"d3": "^7.8.2"
|
|
29
|
+
},
|
|
30
|
+
"peerDependencies": {
|
|
31
|
+
"@mui/material": "^5.11",
|
|
32
|
+
"react": "^17 || ^18",
|
|
33
|
+
"react-dom": "^17 || ^18"
|
|
34
|
+
},
|
|
35
|
+
"devDependencies": {
|
|
36
|
+
"@reduxjs/toolkit": "^2.3.0",
|
|
37
|
+
"react-redux": "^9.1.2"
|
|
38
|
+
},
|
|
39
|
+
"volta": {
|
|
40
|
+
"node": "20.18.3"
|
|
41
|
+
}
|
|
43
42
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,232 +0,0 @@
|
|
|
1
|
-
import { findIndexByCurveName, findSetAndCurveIndex, getAllWellLogCurves, getAxisIndices, getCurveByName, getCurveFromVidexPlotId, getDiscreteMetaDataByName, getWellLogSetsFromProps, } from "./well-log";
|
|
2
|
-
// @ts-expect-error TS2741 Mock object kept simple for testing purposes
|
|
3
|
-
const MOCK_LOG_SET_1 = {
|
|
4
|
-
curves: [{ name: "Curve1" }, { name: "Curve2" }],
|
|
5
|
-
header: { well: "Well1" },
|
|
6
|
-
metadata_discrete: {
|
|
7
|
-
Curve1: {
|
|
8
|
-
attributes: "Attributes1",
|
|
9
|
-
objects: "Objects1",
|
|
10
|
-
},
|
|
11
|
-
},
|
|
12
|
-
// Data is not needed for any of these tests
|
|
13
|
-
data: [],
|
|
14
|
-
};
|
|
15
|
-
const MOCK_LOG_SET_2 = {
|
|
16
|
-
curves: [{ name: "Curve3" }, { name: "Curve4" }],
|
|
17
|
-
header: { well: "Well1" },
|
|
18
|
-
metadata_discrete: {},
|
|
19
|
-
// Data is not needed for any of these tests
|
|
20
|
-
data: [],
|
|
21
|
-
};
|
|
22
|
-
const MOCK_LOG_SET_3 = {
|
|
23
|
-
curves: [{ name: "C1" }, { name: "C2" }],
|
|
24
|
-
header: { well: "Well1" },
|
|
25
|
-
metadata_discrete: {},
|
|
26
|
-
// Data is not needed for any of these tests
|
|
27
|
-
data: [],
|
|
28
|
-
};
|
|
29
|
-
const MOCK_LOG_FROM_DIFFERENT_WELL = {
|
|
30
|
-
curves: [{ name: "Curve1" }, { name: "Curve1" }],
|
|
31
|
-
header: { well: "Some Other Well" },
|
|
32
|
-
metadata_discrete: {},
|
|
33
|
-
// Data is not needed for any of these tests
|
|
34
|
-
data: [],
|
|
35
|
-
};
|
|
36
|
-
// @ts-expect-error TS2741 Mock object kept simple for testing purposes
|
|
37
|
-
const MOCK_AXES_INFO = {
|
|
38
|
-
primaryAxis: "primary",
|
|
39
|
-
secondaryAxis: "secondary",
|
|
40
|
-
mnemos: {
|
|
41
|
-
primary: ["Curve1", "C1"],
|
|
42
|
-
secondary: ["Curve2"],
|
|
43
|
-
},
|
|
44
|
-
};
|
|
45
|
-
describe("getAllWellLogCurves", () => {
|
|
46
|
-
it("should return all curves from a single well log set", () => {
|
|
47
|
-
const wellLogSets = [MOCK_LOG_SET_1];
|
|
48
|
-
const result = getAllWellLogCurves(wellLogSets);
|
|
49
|
-
expect(result).toEqual([{ name: "Curve1" }, { name: "Curve2" }]);
|
|
50
|
-
});
|
|
51
|
-
it("should return all curves from multiple well log sets", () => {
|
|
52
|
-
const wellLogSets = [MOCK_LOG_SET_1, MOCK_LOG_SET_2];
|
|
53
|
-
const result = getAllWellLogCurves(wellLogSets);
|
|
54
|
-
expect(result).toEqual([
|
|
55
|
-
{ name: "Curve1" },
|
|
56
|
-
{ name: "Curve2" },
|
|
57
|
-
{ name: "Curve3" },
|
|
58
|
-
{ name: "Curve4" },
|
|
59
|
-
]);
|
|
60
|
-
});
|
|
61
|
-
it("should handle well log sets with no curves", () => {
|
|
62
|
-
const wellLogSets = [
|
|
63
|
-
Object.assign(Object.assign({}, MOCK_LOG_SET_1), { curves: [] }),
|
|
64
|
-
MOCK_LOG_SET_2,
|
|
65
|
-
];
|
|
66
|
-
const result = getAllWellLogCurves(wellLogSets);
|
|
67
|
-
expect(result).toEqual([{ name: "Curve3" }, { name: "Curve4" }]);
|
|
68
|
-
});
|
|
69
|
-
});
|
|
70
|
-
describe("findSetAndCurveIndex", () => {
|
|
71
|
-
it("should return the correct indices for an existing curve", () => {
|
|
72
|
-
const wellLogSets = [MOCK_LOG_SET_1, MOCK_LOG_SET_2];
|
|
73
|
-
const result = findSetAndCurveIndex(wellLogSets, "Curve1");
|
|
74
|
-
expect(result).toEqual({ iSet: 0, iCurve: 0 });
|
|
75
|
-
});
|
|
76
|
-
it("should return -1 indices for a curve that does not exist", () => {
|
|
77
|
-
const wellLogSets = [MOCK_LOG_SET_1, MOCK_LOG_SET_2];
|
|
78
|
-
const result = findSetAndCurveIndex(wellLogSets, "Curve5");
|
|
79
|
-
expect(result).toEqual({ iSet: -1, iCurve: -1 });
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
describe("findIndexByCurveName", () => {
|
|
83
|
-
it("should return the correct index for an existing curve", () => {
|
|
84
|
-
const curves = MOCK_LOG_SET_1.curves;
|
|
85
|
-
const result = findIndexByCurveName(curves, "Curve1");
|
|
86
|
-
expect(result).toBe(0);
|
|
87
|
-
});
|
|
88
|
-
it("should return -1 for a curve that does not exist", () => {
|
|
89
|
-
const curves = MOCK_LOG_SET_1.curves;
|
|
90
|
-
const result = findIndexByCurveName(curves, "Curve5");
|
|
91
|
-
expect(result).toBe(-1);
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
describe("getCurveByName", () => {
|
|
95
|
-
it("should return the correct curve", () => {
|
|
96
|
-
const wellLogSet = MOCK_LOG_SET_1;
|
|
97
|
-
const result = getCurveByName(wellLogSet, "Curve1");
|
|
98
|
-
expect(result).toEqual({ name: "Curve1" });
|
|
99
|
-
});
|
|
100
|
-
it("should return undefined for a curve that does not exist", () => {
|
|
101
|
-
const wellLogSet = MOCK_LOG_SET_1;
|
|
102
|
-
const result = getCurveByName(wellLogSet, "Curve5");
|
|
103
|
-
expect(result).toBeUndefined();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
describe("getDiscreteMetaDataByName", () => {
|
|
107
|
-
it("should return the correct metadata for an existing curve", () => {
|
|
108
|
-
const wellLogSet = MOCK_LOG_SET_1;
|
|
109
|
-
const result = getDiscreteMetaDataByName(wellLogSet, "Curve1");
|
|
110
|
-
expect(result).toEqual({
|
|
111
|
-
attributes: "Attributes1",
|
|
112
|
-
objects: "Objects1",
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
it("should return null for a curve that does not exist", () => {
|
|
116
|
-
const wellLogSet = MOCK_LOG_SET_1;
|
|
117
|
-
const result = getDiscreteMetaDataByName(wellLogSet, "Curve5");
|
|
118
|
-
expect(result).toBeNull();
|
|
119
|
-
});
|
|
120
|
-
it("should return null for a curve that does not have associated metadata", () => {
|
|
121
|
-
const wellLogSet = MOCK_LOG_SET_1;
|
|
122
|
-
const result = getDiscreteMetaDataByName(wellLogSet, "Curve5");
|
|
123
|
-
expect(result).toBeNull();
|
|
124
|
-
});
|
|
125
|
-
it("should return null for a well log set that does not have metadata", () => {
|
|
126
|
-
const wellLogSet = MOCK_LOG_SET_2;
|
|
127
|
-
const result = getDiscreteMetaDataByName(wellLogSet, "Curve3");
|
|
128
|
-
expect(result).toBeNull();
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
describe("getAxisIndices", () => {
|
|
132
|
-
it("should return the correct axis indices", () => {
|
|
133
|
-
const curves = MOCK_LOG_SET_1.curves;
|
|
134
|
-
const result = getAxisIndices(curves, MOCK_AXES_INFO);
|
|
135
|
-
expect(result).toEqual({ primary: 0, secondary: 1 });
|
|
136
|
-
});
|
|
137
|
-
it("should work with a different name mnemonic", () => {
|
|
138
|
-
const curves = MOCK_LOG_SET_3.curves;
|
|
139
|
-
const result = getAxisIndices(curves, MOCK_AXES_INFO);
|
|
140
|
-
expect(result).toEqual({ primary: 0, secondary: -1 });
|
|
141
|
-
});
|
|
142
|
-
it("should return -1 for both axes if they are not found", () => {
|
|
143
|
-
const curvesWithOutAxes = [{ name: "Curr_1" }, { name: "Curr_1" }];
|
|
144
|
-
const result = getAxisIndices(curvesWithOutAxes, MOCK_AXES_INFO);
|
|
145
|
-
expect(result).toEqual({ primary: -1, secondary: -1 });
|
|
146
|
-
});
|
|
147
|
-
it("should return -1 if mnemos are not provided", () => {
|
|
148
|
-
const curves = MOCK_LOG_SET_1.curves;
|
|
149
|
-
// @ts-expect-error TS2345 Intentionally passing a broken object
|
|
150
|
-
const result = getAxisIndices(curves, {});
|
|
151
|
-
expect(result).toEqual({ primary: -1, secondary: -1 });
|
|
152
|
-
});
|
|
153
|
-
it("should return -1 if mnemos for axis dont exist", () => {
|
|
154
|
-
const curves = MOCK_LOG_SET_1.curves;
|
|
155
|
-
// @ts-expect-error TS2741 Kept simple for testing purposes
|
|
156
|
-
const axesInfoWithWrongMnemos = {
|
|
157
|
-
primaryAxis: "foo",
|
|
158
|
-
secondaryAxis: "fee",
|
|
159
|
-
mnemos: {
|
|
160
|
-
bar: ["Curve1", "C1"],
|
|
161
|
-
fum: ["Curve2"],
|
|
162
|
-
},
|
|
163
|
-
};
|
|
164
|
-
const result = getAxisIndices(curves, axesInfoWithWrongMnemos);
|
|
165
|
-
expect(result).toEqual({ primary: -1, secondary: -1 });
|
|
166
|
-
});
|
|
167
|
-
});
|
|
168
|
-
describe("getWellLogSetsFromProps", () => {
|
|
169
|
-
it("should return an array for welllog prop", () => {
|
|
170
|
-
// @ts-expect-error TS2739 Prop kept simple for testing purposes
|
|
171
|
-
const propWithSingle = {
|
|
172
|
-
welllog: MOCK_LOG_SET_1,
|
|
173
|
-
};
|
|
174
|
-
const result1 = getWellLogSetsFromProps(propWithSingle);
|
|
175
|
-
expect(result1).toEqual([MOCK_LOG_SET_1]);
|
|
176
|
-
// @ts-expect-error TS2739 Prop kept simple for testing purposes
|
|
177
|
-
const propWithArray = {
|
|
178
|
-
welllog: [MOCK_LOG_SET_1, MOCK_LOG_SET_2],
|
|
179
|
-
};
|
|
180
|
-
const result2 = getWellLogSetsFromProps(propWithArray);
|
|
181
|
-
expect(result2).toEqual([MOCK_LOG_SET_1, MOCK_LOG_SET_2]);
|
|
182
|
-
});
|
|
183
|
-
it("should return an array for wellLogSets prop", () => {
|
|
184
|
-
// @ts-expect-error TS2739 Prop kept simple for testing purposes
|
|
185
|
-
const prop = {
|
|
186
|
-
wellLogSets: [MOCK_LOG_SET_1, MOCK_LOG_SET_2],
|
|
187
|
-
};
|
|
188
|
-
const result = getWellLogSetsFromProps(prop);
|
|
189
|
-
expect(result).toEqual([MOCK_LOG_SET_1, MOCK_LOG_SET_2]);
|
|
190
|
-
});
|
|
191
|
-
it("should prioritize wellLogSets prop over welllog prop", () => {
|
|
192
|
-
// @ts-expect-error TS2739 Prop kept simple for testing purposes
|
|
193
|
-
const prop = {
|
|
194
|
-
welllog: MOCK_LOG_SET_1,
|
|
195
|
-
wellLogSets: [MOCK_LOG_SET_2],
|
|
196
|
-
};
|
|
197
|
-
const result = getWellLogSetsFromProps(prop);
|
|
198
|
-
expect(result).toEqual([MOCK_LOG_SET_2]);
|
|
199
|
-
});
|
|
200
|
-
it("should return an empty array if none of the properties are provided", () => {
|
|
201
|
-
// @ts-expect-error TS2345 Prop kept simple
|
|
202
|
-
const result = getWellLogSetsFromProps({});
|
|
203
|
-
expect(result).toEqual([]);
|
|
204
|
-
});
|
|
205
|
-
it("should warn if logs for different wells are found", () => {
|
|
206
|
-
const warnSpy = jest.spyOn(console, "warn").mockImplementation();
|
|
207
|
-
// @ts-expect-error TS2739 Prop kept simple for testing purposes
|
|
208
|
-
const prop = {
|
|
209
|
-
welllog: [MOCK_LOG_SET_1, MOCK_LOG_FROM_DIFFERENT_WELL],
|
|
210
|
-
};
|
|
211
|
-
getWellLogSetsFromProps(prop);
|
|
212
|
-
expect(warnSpy).toHaveBeenCalled();
|
|
213
|
-
warnSpy.mockRestore();
|
|
214
|
-
});
|
|
215
|
-
});
|
|
216
|
-
describe("getCurveFromVidexPlotId", () => {
|
|
217
|
-
it("should return the first curve in the second set", () => {
|
|
218
|
-
const wellLogSets = [MOCK_LOG_SET_1, MOCK_LOG_SET_2];
|
|
219
|
-
const result = getCurveFromVidexPlotId(wellLogSets, "1-0");
|
|
220
|
-
expect(result).toEqual({ name: "Curve3" });
|
|
221
|
-
});
|
|
222
|
-
it("should return undefined if the id gives out-of-bounds indices", () => {
|
|
223
|
-
const wellLogSets = [MOCK_LOG_SET_1, MOCK_LOG_SET_2];
|
|
224
|
-
const result = getCurveFromVidexPlotId(wellLogSets, "2-0");
|
|
225
|
-
expect(result).toBeUndefined();
|
|
226
|
-
});
|
|
227
|
-
it("should throw if the id is not in the correct format", () => {
|
|
228
|
-
const wellLogSets = [MOCK_LOG_SET_1, MOCK_LOG_SET_2];
|
|
229
|
-
expect(() => getCurveFromVidexPlotId(wellLogSets, "1")).toThrow("Wrong pattern");
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
//# sourceMappingURL=well-log.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"well-log.test.js","sourceRoot":"","sources":["../../src/utils/well-log.test.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,oBAAoB,EACpB,oBAAoB,EACpB,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,uBAAuB,EACvB,yBAAyB,EACzB,uBAAuB,GAC1B,MAAM,YAAY,CAAC;AAKpB,uEAAuE;AACvE,MAAM,cAAc,GAAG;IACnB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAChD,MAAM,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;IACzB,iBAAiB,EAAE;QACf,MAAM,EAAE;YACJ,UAAU,EAAE,aAAa;YACzB,OAAO,EAAE,UAAU;SACtB;KACJ;IACD,4CAA4C;IAC5C,IAAI,EAAE,EAAE;CACG,CAAC;AAEhB,MAAM,cAAc,GAAe;IAC/B,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IAChD,MAA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