Skip to content

Commit a52ba43

Browse files
committed
Initial cleanup of parameters, still need to hookup topography_above_point method to convert input depth to elevation used by Plate objects
1 parent e431369 commit a52ba43

5 files changed

Lines changed: 14 additions & 164 deletions

File tree

simpeg_drivers-assets/uijson/plate_simulation.ui.json

Lines changed: 2 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -117,64 +117,13 @@
117117
"max": 360.0,
118118
"tooltip": "Direction of the dip vector in degrees from north"
119119
},
120-
"relative_locations": {
121-
"label": "Relative locations",
122-
"main": true,
123-
"group": "Plate",
124-
"value": true,
125-
"enabled": true,
126-
"tooltip": "If checked locations are relative to the survey centre and either topography or overburden in z according to 'Depth reference' selection"
127-
},
128-
"easting": {
129-
"label": "Easting (m)",
130-
"group": "Plate",
131-
"main": true,
132-
"value": 0.0,
133-
"enabled": true,
134-
"tooltip": "If relative locations, easting is relative to the centre of the survey"
135-
},
136-
"northing": {
137-
"label": "Northing (m)",
138-
"main": true,
139-
"group": "Plate",
140-
"value": 0.0,
141-
"enabled": true,
142-
"tooltip": "If relative locations, northing is relative to the centre of the survey"
143-
},
144120
"elevation": {
145-
"label": "Elevation (m)",
121+
"label": "Depth (m)",
146122
"main": true,
147123
"group": "Plate",
148124
"value": 0.0,
149125
"enabled": true,
150-
"tooltip": "If relative location, elevation is relative to the topography or overburden according to 'Depth reference' selection"
151-
},
152-
"reference_surface": {
153-
"label": "Depth reference",
154-
"main": true,
155-
"group": "Plate",
156-
"dependency": "relative_locations",
157-
"dependencyType": "enabled",
158-
"choiceList": [
159-
"topography",
160-
"overburden"
161-
],
162-
"tooltop": "If relative locations, the depth will be below the min/mean/max (according to 'Reference type') of the reference surface chosen.",
163-
"value": "overburden"
164-
},
165-
"reference_type": {
166-
"label": "Reference type",
167-
"main": true,
168-
"group": "Plate",
169-
"dependency": "relative_locations",
170-
"dependencyType": "enabled",
171-
"choiceList": [
172-
"min",
173-
"mean",
174-
"max"
175-
],
176-
"tooltip": "If relative locations, the depth will be below the min/mean/max of the 'Depth reference' chosen",
177-
"value": "min"
126+
"tooltip": "Depth below topography above the plate."
178127
},
179128
"generate_sweep": {
180129
"label": "Generate sweep file",

simpeg_drivers/plate_simulation/driver.py

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -126,19 +126,17 @@ def survey(self):
126126

127127
return self._survey
128128

129+
@property
130+
def topography(self) -> Surface | Points:
131+
return self.simulation_parameters.active_cells.topography_object
132+
129133
@property
130134
def plates(self) -> list[Plate]:
131135
"""Generate sequence of plates."""
132136
if self._plates is None:
133-
offset = (
134-
self.params.model.overburden_options.thickness
135-
if self.params.model.plate_options.reference_surface == "overburden"
136-
else 0.0
137-
)
138137
center = self.params.model.plate_options.center(
139138
self.survey,
140139
self.topography,
141-
depth_offset=-1 * offset,
142140
)
143141
plate = Plate(
144142
self.params.model.plate_options.geometry.model_copy(
@@ -157,10 +155,6 @@ def plates(self) -> list[Plate]:
157155
)
158156
return self._plates
159157

160-
@property
161-
def topography(self) -> Surface | Points:
162-
return self.simulation_parameters.active_cells.topography_object
163-
164158
@property
165159
def mesh(self) -> Octree:
166160
"""Returns an octree mesh built from mesh parameters."""

simpeg_drivers/plate_simulation/models/events.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from abc import ABC, abstractmethod
1212

1313
import numpy as np
14+
from geoapps_utils.modelling.plates import Plate
1415
from geoh5py.objects import Octree, Surface
1516
from geoh5py.shared.utils import find_unique_name
1617

@@ -163,7 +164,7 @@ class Anomaly(Event):
163164
:param name: Name of the event.
164165
"""
165166

166-
def __init__(self, body: Parametric, value: float, name: str = "Anomaly"):
167+
def __init__(self, body: Parametric | Plate, value: float, name: str = "Anomaly"):
167168
self.body = body
168169
super().__init__(value, name)
169170

simpeg_drivers/plate_simulation/models/options.py

Lines changed: 6 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,6 @@ class PlateOptions(BaseModel):
3636
:param geometry: Parameters describing the plate geometry.
3737
:param number: Number of offset plates to be created.
3838
:param spacing: Spacing between plates.
39-
:param relative_locations: If True locations are relative to survey in xy and
40-
mean topography in z.
41-
:param reference_surface: Switches between using topography and overburden as
42-
elevation reference of the plate.
43-
:param reference_type: Type of reference for plate elevation. Can be 'mean'
44-
'min', or 'max'. Resulting elevation will be relative to the mean,
45-
minimum, or maximum of the reference surface.
4639
"""
4740

4841
model_config = ConfigDict(arbitrary_types_allowed=True)
@@ -54,31 +47,17 @@ class PlateOptions(BaseModel):
5447
geometry: PlateModel
5548
number: int = 1
5649
spacing: float = 0.0
57-
relative_locations: bool = False
58-
reference_surface: str = "topography"
59-
reference_type: str = "mean"
60-
61-
@field_validator("reference_surface", "reference_type", mode="before")
62-
@classmethod
63-
def none_to_default(cls, value: T | None, info: ValidationInfo) -> T:
64-
return value or cls.model_fields[info.field_name].default # pylint: disable=unsubscriptable-object
6550

6651
@model_validator(mode="after")
6752
def single_plate(self):
6853
if self.number == 1:
6954
self.spacing = 0.0
7055
return self
7156

72-
@property
73-
def halfplate(self):
74-
"""Compute half the z-projection length of the plate."""
75-
return 0.5 * self.geometry.dip_length * np.sin(np.deg2rad(self.geometry.dip))
76-
7757
def center(
7858
self,
7959
survey: Points,
8060
surface: Points,
81-
depth_offset: float = 0.0,
8261
) -> tuple[float, float, float]:
8362
"""
8463
Find the plate center relative to a survey and topography.
@@ -87,36 +66,14 @@ def center(
8766
:param surface: Points-like object to reference plate depth from.
8867
:param depth_offset: Additional offset to be added to the depth of the plate.
8968
"""
90-
return *self._get_xy(survey), self._get_z(surface, depth_offset)
91-
92-
def _get_xy(self, survey: Points) -> tuple[float, float]:
93-
"""Return true or relative locations in x and y."""
9469

95-
if self.relative_locations:
96-
return (
97-
survey.vertices[:, 0].mean() + self.geometry.origin[0],
98-
survey.vertices[:, 1].mean() + self.geometry.origin[1],
99-
)
70+
xy = (
71+
survey.vertices[:, 0].mean() + self.geometry.origin[0],
72+
survey.vertices[:, 1].mean() + self.geometry.origin[1],
73+
)
74+
z_topo = topography_above_point(topography=surface, point=xy) # TODO
10075

101-
return self.geometry.origin[0], self.geometry.origin[1]
102-
103-
def _get_z(self, surface: Points, offset: float = 0.0) -> float:
104-
"""
105-
Return true or relative locations in z.
106-
107-
:param surface: Points-like object to reference plate depth from.
108-
:offset: Additional offset to be added to the depth.
109-
110-
"""
111-
if surface.vertices is None:
112-
raise ValueError("Topography object has no vertices.")
113-
if self.relative_locations:
114-
z = getattr(surface.vertices[:, 2], self.reference_type)()
115-
z += offset + self.geometry.elevation - self.halfplate
116-
else:
117-
z = self.geometry.elevation
118-
119-
return z
76+
return xy + (z_topo - self.geometry.elevation,)
12077

12178

12279
class OverburdenOptions(BaseModel):

simpeg_drivers/plate_simulation/uijson.py

Lines changed: 0 additions & 51 deletions
This file was deleted.

0 commit comments

Comments
 (0)