22
33# Loop library
44from LoopStructural import GeologicalModel
5- from LoopStructural .modelling .intrusions import IntrusionNetwork
5+ from LoopStructural .modelling .intrusions import IntrusionFrameBuilder
66from LoopStructural .modelling .intrusions import IntrusionBuilder
7- from LoopStructural .modelling .intrusions import IntrusionBody
87from LoopStructural .modelling .intrusions import IntrusionFeature
98from LoopStructural .modelling .features import StructuralFrame
109from LoopStructural .modelling .intrusions import rectangle_function , parallelepiped_function
1110
1211from LoopStructural .datasets import load_tabular_intrusion
1312data , boundary_points = load_tabular_intrusion ()
1413
15- def test_intrusion_network ():
14+ def test_intrusion_freame_builder ():
1615 model = GeologicalModel (boundary_points [0 , :], boundary_points [1 , :])
1716 model .data = data
1817 model .nsteps = [10 ,10 ,10 ]
19-
18+
2019 intrusion_data = data [data ['feature_name' ] == 'tabular_intrusion' ]
20+ frame_data = model .data [model .data ["feature_name" ] == 'tabular_intrusion_frame' ].copy ()
21+
2122 conformable_feature = model .create_and_add_foliation ('stratigraphy' )
2223
23- INet = IntrusionNetwork (feature_data = intrusion_data ,
24- intrusion_network_contact = 'roof' ,
25- intrusion_network_type = 'shortest path' ,
26- model = model ,
27- )
28- delta_c = 2
29- INet .set_data ()
30- INet .set_contact_anisotropies ([conformable_feature ])
31- INet .set_sequence_of_exploited_anisotropies ([conformable_feature ])
32- INet .set_velocity_parameters ()
33- INet .set_sections_axis ('X' )
34- intrusion_network_points = INet .build (delta_c = [delta_c ])[:,:3 ]
35-
36- #test if points lie in the contact of interest
37-
38- mean = INet .anisotropies_series_parameters ['stratigraphy_0' ][1 ]
39- # mean = -10
40- stdv = INet .anisotropies_series_parameters ['stratigraphy_0' ][2 ]
41- evaluated_inet_points = conformable_feature ['feature' ].evaluate_value (model .scale (intrusion_network_points ))
24+ intrusion_network_parameters = {'type' : 'shortest path' ,
25+ 'contact' :'roof' ,
26+ 'delta_c' :[2 ],
27+ 'contact_anisotropies' : [conformable_feature ],
28+ 'shortest_path_sequence' :[conformable_feature ],
29+ 'shortest_path_axis' :'X' }
30+ delta_c = intrusion_network_parameters .get ('delta_c' )[0 ]
31+ # -- get variables for intrusion frame interpolation
32+ interpolatortype = "FDI"
33+ nelements = 1e2
34+ weights = [0 ,0 ,0 ]
35+ interpolator = model .get_interpolator (interpolatortype = interpolatortype )
36+
37+ intrusion_frame_builder = IntrusionFrameBuilder (
38+ interpolator , name = 'tabular_intrusion_frame' , model = model )
39+
40+ # -- create intrusion network
41+
42+ intrusion_frame_builder .set_intrusion_network_parameters (intrusion_data , intrusion_network_parameters )
43+ intrusion_network_geometry = intrusion_frame_builder .create_intrusion_network ()
44+
45+ keys = list (intrusion_frame_builder .anisotropies_series_parameters .keys ())
46+ # #test if points lie in the contact of interest
47+ mean = intrusion_frame_builder .anisotropies_series_parameters [keys [0 ]][1 ]
48+ # mean = -10
49+ stdv = intrusion_frame_builder .anisotropies_series_parameters [keys [0 ]][2 ]
50+ evaluated_inet_points = conformable_feature ['feature' ].evaluate_value (model .scale (intrusion_network_geometry [:,:3 ]))
4251
4352 assert np .all (np .logical_and ((mean - stdv * delta_c )<= evaluated_inet_points ,(mean + stdv * delta_c )>= evaluated_inet_points ))
4453
54+ # -- create intrusion frame using intrusion network points and flow/inflation measurements
55+ intrusion_frame_builder .set_intrusion_frame_data (frame_data , intrusion_network_geometry )
56+
57+ ## -- create intrusion frame
58+ intrusion_frame_builder .setup (
59+ nelements = nelements ,
60+ w2 = weights [0 ],
61+ w1 = weights [1 ],
62+ gxygz = weights [2 ],
63+ )
64+
65+ intrusion_frame = intrusion_frame_builder .frame
66+
67+ assert isinstance (intrusion_frame , StructuralFrame )
68+
69+
70+ def test_intrusion_builder ():
4571
46- def test_intrusion_body (lateral_conceptual_model , vertical_conceptual_model ):
4772 model = GeologicalModel (boundary_points [0 , :], boundary_points [1 , :])
4873 model .data = data
4974 model .nsteps = [10 ,10 ,10 ]
50-
75+
5176 intrusion_data = data [data ['feature_name' ] == 'tabular_intrusion' ]
77+ frame_data = model .data [model .data ["feature_name" ] == 'tabular_intrusion_frame' ].copy ()
78+
5279 conformable_feature = model .create_and_add_foliation ('stratigraphy' )
53-
54- # create intrusion network
55- INet = IntrusionNetwork (feature_data = intrusion_data ,
56- intrusion_network_contact = 'roof' ,
57- intrusion_network_type = 'interpolated' ,
58- model = model ,
59- )
6080
61- INet . set_data ()
62- intrusion_network_points = INet . build ( delta_c = [ 1e15 ])[:,: 3 ]
81+ intrusion_network_parameters = { 'type' : 'interpolated' ,
82+ 'contact' : 'roof' }
6383
64- weights = [0 ,0 ,0 ]
65- frame_data = model .data [model .data ["feature_name" ] == 'tabular_intrusion_frame' ].copy ()
66- interpolator = model .get_interpolator (interpolatortype = 'FDI' )
67- IFrame_builder = IntrusionBuilder (interpolator ,
68- model = model ,
69- feature_name = 'tabular_intrusion_frame' )
70-
71- IFrame_builder .set_data (frame_data , INet .intrusion_network_outcome )
72- IFrame_builder .setup (
73- nelements = 1e2 ,
74- w2 = weights [0 ],
75- w1 = weights [1 ],
76- w3 = weights [2 ],
77- )
84+ intrusion_frame_builder = IntrusionFrameBuilder (
85+ interpolator , name = 'tabular_intrusion_frame' , model = model )
86+
87+ # -- create intrusion network
88+
89+ intrusion_frame_builder .set_intrusion_network_parameters (intrusion_data , intrusion_network_parameters )
90+ intrusion_network_geometry = intrusion_frame_builder .create_intrusion_network ()
7891
79- IFrame = IFrame_builder . frame
80-
81- assert isinstance ( IFrame , StructuralFrame )
82-
83- IBody = IntrusionBody (
84- intrusion_data ,
85- name = 'tabular_intrusion' ,
86- intrusion_network = INet ,
87- intrusion_frame = IFrame ,
88- model = model ,
92+ # -- create intrusion frame using intrusion network points and flow/inflation measurements
93+ intrusion_frame_builder . set_intrusion_frame_data ( frame_data , intrusion_network_geometry )
94+
95+ ## -- create intrusion frame
96+ intrusion_frame_builder . setup ()
97+ intrusion_frame = intrusion_frame_builder . frame
98+
99+ # -- create intrusion builder to simulate distance thresholds along frame coordinates
100+ intrusion_builder = IntrusionBuilder (
101+ intrusion_frame , model = model , name = "tabular intrusion"
89102 )
103+ intrusion_builder .lateral_extent_model = rectangle_function #intrusion_lateral_extent_model
104+ intrusion_builder .vertical_extent_model = parallelepiped_function #intrusion_vertical_extent_model
105+
106+ intrusion_builder .set_data_for_extent_simulation (intrusion_data )
107+ intrusion_builder .build_arguments = {
108+ "lateral_extent_sgs_parameters" : {},
109+ "vertical_extent_sgs_parameters" : {}}
90110
111+ intrusion_feature = intrusion_builder .feature
112+ intrusion_builder .update ()
91113
92- IBody .set_data_for_s_simulation ()
93- IBody .set_lateral_extent_conceptual_model (lateral_conceptual_model )
94- IBody .set_s_simulation_GSLIBparameters ({})
95- IBody .make_s_simulation_variogram ({})
96- IBody .create_grid_for_simulation ()
97- IBody .simulate_s_thresholds ()
98-
99- assert len (IBody .simulated_s_thresholds ) > 0
100-
101- IBody .set_data_for_g_simulation ()
102- IBody .set_vertical_extent_conceptual_model (vertical_conceptual_model )
103- IBody .set_g_simulation_GSLIBparameters ({})
104- IBody .make_g_simulation_variogram ({})
105- IBody .simulate_g_thresholds ()
106-
107- assert len (IBody .simulated_g_thresholds ) > 0
114+ assert len (intrusion_feature ._lateral_simulated_thresholds ) > 0
115+ assert len (intrusion_feature ._growth_simulated_thresholds ) > 0
108116
0 commit comments