Skip to content

Commit 2701e4b

Browse files
authored
880 Data Provider Framework in Intersection Module (#948)
1 parent 3143b47 commit 2701e4b

File tree

116 files changed

+5619
-5621
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

116 files changed

+5619
-5621
lines changed

backend_py/primary/primary/routers/surface/router.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,7 @@ async def post_get_surface_intersection(
217217
real_num=realization_num, name=name, attribute=attribute, time_or_interval_str=time_or_interval_str
218218
)
219219
if surface is None:
220-
raise HTTPException(status_code=404, detail="Surface '{name}' not found")
220+
raise HTTPException(status_code=404, detail=f"Surface '{name}' not found")
221221

222222
# Ensure name is applied
223223
surface.name = name

backend_py/primary/primary/routers/well/converters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ def convert_wellbore_pick_to_schema(wellbore_pick: WellborePick) -> schemas.Well
4646
depthReferencePoint=wellbore_pick.depth_reference_point,
4747
mdUnit=wellbore_pick.md_unit,
4848
interpreter=wellbore_pick.interpreter,
49+
obsNo=wellbore_pick.obs_no,
4950
)
5051

5152

backend_py/primary/primary/routers/well/schemas.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class WellborePick(BaseModel):
5656
depthReferencePoint: str
5757
mdUnit: str
5858
interpreter: str | None
59+
obsNo: int
5960

6061

6162
class WellboreCompletion(BaseModel):

backend_py/primary/primary/services/smda_access/drogon/_drogon_well_data.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ def get_drogon_well_trajectories() -> List[WellboreTrajectory]:
6767
def get_drogon_well_picks() -> List[WellborePick]:
6868
return [
6969
WellborePick(
70+
obs_no=1,
7071
interpreter="DROGON_STAT",
7172
easting=462480.0,
7273
northing=5934232.0,
@@ -82,6 +83,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
8283
md_unit="m",
8384
),
8485
WellborePick(
86+
obs_no=1,
8587
interpreter="DROGON_STAT",
8688
easting=462480.0,
8789
northing=5934232.0,
@@ -97,6 +99,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
9799
md_unit="m",
98100
),
99101
WellborePick(
102+
obs_no=1,
100103
interpreter="DROGON_STAT",
101104
easting=462480.0,
102105
northing=5934232.0,
@@ -112,6 +115,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
112115
md_unit="m",
113116
),
114117
WellborePick(
118+
obs_no=1,
115119
interpreter="DROGON_STAT",
116120
easting=462480.0,
117121
northing=5934232.0,
@@ -127,6 +131,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
127131
md_unit="m",
128132
),
129133
WellborePick(
134+
obs_no=1,
130135
interpreter="DROGON_STAT",
131136
easting=462480.0,
132137
northing=5934232.0,
@@ -142,6 +147,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
142147
md_unit="m",
143148
),
144149
WellborePick(
150+
obs_no=1,
145151
interpreter="DROGON_STAT",
146152
easting=463256.9114,
147153
northing=5930542.2944,
@@ -157,6 +163,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
157163
md_unit="m",
158164
),
159165
WellborePick(
166+
obs_no=1,
160167
interpreter="DROGON_STAT",
161168
easting=464220.0686875976,
162169
northing=5932289.733486914,
@@ -172,6 +179,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
172179
md_unit="m",
173180
),
174181
WellborePick(
182+
obs_no=1,
175183
interpreter="DROGON_STAT",
176184
easting=463849.68880478514,
177185
northing=5931573.151211523,
@@ -187,6 +195,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
187195
md_unit="m",
188196
),
189197
WellborePick(
198+
obs_no=1,
190199
interpreter="DROGON_STAT",
191200
easting=464220.0686875976,
192201
northing=5932289.733486914,
@@ -202,6 +211,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
202211
md_unit="m",
203212
),
204213
WellborePick(
214+
obs_no=1,
205215
interpreter="DROGON_STAT",
206216
easting=463256.9114,
207217
northing=5930542.2944,
@@ -217,6 +227,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
217227
md_unit="m",
218228
),
219229
WellborePick(
230+
obs_no=1,
220231
interpreter="DROGON_FMU",
221232
easting=464220.0686875976,
222233
northing=5932289.733486914,
@@ -232,6 +243,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
232243
md_unit="m",
233244
),
234245
WellborePick(
246+
obs_no=1,
235247
interpreter="DROGON_STAT",
236248
easting=463849.68880478514,
237249
northing=5931573.151211523,
@@ -247,6 +259,7 @@ def get_drogon_well_picks() -> List[WellborePick]:
247259
md_unit="m",
248260
),
249261
WellborePick(
262+
obs_no=1,
250263
interpreter="DROGON_FMU",
251264
easting=464220.0686875976,
252265
northing=5932289.733486914,

backend_py/primary/primary/services/smda_access/types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class WellborePick(BaseModel):
2323
depth_reference_point: str
2424
md_unit: str
2525
interpreter: str | None
26+
obs_no: int
2627

2728

2829
class WellboreTrajectory(BaseModel):

frontend/src/api/autogen/types.gen.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1172,6 +1172,7 @@ export type WellborePick_api = {
11721172
depthReferencePoint: string;
11731173
mdUnit: string;
11741174
interpreter: string | null;
1175+
obsNo: number;
11751176
};
11761177

11771178
export type WellboreTrajectory_api = {
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1+
/**
2+
* Viewport type definition
3+
*
4+
* Viewport: [cx, cy, displacement]
5+
*
6+
* cx: x-coordinate of the center of the viewport
7+
* cy: y-coordinate of the center of the viewport
8+
* displacement: distance from the center of the viewport to the edge of the viewport in x-direction (horizontal width)
9+
*/
110
export type Viewport = [number, number, number];

frontend/src/lib/components/ToggleButton/toggleButton.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@ export type ToggleButtonProps = ButtonUnstyledProps & {
1414
function ToggleButtonComponent(props: ToggleButtonProps, ref: React.ForwardedRef<HTMLDivElement>) {
1515
const { active, onToggle, ...other } = props;
1616
const [isActive, setIsActive] = React.useState<boolean>(active);
17+
const [prevIsActive, setPrevIsActive] = React.useState<boolean>(active);
1718

1819
const buttonRef = React.useRef<HTMLButtonElement>(null);
1920
React.useImperativeHandle<HTMLButtonElement | null, HTMLButtonElement | null>(
2021
props.buttonRef,
2122
() => buttonRef.current,
2223
);
2324

25+
if (active !== prevIsActive) {
26+
setIsActive(active);
27+
setPrevIsActive(isActive);
28+
}
29+
2430
const handleClick = React.useCallback(() => {
2531
setIsActive(!isActive);
2632
onToggle(!active);

frontend/src/lib/utils/ColorSet.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
import type { ColorPalette } from "@lib/utils/ColorPalette";
1+
import type { ColorPaletteSerialization } from "@lib/utils/ColorPalette";
2+
import { ColorPalette } from "@lib/utils/ColorPalette";
3+
4+
export type ColorSetSerialization = {
5+
colorPalette: ColorPaletteSerialization;
6+
};
27

38
export class ColorSet {
49
private _colorPalette: ColorPalette;
@@ -50,4 +55,15 @@ export class ColorSet {
5055
this._runningIndex = (this._runningIndex + 1) % this._colorPalette.getColors().length;
5156
return color;
5257
}
58+
59+
serialize(): ColorSetSerialization {
60+
return {
61+
colorPalette: this._colorPalette.serialize(),
62+
};
63+
}
64+
65+
static fromSerialized(serialized: ColorSetSerialization): ColorSet {
66+
const colorPalette = ColorPalette.fromSerialized(serialized.colorPalette);
67+
return new ColorSet(colorPalette);
68+
}
5369
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
export function assertNonNull<T>(value: T | null | undefined, message?: string): T {
2+
if (value === null || value === undefined) {
3+
message = message || "Value cannot be null or undefined";
4+
throw new Error(message);
5+
}
6+
return value;
7+
}

0 commit comments

Comments
 (0)