|
| 1 | +import gempy as gp |
| 2 | +from gempy.optional_dependencies import require_gempy_viewer |
| 3 | +from gempy.core.data.enumerators import ExampleModel |
| 4 | +from gempy.core.data.grid_modules import RegularGrid |
| 5 | +import numpy as np |
| 6 | + |
| 7 | +PLOT = True |
| 8 | + |
| 9 | + |
| 10 | +def test_outliers_model_1(): |
| 11 | + # Path to input data |
| 12 | + data_path = "https://raw.githubusercontent.com/cgre-aachen/gempy_data/master/" |
| 13 | + path_to_data = data_path + "/data/input_data/video_tutorials_v3/" |
| 14 | + |
| 15 | + # Create instance of geomodel |
| 16 | + model = gp.create_geomodel( |
| 17 | + project_name='tutorial_model_onlap_1', |
| 18 | + extent=[0, 2000, 0, 1000, 0, 1000], |
| 19 | + resolution=[100, 50, 50], |
| 20 | + importer_helper=gp.data.ImporterHelper( |
| 21 | + path_to_orientations=path_to_data + "tutorial_model_onlap_1_orientations.csv?cache=", |
| 22 | + path_to_surface_points=path_to_data + "tutorial_model_onlap_1_surface_points.csv?cache=" |
| 23 | + ) |
| 24 | + ) |
| 25 | + |
| 26 | + # Map geological series to surfaces |
| 27 | + gp.map_stack_to_surfaces( |
| 28 | + gempy_model=model, |
| 29 | + mapping_object={ |
| 30 | + "Young_Series": ("basin_fill_2", "basin_fill_1"), |
| 31 | + "Old_Series": ("basin_top", "basin_bottom") |
| 32 | + } |
| 33 | + ) |
| 34 | + |
| 35 | + # Set the relation of the youngest group to Onlap |
| 36 | + from gempy_engine.core.data.stack_relation_type import StackRelationType |
| 37 | + model.structural_frame.structural_groups[0].structural_relation = StackRelationType.ONLAP |
| 38 | + |
| 39 | + # Compute a solution for the model |
| 40 | + gp.compute_model(model) |
| 41 | + |
| 42 | + # Assert |
| 43 | + arrays = model.solutions.raw_arrays # * arrays is equivalent to gempy v2 solutions |
| 44 | + assert arrays.scalar_field_matrix.shape == (2, 250_000) # * 2 groups, 250000 points |
| 45 | + |
| 46 | + if PLOT: |
| 47 | + gpv = require_gempy_viewer() |
| 48 | + gpv.plot_2d( |
| 49 | + model=model, |
| 50 | + show_data=False, |
| 51 | + show_boundaries=False, |
| 52 | + show=True |
| 53 | + ) |
0 commit comments