@webviz/subsurface-viewer 1.13.7 → 1.13.9

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.
@@ -1,3 +1,41 @@
1
- import type { FeatureCollection, GeometryCollection } from "geojson";
2
- /** Projects well trajectories unfolded onto an XY plane. */
1
+ import type { FeatureCollection, GeometryCollection, Position } from "geojson";
2
+ /**
3
+ * Returns the final (last) coordinate of the first LineString with at least one coordinate
4
+ * found inside the supplied GeometryCollection.
5
+ *
6
+ * @param feature Geometry collection feature containing well geometries (Points / LineStrings).
7
+ * @returns The last coordinate (xyz) of the first qualifying LineString, or null if none exist.
8
+ */
9
+ export declare const getEndPoint: (feature: {
10
+ geometry: GeometryCollection;
11
+ }) => Position | null;
12
+ /**
13
+ * Returns the starting (first) coordinate of the first LineString with at least one coordinate
14
+ * found inside the supplied GeometryCollection.
15
+ *
16
+ * @param feature Geometry collection feature containing well geometries (Points / LineStrings).
17
+ * @returns The first coordinate (xyz) of the first qualifying LineString, or null if none exist.
18
+ */
19
+ export declare const getStartPoint: (feature: {
20
+ geometry: GeometryCollection;
21
+ }) => Position | null;
22
+ /**
23
+ * Computes the lateral (XY plane) Euclidean distance between the end of the first available
24
+ * trajectory (LineString) in the first feature and the start of the first available trajectory
25
+ * in the second feature. Z values are ignored in the distance calculation.
26
+ *
27
+ * @param feature1 Feature containing a GeometryCollection (source / previous well trajectory).
28
+ * @param feature2 Feature containing a GeometryCollection (target / next well trajectory).
29
+ * @returns Lateral distance in the same units as the input coordinates, or 0 if either trajectory endpoint is missing.
30
+ */
31
+ export declare function calculateTrajectoryGap(feature1: {
32
+ geometry: GeometryCollection;
33
+ }, feature2: {
34
+ geometry: GeometryCollection;
35
+ }): number;
36
+ /**
37
+ * Projects well trajectories unfolded onto an abscissa, z plane with lateral separation.
38
+ * The distance between trajectories is equal to the lateral component of the euclidean
39
+ * distance between the end of the previous trajectory and the start of the next one.
40
+ */
3
41
  export declare function abscissaTransform<TFeatureCollection extends FeatureCollection<GeometryCollection>>(featureCollection: TFeatureCollection): TFeatureCollection;
@@ -7,27 +7,100 @@ function computeUnfoldedPath(worldCoordinates) {
7
7
  return distance([prev[0], prev[1]], [v[0], v[1]]);
8
8
  });
9
9
  const a = [];
10
- delta.forEach((d) => {
10
+ let maxAbscissa = 0;
11
+ for (const d of delta) {
11
12
  const prev = a.at(-1) || 0;
12
- a.push(d + prev);
13
- });
14
- const vAbscissa = zip(a, z, [...a].fill(0));
15
- return vAbscissa;
13
+ const newA = d + prev;
14
+ a.push(newA);
15
+ maxAbscissa = Math.max(maxAbscissa, newA);
16
+ }
17
+ const vAbscissa = zip(a, z, new Array(a.length).fill(0));
18
+ return { vAbscissa: vAbscissa, maxAbscissa };
16
19
  }
17
- /** Projects well trajectories unfolded onto an XY plane. */
20
+ /**
21
+ * Returns the final (last) coordinate of the first LineString with at least one coordinate
22
+ * found inside the supplied GeometryCollection.
23
+ *
24
+ * @param feature Geometry collection feature containing well geometries (Points / LineStrings).
25
+ * @returns The last coordinate (xyz) of the first qualifying LineString, or null if none exist.
26
+ */
27
+ export const getEndPoint = (feature) => {
28
+ for (const geometry of feature.geometry.geometries) {
29
+ if (geometry.type === "LineString" && geometry.coordinates.length > 0) {
30
+ return geometry.coordinates.at(-1) || null;
31
+ }
32
+ }
33
+ return null;
34
+ };
35
+ /**
36
+ * Returns the starting (first) coordinate of the first LineString with at least one coordinate
37
+ * found inside the supplied GeometryCollection.
38
+ *
39
+ * @param feature Geometry collection feature containing well geometries (Points / LineStrings).
40
+ * @returns The first coordinate (xyz) of the first qualifying LineString, or null if none exist.
41
+ */
42
+ export const getStartPoint = (feature) => {
43
+ for (const geometry of feature.geometry.geometries) {
44
+ if (geometry.type === "LineString" && geometry.coordinates.length > 0) {
45
+ return geometry.coordinates.at(0) || null;
46
+ }
47
+ }
48
+ return null;
49
+ };
50
+ /**
51
+ * Computes the lateral (XY plane) Euclidean distance between the end of the first available
52
+ * trajectory (LineString) in the first feature and the start of the first available trajectory
53
+ * in the second feature. Z values are ignored in the distance calculation.
54
+ *
55
+ * @param feature1 Feature containing a GeometryCollection (source / previous well trajectory).
56
+ * @param feature2 Feature containing a GeometryCollection (target / next well trajectory).
57
+ * @returns Lateral distance in the same units as the input coordinates, or 0 if either trajectory endpoint is missing.
58
+ */
59
+ export function calculateTrajectoryGap(feature1, feature2) {
60
+ const end1 = getEndPoint(feature1);
61
+ const start2 = getStartPoint(feature2);
62
+ if (!end1 || !start2) {
63
+ return 0; // Default gap if we can't find end/start points
64
+ }
65
+ // Calculate euclidean distance between end of previous and start of next
66
+ return distance([end1[0], end1[1]], [start2[0], start2[1]]);
67
+ }
68
+ /**
69
+ * Projects well trajectories unfolded onto an abscissa, z plane with lateral separation.
70
+ * The distance between trajectories is equal to the lateral component of the euclidean
71
+ * distance between the end of the previous trajectory and the start of the next one.
72
+ */
18
73
  export function abscissaTransform(featureCollection) {
19
74
  const featureCollectionCopy = cloneDeep(featureCollection);
20
- for (const feature of featureCollectionCopy.features) {
75
+ // Calculate the maximum trajectory length and gaps needed
76
+ let maxAbscissa = 0;
77
+ // First pass: calculate trajectory lengths and offsets
78
+ for (let i = 0; i < featureCollectionCopy.features.length; i++) {
79
+ const feature = featureCollectionCopy.features[i];
21
80
  const geometryCollection = feature.geometry;
81
+ // Find the maximum length of LineString geometries in this feature
22
82
  for (const geometry of geometryCollection.geometries) {
23
- if ("LineString" === geometry.type) {
24
- const transformedCoordinates = computeUnfoldedPath(geometry.coordinates);
25
- geometry.coordinates = transformedCoordinates;
26
- }
27
- else if ("Point" === geometry.type) {
83
+ if ("Point" === geometry.type) {
28
84
  const coordinates = geometry.coordinates;
29
- geometry.coordinates = [0, coordinates[2], 0];
85
+ geometry.coordinates = [maxAbscissa, coordinates[2], 0];
30
86
  }
87
+ else if ("LineString" === geometry.type) {
88
+ const projection = computeUnfoldedPath(geometry.coordinates);
89
+ geometry.coordinates = projection.vAbscissa.map((coord) => [
90
+ coord[0] + maxAbscissa,
91
+ coord[1],
92
+ coord[2],
93
+ ]);
94
+ maxAbscissa += projection.maxAbscissa;
95
+ }
96
+ }
97
+ // Add gap equal to lateral euclidean distance between trajectory start points in
98
+ // original world coordinates
99
+ if (i < featureCollection.features.length - 1) {
100
+ const currentTrajectory = featureCollection.features[i];
101
+ const nextTrajectory = featureCollection.features[i + 1];
102
+ const gap = calculateTrajectoryGap(currentTrajectory, nextTrajectory);
103
+ maxAbscissa += gap;
31
104
  }
32
105
  }
33
106
  return featureCollectionCopy;
@@ -1 +1 @@
1
- {"version":3,"file":"abscissaTransform.js","sourceRoot":"","sources":["../../../../src/layers/wells/utils/abscissaTransform.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAElC,SAAS,mBAAmB,CAAC,gBAA4B;IACrD,MAAM,CAAC,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5C,MAAM,KAAK,GAAG,gBAAgB,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,WAAW,EAAE,EAAE;QACrD,MAAM,IAAI,GAAG,WAAW,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;QACrC,OAAO,QAAQ,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACtD,CAAC,CAAC,CAAC;IACH,MAAM,CAAC,GAAa,EAAE,CAAC;IACvB,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE;QAChB,MAAM,IAAI,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC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GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;YACxD,MAAM,cAAc,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACzD,MAAM,GAAG,GAAG,sBAAsB,CAC9B,iBAAiB,EACjB,cAAc,CACjB,CAAC;YACF,WAAW,IAAI,GAAG,CAAC;QACvB,CAAC;IACL,CAAC;IAED,OAAO,qBAAqB,CAAC;AACjC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webviz/subsurface-viewer",
3
- "version": "1.13.7",
3
+ "version": "1.13.9",
4
4
  "description": "3D visualization component for subsurface reservoir data",
5
5
  "keywords": [
6
6
  "subsurface",
@@ -33,20 +33,20 @@
33
33
  "license": "MPL-2.0",
34
34
  "dependencies": {
35
35
  "@deck.gl-community/editable-layers": "^9.1.1",
36
- "@deck.gl/aggregation-layers": "^9.1.14",
37
- "@deck.gl/core": "^9.1.14",
38
- "@deck.gl/extensions": "^9.1.14",
39
- "@deck.gl/geo-layers": "^9.1.14",
40
- "@deck.gl/json": "^9.1.14",
41
- "@deck.gl/layers": "^9.1.14",
42
- "@deck.gl/mesh-layers": "^9.1.14",
43
- "@deck.gl/react": "^9.1.14",
36
+ "@deck.gl/aggregation-layers": "^9.1.15",
37
+ "@deck.gl/core": "^9.1.15",
38
+ "@deck.gl/extensions": "^9.1.15",
39
+ "@deck.gl/geo-layers": "^9.1.15",
40
+ "@deck.gl/json": "^9.1.15",
41
+ "@deck.gl/layers": "^9.1.15",
42
+ "@deck.gl/mesh-layers": "^9.1.15",
43
+ "@deck.gl/react": "^9.1.15",
44
44
  "@emerson-eps/color-tables": "^0.4.92",
45
45
  "@equinor/eds-core-react": "^0.36.0",
46
46
  "@equinor/eds-icons": "^0.21.0",
47
47
  "@turf/simplify": "^7.1.0",
48
48
  "@vivaxy/png": "^1.3.0",
49
- "@webviz/wsc-common": "1.3.4",
49
+ "@webviz/wsc-common": "1.3.5",
50
50
  "ajv": "^8.16.0",
51
51
  "convert-units": "^2.3.4",
52
52
  "d3": "^7.8.2",