1414from geoh5py .objects import Points , Surface
1515
1616from simpeg_drivers .plate_simulation .models .options import PlateOptions
17+ from simpeg_drivers .utils .synthetics .driver import SyntheticsComponents
18+ from simpeg_drivers .utils .synthetics .options import (
19+ SurveyOptions ,
20+ SyntheticsComponentsOptions ,
21+ )
22+
23+
24+ def test_plate_options_center (tmp_path ):
25+ with Workspace (tmp_path / "test.geoh5" ) as workspace :
26+ components = SyntheticsComponents (
27+ geoh5 = workspace ,
28+ options = SyntheticsComponentsOptions (
29+ method = "gravity" ,
30+ refine_plate = True ,
31+ survey = SurveyOptions (
32+ center = (0.0 , 0.0 ), n_stations = 10 , n_lines = 10 , drape = 15.0
33+ ),
34+ ),
35+ )
36+
37+ params = PlateOptions (
38+ name = "my plate" ,
39+ plate_property = 1.0 ,
40+ geometry = PlateModel (
41+ strike_length = 40.0 ,
42+ dip_length = 80.0 ,
43+ width = 5.0 ,
44+ easting = 10.0 ,
45+ northing = - 10.0 ,
46+ elevation = 30.0 ,
47+ direction = 0.0 ,
48+ dip = 90.0 ,
49+ ),
50+ number = 1 ,
51+ spacing = 10.0 ,
52+ )
53+ center = params .center (components .survey , components .topography )
54+ assert np .allclose (center , [0.0 , 0.0 , 20 ], atol = 7e-1 )
1755
1856
1957def test_plate_params (tmp_path ):
@@ -27,16 +65,12 @@ def test_plate_params(tmp_path):
2765 width = 20.0 ,
2866 easting = 10.0 ,
2967 northing = 10.0 ,
30- elevation = - 100.0 ,
68+ elevation = 100.0 ,
3169 direction = 0.0 ,
3270 dip = 90.0 ,
3371 ),
34- reference = "center" ,
3572 number = 1 ,
3673 spacing = 10.0 ,
37- relative_locations = True ,
38- reference_surface = "topography" ,
39- reference_type = "mean" ,
4074 )
4175 assert params .spacing == 0.0
4276
@@ -53,33 +87,4 @@ def test_plate_params(tmp_path):
5387 )
5488
5589 center = params .center (survey , topography )
56- assert np .allclose (center , [0 , 0 , - 300 ])
57-
58- params .relative_locations = False
59- center = params .center (survey , topography )
60- assert np .allclose (center , [10 , 10 , - 100 ])
61-
62-
63- def test_plate_params_empty_reference ():
64- params = PlateOptions (
65- name = "my plate" ,
66- plate_property = 1.0 ,
67- geometry = PlateModel (
68- strike_length = 1500.0 ,
69- dip_length = 400.0 ,
70- width = 20.0 ,
71- easting = 10.0 ,
72- northing = 10.0 ,
73- elevation = - 100.0 ,
74- direction = 0.0 ,
75- dip = 90.0 ,
76- ),
77- reference = "center" ,
78- number = 1 ,
79- spacing = 10.0 ,
80- relative_locations = True ,
81- reference_surface = None ,
82- reference_type = None ,
83- )
84- assert params .reference_surface == "topography"
85- assert params .reference_type == "mean"
90+ assert np .allclose (center , [- 10.0 , - 10.0 , - 100 ])
0 commit comments