|
| 1 | +import os |
| 2 | + |
| 3 | +import dotenv |
| 4 | + |
| 5 | +import gempy as gp |
| 6 | +from gempy.API.io_API import read_surface_points |
| 7 | + |
| 8 | + |
| 9 | +dotenv.load_dotenv() |
| 10 | + |
| 11 | +def test_2025_1(): |
| 12 | + |
| 13 | + path_to_data = os.getenv("TEST_DATA") |
| 14 | + |
| 15 | + data = { |
| 16 | + "a" : read_surface_points(f"{path_to_data}/a.dat"), |
| 17 | + "b" : read_surface_points(f"{path_to_data}/b.dat"), |
| 18 | + "c": read_surface_points(f"{path_to_data}/c.dat"), |
| 19 | + "d" : read_surface_points(f"{path_to_data}/d.dat"), |
| 20 | + "e": read_surface_points(f"{path_to_data}/e.dat"), |
| 21 | + "f" : read_surface_points(f"{path_to_data}/f.dat"), |
| 22 | + } |
| 23 | + |
| 24 | + color_generator = gp.data.ColorsGenerator() |
| 25 | + elements = [] |
| 26 | + for event, pts in data.items(): |
| 27 | + orientations = gp.data.OrientationsTable.initialize_empty() |
| 28 | + element = gp.data.StructuralElement( |
| 29 | + name=event, |
| 30 | + color=next(color_generator), |
| 31 | + surface_points=pts, |
| 32 | + orientations=orientations, |
| 33 | + ) |
| 34 | + elements.append(element) |
| 35 | + |
| 36 | + group = gp.data.StructuralGroup( |
| 37 | + name="Series1", |
| 38 | + elements=elements, |
| 39 | + structural_relation=gp.core.data.StackRelationType.ERODE, |
| 40 | + fault_relations=gp.core.data.FaultsRelationSpecialCase.OFFSET_FORMATIONS, |
| 41 | + ) |
| 42 | + structural_frame = gp.core.data.StructuralFrame( |
| 43 | + structural_groups=[group], color_gen=color_generator |
| 44 | + ) |
| 45 | + |
| 46 | + xmin = 525816 |
| 47 | + xmax = 543233 |
| 48 | + ymin = 5652470 |
| 49 | + ymax = 5657860 |
| 50 | + zmin = -780 |
| 51 | + zmax = -636 |
| 52 | + geo_model = gp.create_geomodel( |
| 53 | + project_name="test", |
| 54 | + extent=[xmin, xmax, ymin, ymax, zmin, zmax], |
| 55 | + refinement=4, |
| 56 | + structural_frame=structural_frame, |
| 57 | + ) |
| 58 | + gp.add_orientations( |
| 59 | + geo_model=geo_model, |
| 60 | + x=[525825], |
| 61 | + y=[5651315], |
| 62 | + z=[-686], |
| 63 | + pole_vector=[[0, 0, 1]], |
| 64 | + elements_names=["a"] |
| 65 | + ) |
| 66 | + solution = gp.compute_model( |
| 67 | + geo_model, |
| 68 | + engine_config=gp.data.GemPyEngineConfig( |
| 69 | + backend=gp.data.AvailableBackends.PYTORCH, |
| 70 | + use_gpu=True, |
| 71 | + ), |
| 72 | + ) |
| 73 | + |
0 commit comments