Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Well head position Z value should match the top of the well trajectory by default if not set explicitly #1907

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,14 @@ export function removeConsecutiveDuplicates(

return [coords, mds];
}

export function removeDuplicates(data: FeatureCollection): void {
// Remove duplicates in well string
// If z value of well head not defined set it to top of well string.
export function checkWells(data: FeatureCollection): void {
const no_wells = data.features.length;
for (let well_no = 0; well_no < no_wells; well_no++) {
const mds = data.features[well_no].properties?.["md"];
if (mds === undefined) {
continue;
}
const geometryCollection = data.features[well_no]
.geometry as GeometryCollection;

const lineString = geometryCollection?.geometries[1] as LineString;

if (lineString.coordinates?.length === undefined) {
Expand All @@ -50,6 +48,17 @@ export function removeDuplicates(data: FeatureCollection): void {

let coords = lineString.coordinates as Position3D[];

// If not defined set wellhead z value to top of well string.
const wellHead = geometryCollection?.geometries[0] as Point;
if (wellHead.coordinates && wellHead.coordinates.length === 2) {
wellHead.coordinates.push(coords[0][2]);
w1nklr marked this conversation as resolved.
Show resolved Hide resolved
}

const mds = data.features[well_no].properties?.["md"];
if (mds === undefined) {
continue;
}

const nOrig = coords.length;
[coords, mds[0]] = removeConsecutiveDuplicates(coords, mds[0]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import {
coarsenWells,
invertPath,
GetBoundingBox,
removeDuplicates,
checkWells,
} from "./utils/spline";
import { interpolateNumberArray } from "d3";
import type {
Expand Down Expand Up @@ -261,7 +261,7 @@ export default class WellsLayer extends CompositeLayer<WellsLayerProps> {
data = invertPath(data);
}

removeDuplicates(data);
checkWells(data);

const coarseData = coarsenWells(data);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,17 @@ const testWellWithDuplicates = {
geometries: [
{
type: "Point",
coordinates: [0, 0, 0],
coordinates: [0, 0],
},
{
type: "LineString",
coordinates: [
[0, 0, 0],
[0, 0, -100],
[0, 0, -200],
[0, 0, -300],
[0, 0, -400],
[0, 0, -400],
[0, 0, -400],
[0, 0, -500],
[0, 0, -600],
[0, 0, -700],
Expand Down
Loading