From e5ee9e94b94c52b80e776a0f469d207a9ee1904a Mon Sep 17 00:00:00 2001 From: Hans Kallekleiv <16436291+HansKallekleiv@users.noreply.github.com> Date: Thu, 22 Aug 2024 13:16:03 +0200 Subject: [PATCH] Remove Structural uncertainty module (#698) --- .../components/Legend.tsx | 30 -- .../components/esvIntersection.tsx | 235 ----------- .../interfaces.ts | 51 --- .../loadModule.tsx | 12 - .../queryHooks.tsx | 84 ---- .../registerModule.ts | 18 - .../settings/atoms/baseAtoms.ts | 16 - .../components/intersectionSettings.tsx | 36 -- .../components/realizationsSelect.tsx | 55 --- .../settings/settings.tsx | 367 ------------------ .../state.ts | 13 - .../typesAndEnums.ts | 44 --- .../view.tsx | 134 ------- frontend/src/modules/registerAllModules.ts | 1 - 14 files changed, 1096 deletions(-) delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/components/Legend.tsx delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/components/esvIntersection.tsx delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/interfaces.ts delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/loadModule.tsx delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/queryHooks.tsx delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/registerModule.ts delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/settings/atoms/baseAtoms.ts delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/settings/components/intersectionSettings.tsx delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/settings/components/realizationsSelect.tsx delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/settings/settings.tsx delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/state.ts delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/typesAndEnums.ts delete mode 100644 frontend/src/modules/StructuralUncertaintyIntersection/view.tsx diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/components/Legend.tsx b/frontend/src/modules/StructuralUncertaintyIntersection/components/Legend.tsx deleted file mode 100644 index 041ec41fa..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/components/Legend.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import React from 'react'; - -type LegendItem = { - color: string; - label: string; -}; - - -type LegendProps = { - items: LegendItem[]; -}; - -const Legend: React.FC = ({ items }) => { - return ( -
- {items.map((item, index) => ( -
-
- {item.label} -
- ))} -
- ); -}; -export default Legend; diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/components/esvIntersection.tsx b/frontend/src/modules/StructuralUncertaintyIntersection/components/esvIntersection.tsx deleted file mode 100644 index bda9ec1e7..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/components/esvIntersection.tsx +++ /dev/null @@ -1,235 +0,0 @@ -import React from "react"; - -import { StatisticFunction_api, SurfaceRealizationSampleValues_api } from "@api"; -import { - Controller, - GeomodelCanvasLayer, - GeomodelLayerV2, - GridLayer, - PixiRenderApplication, - ReferenceLine, - ReferenceLineLayer, - SurfaceData, - WellborepathLayer, -} from "@equinor/esv-intersection"; -import { addMDOverlay } from "@modules/SeismicIntersection/utils/esvIntersectionControllerUtils"; -import { makeReferenceSystemFromTrajectoryXyzPoints } from "@modules/SeismicIntersection/utils/esvIntersectionDataConversion"; - -import { isEqual } from "lodash"; - -import { SurfaceRealizationSampleValuesData } from "../queryHooks"; -import { StratigraphyColorMap, VisualizationMode } from "../typesAndEnums"; - -type EsvIntersectionProps = { - width: number; - height: number; - zScale: number; - extension: number; - wellborePath: number[][] | null; - cumLength: number[] | null; - surfaceRealizationSampleValuesData?: SurfaceRealizationSampleValuesData[] | null; - visualizationMode: VisualizationMode; - statisticFunctions: StatisticFunction_api[]; - stratigraphyColorMap: StratigraphyColorMap; -}; - -export const EsvIntersection: React.FC = (props) => { - const containerDiv = React.useRef(null); - const controller = React.useRef(null); - const pixiContent = React.useRef(null); - const [previousWellborePath, setPreviousWellborePath] = React.useState(null); - const width = props.width; - const height = props.height; - const seaAndRKBLayerData: ReferenceLine[] = [ - { text: "RKB", lineType: "dashed", color: "black", depth: 0 }, - { text: "MSL", lineType: "wavy", color: "blue", depth: 30 }, - { text: "Seabed", lineType: "solid", color: "slategray", depth: 91.1, lineWidth: 2 }, - ]; - const seaAndRKBLayer = new ReferenceLineLayer("sea-and-rkb-layer", { data: seaAndRKBLayerData }); - - React.useEffect(function initializeEsvIntersectionController() { - if (containerDiv.current) { - const axisOptions = { xLabel: "x", yLabel: "y", unitOfMeasure: "m" }; - controller.current = new Controller({ - container: containerDiv.current, - axisOptions, - }); - // eslint-disable-next-line @typescript-eslint/ban-ts-comment - // @ts-ignore - pixiContent.current = new PixiRenderApplication({ width: width, height: height }); - - // Initialize/configure controller - addMDOverlay(controller.current); - controller.current.addLayer(new GridLayer("gridLayer")); - controller.current.addLayer(new WellborepathLayer("wellBorePathLayer")); - controller.current.addLayer( - new GeomodelCanvasLayer("statisticalSurfaceLayer", { order: 3, layerOpacity: 0.6 }) - ); - controller.current.addLayer( - new GeomodelLayerV2(pixiContent.current, "realizationsSurfaceLayer", { order: 4, layerOpacity: 0.6 }) - ); - controller.current.addLayer(seaAndRKBLayer); - controller.current.setBounds([10, 1000], [0, 3000]); - controller.current.setViewport(1000, 1650, 6000); - controller.current.zoomPanHandler.zFactor = props.zScale; - } - return () => { - controller.current?.destroy(); - }; - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - if (!isEqual(previousWellborePath, props.wellborePath)) { - setPreviousWellborePath(props.wellborePath); - } - if (controller.current && props.wellborePath && props.cumLength) { - controller.current.adjustToSize(Math.max(0, width), Math.max(0, height)); - const referenceSystem = makeReferenceSystemFromTrajectoryXyzPoints(props.wellborePath); - controller.current.setReferenceSystem(referenceSystem); - - controller.current?.getLayer("statisticalSurfaceLayer")?.clearData(); - controller.current?.getLayer("realizationsSurfaceLayer")?.clearData(); - if (props.surfaceRealizationSampleValuesData) { - if ( - props.visualizationMode === VisualizationMode.STATISTICAL_LINES || - props.visualizationMode === VisualizationMode.STATISTICS_AND_REALIZATIONS - ) { - const statData = surfaceSamplePointsToStatisticalLayerData( - props.surfaceRealizationSampleValuesData, - props.cumLength, - props.statisticFunctions, - props.stratigraphyColorMap - ); - controller.current.getLayer("statisticalSurfaceLayer")?.setData(statData); - } - if ( - props.visualizationMode === VisualizationMode.INDIVIDUAL_REALIZATIONS || - props.visualizationMode === VisualizationMode.STATISTICS_AND_REALIZATIONS - ) { - const realizationData = surfaceSamplePointsToRealizationLayerData( - props.surfaceRealizationSampleValuesData, - props.cumLength, - props.stratigraphyColorMap - ); - controller.current.getLayer("realizationsSurfaceLayer")?.setData(realizationData); - } - } - } - - return
; -}; - -function surfaceSamplePointsToRealizationLayerData( - samplePoints: SurfaceRealizationSampleValuesData[], - cumLength: number[], - stratigraphyColorMap: StratigraphyColorMap -): SurfaceData { - const surfaceValues: { name: string; realization: number; values: number[]; showLabel: boolean }[] = []; - samplePoints.forEach((surfaceSet) => { - surfaceSet.realizationPoints.forEach((realSamplePoints: SurfaceRealizationSampleValues_api, rdx: number) => { - surfaceValues.push({ - name: surfaceSet.surfaceName, - showLabel: rdx === 0, - realization: realSamplePoints.realization, - values: realSamplePoints.sampled_values, - }); - }); - }); - const geolayerdata: SurfaceData = { - areas: [], - lines: surfaceValues.map((realizationValues) => { - return { - data: realizationValues.values.map((z: number, idx) => { - return [cumLength[idx], z]; - }), - color: stratigraphyColorMap[realizationValues.name] || "black", - id: realizationValues.name + realizationValues.realization, - label: realizationValues.showLabel ? realizationValues.name : "", - textColor: "black", - width: 1, - }; - }), - }; - return geolayerdata; -} - -function surfaceSamplePointsToStatisticalLayerData( - samplePoints: SurfaceRealizationSampleValuesData[], - cumLength: number[], - statisticFunctions: StatisticFunction_api[], - stratigraphyColorMap: StratigraphyColorMap -): SurfaceData { - const statisticLines: { name: string; statistic: string; values: number[]; color: string }[] = []; - - samplePoints.forEach((surfaceSet) => { - const allValues: number[][] = surfaceSet.realizationPoints.map((p) => p.sampled_values); - const numPoints = allValues[0]?.length || 0; - const statistics: any = { - MEAN: new Array(numPoints).fill(0), - MIN: new Array(numPoints).fill(Infinity), - MAX: new Array(numPoints).fill(-Infinity), - P10: new Array(numPoints).fill(0), - P50: new Array(numPoints).fill(0), - P90: new Array(numPoints).fill(0), - }; - - for (let i = 0; i < numPoints; i++) { - const valuesAtPosition = allValues.map((values) => values[i]); - if (valuesAtPosition.some((value) => value === null)) { - statistics.MEAN[i] = null; - statistics.MIN[i] = null; - statistics.MAX[i] = null; - statistics.P10[i] = null; - statistics.P50[i] = null; - statistics.P90[i] = null; - continue; - } - statistics.MEAN[i] = mean(valuesAtPosition); - statistics.MIN[i] = Math.min(...valuesAtPosition); - statistics.MAX[i] = Math.max(...valuesAtPosition); - statistics.P10[i] = percentile(valuesAtPosition, 10); - statistics.P50[i] = percentile(valuesAtPosition, 50); - statistics.P90[i] = percentile(valuesAtPosition, 90); - } - - Object.keys(statistics).forEach((stat) => { - if (!statisticFunctions.includes(stat as StatisticFunction_api)) { - return; - } - statisticLines.push({ - name: surfaceSet.surfaceName, - statistic: stat, - values: statistics[stat], - color: stratigraphyColorMap[surfaceSet.surfaceName] || "black", - }); - }); - }); - - const geolayerdata: SurfaceData = { - areas: [], - lines: statisticLines.map((line) => ({ - data: line.values.map((value, idx) => [cumLength[idx], value]), - color: line.color, - id: line.name + line.statistic, - label: line.statistic, - width: 1, - })), - }; - - return geolayerdata; - - function mean(values: number[]): number { - return values.reduce((a, b) => a + b, 0) / values.length; - } - - function percentile(values: number[], p: number): number { - values.sort((a, b) => a - b); - const position = ((values.length - 1) * p) / 100; - const base = Math.floor(position); - const rest = position - base; - if (values[base + 1] !== undefined) { - return values[base] + rest * (values[base + 1] - values[base]); - } else { - return values[base]; - } - } -} diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/interfaces.ts b/frontend/src/modules/StructuralUncertaintyIntersection/interfaces.ts deleted file mode 100644 index e065d5084..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/interfaces.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { StatisticFunction_api } from "@api"; -import { InterfaceInitialization } from "@framework/UniDirectionalModuleComponentsInterface"; -import { Wellbore } from "@framework/types/wellbore"; -import { - IntersectionSettings, - SurfaceSetAddress, - VisualizationMode, -} from "@modules/StructuralUncertaintyIntersection/typesAndEnums"; - -import { - intersectionSettingsAtom, - statisticFunctionsAtom, - stratigraphyColorMapAtom, - surfaceSetAddressAtom, - visualizationModeAtom, - wellboreAddressAtom, -} from "./settings/atoms/baseAtoms"; - -type SettingsToViewInterface = { - wellboreAddress: Wellbore | null; - surfaceSetAddress: SurfaceSetAddress | null; - visualizationMode: VisualizationMode; - stratigraphyColorMap: { [name: string]: string }; - statisticFunctions: StatisticFunction_api[]; - intersectionSettings: IntersectionSettings; -}; - -export type Interfaces = { - settingsToView: SettingsToViewInterface; -}; - -export const settingsToViewInterfaceInitialization: InterfaceInitialization = { - wellboreAddress: (get) => { - return get(wellboreAddressAtom); - }, - surfaceSetAddress: (get) => { - return get(surfaceSetAddressAtom); - }, - visualizationMode: (get) => { - return get(visualizationModeAtom); - }, - stratigraphyColorMap: (get) => { - return get(stratigraphyColorMapAtom); - }, - statisticFunctions: (get) => { - return get(statisticFunctionsAtom); - }, - intersectionSettings: (get) => { - return get(intersectionSettingsAtom); - }, -}; diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/loadModule.tsx b/frontend/src/modules/StructuralUncertaintyIntersection/loadModule.tsx deleted file mode 100644 index a7a99ca58..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/loadModule.tsx +++ /dev/null @@ -1,12 +0,0 @@ -import { ModuleRegistry } from "@framework/ModuleRegistry"; - -import { Interfaces, settingsToViewInterfaceInitialization } from "./interfaces"; -import { Settings } from "./settings/settings"; -import { View } from "./view"; - -const module = ModuleRegistry.initModule("StructuralUncertaintyIntersection", { - settingsToViewInterfaceInitialization, -}); - -module.viewFC = View; -module.settingsFC = Settings; diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/queryHooks.tsx b/frontend/src/modules/StructuralUncertaintyIntersection/queryHooks.tsx deleted file mode 100644 index e2fb307fa..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/queryHooks.tsx +++ /dev/null @@ -1,84 +0,0 @@ -import { SurfaceRealizationSampleValues_api } from "@api"; -import { apiService } from "@framework/ApiService"; -import { UseQueryResult, useQueries } from "@tanstack/react-query"; - -const STALE_TIME = 60 * 1000; -const CACHE_TIME = 60 * 1000; - -export type SurfacePolyLineSpec = { - x_points: number[]; - y_points: number[]; - cum_length: number[]; -}; - -export type SurfaceRealizationSampleValues = { - data: Array; - isFetching: boolean; -}; -export type SurfaceRealizationSampleValuesData = { - surfaceName: string; - realizationPoints: SurfaceRealizationSampleValues_api[]; -}; -export function useSampleSurfaceInPointsQueries( - caseUuid: string, - ensembleName: string, - surfaceNames: string[], - surfaceAttribute: string, - realizationNums: number[], - x_points: number[], - y_points: number[], - allowEnable: boolean -): SurfaceRealizationSampleValues { - const isEnabled = !!( - allowEnable && - caseUuid && - ensembleName && - surfaceNames.length > 0 && - surfaceAttribute && - realizationNums.length > 0 && - x_points.length > 0 && - y_points.length > 0 - ); - - return useQueries({ - queries: - (isEnabled && - surfaceNames.map((surfaceName: string) => { - const bodySamplePoints = { sample_points: { x_points, y_points } }; - const queryKey = [ - "postSampleSurfaceInPoints", - caseUuid, - ensembleName, - surfaceName, - surfaceAttribute, - realizationNums, - bodySamplePoints, - ]; - - return { - queryKey, - queryFn: () => { - return apiService.surface.postSampleSurfaceInPoints( - caseUuid, - ensembleName, - surfaceName, - surfaceAttribute, - realizationNums, - bodySamplePoints - ); - }, - staleTime: STALE_TIME, - gcTime: CACHE_TIME, - }; - })) || - [], - combine: (results: UseQueryResult>[]) => ({ - data: results.map((result, index) => ({ - surfaceName: surfaceNames[index] ?? "", - realizationPoints: result.data ?? [], - })), - - isFetching: results.some((result) => result.isFetching), - }), - }); -} diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/registerModule.ts b/frontend/src/modules/StructuralUncertaintyIntersection/registerModule.ts deleted file mode 100644 index 01b2f042d..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/registerModule.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { ModuleCategory, ModuleDevState } from "@framework/Module"; -import { ModuleDataTagId } from "@framework/ModuleDataTags"; -import { ModuleRegistry } from "@framework/ModuleRegistry"; -import { SyncSettingKey } from "@framework/SyncSettings"; - -import { Interfaces } from "./interfaces"; - -const description = "Visualization of structural uncertainty in an intersection"; - -ModuleRegistry.registerModule({ - moduleName: "StructuralUncertaintyIntersection", - defaultTitle: "Structural Uncertainty Intersection", - category: ModuleCategory.MAIN, - devState: ModuleDevState.DEV, - dataTagIds: [ModuleDataTagId.SURFACE, ModuleDataTagId.DRILLED_WELLS], - syncableSettingKeys: [SyncSettingKey.ENSEMBLE], - description, -}); diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/settings/atoms/baseAtoms.ts b/frontend/src/modules/StructuralUncertaintyIntersection/settings/atoms/baseAtoms.ts deleted file mode 100644 index a6c85fc5c..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/settings/atoms/baseAtoms.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { StatisticFunction_api } from "@api"; -import { Wellbore } from "@framework/types/wellbore"; -import { - IntersectionSettings, - SurfaceSetAddress, - VisualizationMode, -} from "@modules/StructuralUncertaintyIntersection/typesAndEnums"; - -import { atom } from "jotai"; - -export const wellboreAddressAtom = atom({ uwi: "55/33-A-4", uuid: "drogon_horizontal", type: "smda" }); -export const surfaceSetAddressAtom = atom(null); -export const visualizationModeAtom = atom(VisualizationMode.STATISTICAL_LINES); -export const statisticFunctionsAtom = atom([StatisticFunction_api.MEAN]); -export const stratigraphyColorMapAtom = atom<{ [name: string]: string }>({}); -export const intersectionSettingsAtom = atom({ extension: 1000, zScale: 5 }); diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/settings/components/intersectionSettings.tsx b/frontend/src/modules/StructuralUncertaintyIntersection/settings/components/intersectionSettings.tsx deleted file mode 100644 index 2109cf506..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/settings/components/intersectionSettings.tsx +++ /dev/null @@ -1,36 +0,0 @@ -import React from "react"; - -import { Input } from "@lib/components/Input"; -import { Label } from "@lib/components/Label"; - -import { IntersectionSettings } from "../../typesAndEnums"; - -type IntersectionSettingsProps = { - intersectionSettings: IntersectionSettings; - onChange: (intersectionSettings: IntersectionSettings) => void; -}; - -export const IntersectionSettingsSelect: React.FC = (props) => { - const handleExtensionChange = (e: any) => { - const extension = parseInt(e.target.value, 10); - if (extension >= 10) { - props.onChange({ ...props.intersectionSettings, extension }); - } - }; - const handleZScaleChange = (e: any) => { - const zScale = parseInt(e.target.value, 10); - if (zScale >= 0) { - props.onChange({ ...props.intersectionSettings, zScale }); - } - }; - return ( - <> - - - - ); -}; diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/settings/components/realizationsSelect.tsx b/frontend/src/modules/StructuralUncertaintyIntersection/settings/components/realizationsSelect.tsx deleted file mode 100644 index 1d34e9e3f..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/settings/components/realizationsSelect.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import React from "react"; - -import { Button } from "@lib/components/Button"; -import { Label } from "@lib/components/Label"; -import { Select } from "@lib/components/Select"; - -import { isEqual } from "lodash"; - -type RealizationsSelectProps = { - availableRealizations: number[] | null; - selectedRealizations: number[]; // Added as prop - onChange: (values: number[] | null) => void; -}; - -export const RealizationsSelect: React.FC = (props) => { - // Removed useState for selectedRealizations - - if (!isEqual(props.availableRealizations, props.selectedRealizations)) { - const newValues = - props.availableRealizations?.filter((value) => props.selectedRealizations.includes(value)) ?? []; - if (!isEqual(newValues, props.selectedRealizations)) { - props.onChange(newValues); - } - } - - const realOptions = props.availableRealizations?.map((real) => ({ label: `${real}`, value: `${real}` })) ?? []; - - const onChange = (values: string[]) => { - props.onChange(values.map((value) => parseInt(value))); - }; - - return ( - - - - - } - > -
- -
-
-
- - { - return { value: val, label: VisualizationModeEnumToStringMapping[val] }; - })} - onChange={handleVisualizationModeChange} - /> -
- -
-
- - - -
- ); -} - -function fixupSyncedOrSelectedOrFirstWellbore( - syncedWellbore: Wellbore | null, - selectedWellbore: Wellbore | null, - legalWellbores: Wellbore[] -): Wellbore | null { - const allUuids = legalWellbores.map((elm) => elm.uuid); - if (syncedWellbore && allUuids.includes(syncedWellbore.uuid)) { - return syncedWellbore; - } - if (selectedWellbore && allUuids.includes(selectedWellbore.uuid)) { - return selectedWellbore; - } - if (legalWellbores.length !== 0) { - return legalWellbores[0]; - } - return null; -} - -export function createStratigraphyColors(surfaceNames: string[], colorSet: ColorSet): StratigraphyColorMap { - const colorMap: StratigraphyColorMap = {}; - surfaceNames.forEach((surfaceName, index) => { - colorMap[surfaceName] = index === 0 ? colorSet.getFirstColor() : colorSet.getNextColor(); - }); - return colorMap; -} diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/state.ts b/frontend/src/modules/StructuralUncertaintyIntersection/state.ts deleted file mode 100644 index b6412c1ec..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/state.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { StatisticFunction_api } from "@api"; -import { Wellbore } from "@framework/types/wellbore"; - -import { IntersectionSettings, SurfaceSetAddress, VisualizationMode } from "./typesAndEnums"; - -export interface State { - wellboreAddress: Wellbore | null; - SurfaceSetAddress: SurfaceSetAddress | null; - visualizationMode: VisualizationMode; - stratigraphyColorMap: { [name: string]: string }; - statisticFunctions: StatisticFunction_api[]; - intersectionSettings: IntersectionSettings; -} diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/typesAndEnums.ts b/frontend/src/modules/StructuralUncertaintyIntersection/typesAndEnums.ts deleted file mode 100644 index c89108351..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/typesAndEnums.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { StatisticFunction_api } from "@api"; - -export type SeismicAddress = { - caseUuid: string; - ensemble: string; - realizationNumber: number; - attribute: string; - observed: boolean; - timeString?: string; -}; -export type SurfaceSetAddress = { - caseUuid: string; - ensembleName: string; - names: string[]; - attribute: string; - realizationNums: number[] | null; -}; - - -export type IntersectionSettings = { - extension: number; - zScale: number; -}; - -export const StatisticFunctionEnumToStringMapping = { - [StatisticFunction_api.MEAN]: "Mean", - [StatisticFunction_api.MIN]: "Min", - [StatisticFunction_api.MAX]: "Max", - [StatisticFunction_api.P10]: "P10", - [StatisticFunction_api.P50]: "P50", - [StatisticFunction_api.P90]: "P90", -}; - -export enum VisualizationMode { - INDIVIDUAL_REALIZATIONS = "IndividualRealizations", - STATISTICAL_LINES = "StatisticalLines", - STATISTICS_AND_REALIZATIONS = "StatisticsAndRealizations", -} -export const VisualizationModeEnumToStringMapping = { - [VisualizationMode.INDIVIDUAL_REALIZATIONS]: "Individual realizations", - [VisualizationMode.STATISTICAL_LINES]: "Statistical lines", - [VisualizationMode.STATISTICS_AND_REALIZATIONS]: "Statistics + Realizations", -}; -export type StratigraphyColorMap = { [name: string]: string }; diff --git a/frontend/src/modules/StructuralUncertaintyIntersection/view.tsx b/frontend/src/modules/StructuralUncertaintyIntersection/view.tsx deleted file mode 100644 index d4e0767ba..000000000 --- a/frontend/src/modules/StructuralUncertaintyIntersection/view.tsx +++ /dev/null @@ -1,134 +0,0 @@ -import React from "react"; - -import { IntersectionReferenceSystem, Trajectory } from "@equinor/esv-intersection"; -import { ModuleViewProps } from "@framework/Module"; -import { useViewStatusWriter } from "@framework/StatusWriter"; -import { useElementSize } from "@lib/hooks/useElementSize"; -import { - makeExtendedTrajectoryFromTrajectoryXyzPoints, - makeTrajectoryXyzPointsFromWellboreTrajectory, -} from "@modules/SeismicIntersection/utils/esvIntersectionDataConversion"; -import { useWellboreTrajectoriesQuery } from "@modules/_shared/WellBore/queryHooks"; -import { ContentError } from "@modules/_shared/components/ContentMessage"; -import { usePropagateApiErrorToStatusWriter } from "@modules/_shared/hooks/usePropagateApiErrorToStatusWriter"; - -import { isEqual } from "lodash"; - -import Legend from "./components/Legend"; -import { EsvIntersection } from "./components/esvIntersection"; -import { Interfaces } from "./interfaces"; -import { useSampleSurfaceInPointsQueries } from "./queryHooks"; - -export const View = ({ viewContext }: ModuleViewProps) => { - const wrapperDivRef = React.useRef(null); - const wrapperDivSize = useElementSize(wrapperDivRef); - - const statusWriter = useViewStatusWriter(viewContext); - - const surfaceSetAddress = viewContext.useSettingsToViewInterfaceValue("surfaceSetAddress"); - const visualizationMode = viewContext.useSettingsToViewInterfaceValue("visualizationMode"); - const statisticFunctions = viewContext.useSettingsToViewInterfaceValue("statisticFunctions"); - const wellboreAddress = viewContext.useSettingsToViewInterfaceValue("wellboreAddress"); - const intersectionSettings = viewContext.useSettingsToViewInterfaceValue("intersectionSettings"); - const stratigraphyColorMap = viewContext.useSettingsToViewInterfaceValue("stratigraphyColorMap"); - - // Extended wellbore trajectory for creating intersection/fence extended on both sides of wellbore - const [extendedWellboreTrajectory, setExtendedWellboreTrajectory] = React.useState(null); - - const [renderWellboreTrajectoryXyzPoints, setRenderWellboreTrajectoryXyzPoints] = React.useState( - null - ); - const width = wrapperDivSize.width; - const height = wrapperDivSize.height - 100; - - // Get well trajectories query - const getWellTrajectoriesQuery = useWellboreTrajectoriesQuery(wellboreAddress ? [wellboreAddress.uuid] : undefined); - usePropagateApiErrorToStatusWriter(getWellTrajectoriesQuery, statusWriter); - - // Use first trajectory and create polyline for seismic fence query, and extended wellbore trajectory for generating seismic fence image - - if (getWellTrajectoriesQuery.data && getWellTrajectoriesQuery.data.length !== 0) { - const trajectoryXyzPoints = makeTrajectoryXyzPointsFromWellboreTrajectory(getWellTrajectoriesQuery.data[0]); - const newExtendedWellboreTrajectory = makeExtendedTrajectoryFromTrajectoryXyzPoints( - trajectoryXyzPoints, - intersectionSettings.extension - ); - - // If the new extended trajectory is different, update the polyline, but keep the seismic fence image - if (!isEqual(newExtendedWellboreTrajectory, extendedWellboreTrajectory)) { - setExtendedWellboreTrajectory(newExtendedWellboreTrajectory); - } - - // When new well trajectory 3D points are loaded, update the render trajectory and clear the seismic fence image - if (!isEqual(trajectoryXyzPoints, renderWellboreTrajectoryXyzPoints)) { - setRenderWellboreTrajectoryXyzPoints(trajectoryXyzPoints); - } - } - - const x_points = extendedWellboreTrajectory?.points.map((coord) => coord[0]) ?? []; - const y_points = extendedWellboreTrajectory?.points.map((coord) => coord[1]) ?? []; - - const cum_length = extendedWellboreTrajectory - ? IntersectionReferenceSystem.toDisplacement( - extendedWellboreTrajectory.points, - extendedWellboreTrajectory.offset - ).map((coord) => coord[0] - intersectionSettings.extension) - : []; - - const sampleSurfaceInPointsQueries = useSampleSurfaceInPointsQueries( - surfaceSetAddress?.caseUuid ?? "", - surfaceSetAddress?.ensembleName ?? "", - surfaceSetAddress?.names ?? [], - surfaceSetAddress?.attribute ?? "", - surfaceSetAddress?.realizationNums ?? [], - x_points, - y_points, - true - ); - - statusWriter.setLoading(getWellTrajectoriesQuery.isFetching || sampleSurfaceInPointsQueries.isFetching); - // Build up an error string handling multiple errors. e.g. "Error loading well trajectories and seismic fence data" - // Do not useMemo - let errorString = ""; - if (getWellTrajectoriesQuery.isError) { - errorString += "Error loading well trajectories"; - } - - if (errorString !== "") { - statusWriter.addError(errorString); - } - const stratigraphyColorLegendItems = - surfaceSetAddress?.names.map((key) => { - return { color: stratigraphyColorMap[key], label: key }; - }) ?? []; - - return ( -
- {errorString !== "" ? ( - {errorString} - ) : ( - <> - -
- -
- - )} -
- ); -}; diff --git a/frontend/src/modules/registerAllModules.ts b/frontend/src/modules/registerAllModules.ts index 3b12c8256..7b692eb3a 100644 --- a/frontend/src/modules/registerAllModules.ts +++ b/frontend/src/modules/registerAllModules.ts @@ -13,7 +13,6 @@ import "./Rft/registerModule"; import "./SeismicIntersection/registerModule"; import "./SimulationTimeSeries/registerModule"; import "./SimulationTimeSeriesSensitivity/registerModule"; -import "./StructuralUncertaintyIntersection/registerModule"; import "./SubsurfaceMap/registerModule"; import "./TornadoChart/registerModule"; import "./WellCompletions/registerModule";