@@ -66,6 +66,178 @@ def test_loadGridCaseGroup(rips_instance, initialize_test):
6666 )
6767 assert grid_case_group is not None and grid_case_group .group_id == 0
6868
69+ project = rips_instance .project
70+ groups = project .grid_case_groups ()
71+ assert len (groups ) == 1
72+ looked_up = project .grid_case_group (grid_case_group .group_id )
73+ assert looked_up is not None
74+ assert looked_up .group_id == grid_case_group .group_id
75+ assert project .grid_case_group (9999 ) is None
76+
77+
78+ def test_save_project_round_trip (rips_instance , initialize_test ):
79+ case_path = dataroot .PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
80+ project = rips_instance .project
81+ project .load_case (case_path )
82+ assert len (project .cases ()) == 1
83+
84+ with tempfile .TemporaryDirectory (prefix = "rips" ) as tmpdirname :
85+ project_file = os .path .join (tmpdirname , "round_trip.rsp" )
86+ project .save (project_file )
87+ assert os .path .exists (project_file )
88+
89+ project .close ()
90+ assert len (rips_instance .project .cases ()) == 0
91+
92+ reopened = rips_instance .project .open (project_file )
93+ cases = reopened .cases ()
94+ assert len (cases ) == 1
95+ assert cases [0 ].name == "TEST10K_FLT_LGR_NNC"
96+
97+
98+ def test_views_and_view_lookup (rips_instance , initialize_test ):
99+ case_path = dataroot .PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
100+ case = rips_instance .project .load_case (case_path )
101+ case .create_view ()
102+
103+ project = rips_instance .project
104+ views = project .views ()
105+ assert len (views ) >= 1
106+
107+ first_view = views [0 ]
108+ looked_up = project .view (first_view .id )
109+ assert looked_up is not None
110+ assert looked_up .id == first_view .id
111+ assert project .view (999999 ) is None
112+
113+
114+ def test_well_path_by_name (rips_instance , initialize_test ):
115+ well_files = [dataroot .PATH + "/TEST10K_FLT_LGR_NNC/wellpath_a.dev" ]
116+ rips_instance .project .import_well_paths (well_path_files = well_files )
117+
118+ project = rips_instance .project
119+ well_path = project .well_path_by_name ("Well Path A" )
120+ assert well_path is not None
121+ assert well_path .name == "Well Path A"
122+ assert project .well_path_by_name ("Nonexistent Well Path" ) is None
123+
124+
125+ def test_plot_lookup (rips_instance , initialize_test ):
126+ project = rips_instance .project .open (
127+ dataroot .PATH + "/TEST10K_FLT_LGR_NNC/10KWithWellLog.rsp"
128+ )
129+ plots = project .plots ()
130+ assert len (plots ) >= 1
131+
132+ first_plot = plots [0 ]
133+ looked_up = project .plot (first_plot .id )
134+ assert looked_up is not None
135+ assert looked_up .id == first_plot .id
136+ assert project .plot (999999 ) is None
137+
138+
139+ def test_export_well_paths (rips_instance , initialize_test ):
140+ well_files = [dataroot .PATH + "/TEST10K_FLT_LGR_NNC/wellpath_a.dev" ]
141+ rips_instance .project .import_well_paths (well_path_files = well_files )
142+
143+ with tempfile .TemporaryDirectory (prefix = "rips" ) as tmpdirname :
144+ rips_instance .set_export_folder (export_type = "WELLPATHS" , path = tmpdirname )
145+ rips_instance .project .export_well_paths (
146+ well_paths = "Well Path A" , md_step_size = 10.0
147+ )
148+ exported = os .listdir (tmpdirname )
149+ assert any (name .endswith (".dev" ) for name in exported )
150+
151+
152+ def test_scale_fracture_template_and_set_containment (rips_instance , initialize_test ):
153+ project = rips_instance .project .open (
154+ dataroot .PATH + "/TEST10K_FLT_LGR_NNC/small-completion-export-fractures.rsp"
155+ )
156+ template = project .descendants (rips .FractureTemplate )[0 ]
157+ assert template .height_scale_factor == 1.0
158+ # The half-length scale factor uses the legacy keyword "WidthScaleFactor".
159+ assert template .width_scale_factor == 1.0
160+ assert template .d_factor_scale_factor == 1.0
161+ assert template .conductivity_factor == 1.0
162+
163+ project .scale_fracture_template (
164+ template_id = 0 , half_length = 2.0 , height = 3.0 , d_factor = 4.0 , conductivity = 5.0
165+ )
166+
167+ after_scale = project .descendants (rips .FractureTemplate )[0 ]
168+ assert after_scale .width_scale_factor == 2.0
169+ assert after_scale .height_scale_factor == 3.0
170+ assert after_scale .d_factor_scale_factor == 4.0
171+ assert after_scale .conductivity_factor == 5.0
172+
173+ project .set_fracture_containment (template_id = 0 , top_layer = 5 , base_layer = 10 )
174+
175+ # RimFractureContainment fields are not scriptable, so verify the change
176+ # made it through by saving the project and inspecting the .rsp XML.
177+ with tempfile .TemporaryDirectory (prefix = "rips" ) as tmpdirname :
178+ out_path = os .path .join (tmpdirname , "containment.rsp" )
179+ project .save (out_path )
180+ with open (out_path ) as rsp :
181+ content = rsp .read ()
182+ assert "<TopKLayer>5</TopKLayer>" in content
183+ assert "<BaseKLayer>10</BaseKLayer>" in content
184+
185+
186+ def test_summary_cases (rips_instance , initialize_test ):
187+ case_path = dataroot .PATH + "/flow_diagnostics_test/SIMPLE_SUMMARY2.SMSPEC"
188+ project = rips_instance .project
189+ assert project .summary_cases () == []
190+
191+ summary_case = project .import_summary_case (case_path )
192+ cases = project .summary_cases ()
193+ assert len (cases ) == 1
194+ assert cases [0 ].id == summary_case .id
195+
196+
197+ def test_import_formation_names (rips_instance , initialize_test ):
198+ case_path = dataroot .PATH + "/TEST10K_FLT_LGR_NNC/TEST10K_FLT_LGR_NNC.EGRID"
199+ case = rips_instance .project .load_case (case_path )
200+
201+ rips_instance .project .import_formation_names (
202+ formation_files = dataroot .PATH + "/20Layers.lyr"
203+ )
204+
205+ available = case .available_properties (rips .PropertyType .FORMATION_NAMES )
206+ assert "Active Formation Names" in available
207+
208+
209+ _MINIMAL_LAS = """~Version Information
210+ VERS. 2.0 : CWLS log ASCII Standard - VERSION 2.0
211+ WRAP. NO : One line per depth step
212+ ~Well Information
213+ #MNEM.UNIT Value Description
214+ #--------- ----------- ---------------
215+ STRT.M 1000.0 : Start Depth
216+ STOP.M 1002.0 : Stop Depth
217+ STEP.M 1.0 : Step
218+ NULL. -999.25 : Null Value
219+ WELL. RIPS_TEST : WELL
220+ ~Curve Information
221+ DEPT.M : Depth
222+ GR.GAPI : Gamma Ray
223+ ~ASCII
224+ 1000.0 50.0
225+ 1001.0 55.0
226+ 1002.0 60.0
227+ """
228+
229+
230+ def test_import_well_log_files (rips_instance , initialize_test ):
231+ with tempfile .TemporaryDirectory (prefix = "rips" ) as tmpdirname :
232+ las_path = os .path .join (tmpdirname , "rips_test.las" )
233+ with open (las_path , "w" ) as las_file :
234+ las_file .write (_MINIMAL_LAS )
235+
236+ well_path_names = rips_instance .project .import_well_log_files (
237+ well_log_folder = tmpdirname
238+ )
239+ assert "RIPS_TEST" in well_path_names
240+
69241
70242def test_exportSnapshots (rips_instance , initialize_test ):
71243 if not rips_instance .is_gui ():
0 commit comments