|
| 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 | + model.interpolation_options.sigmoid_slope = 5_000_000 |
| 40 | + |
| 41 | + # Compute a solution for the model |
| 42 | + gp.compute_model( |
| 43 | + gempy_model=model, |
| 44 | + engine_config=gp.data.GemPyEngineConfig( |
| 45 | + backend=gp.data.AvailableBackends.numpy |
| 46 | + ) |
| 47 | + ) |
| 48 | + |
| 49 | + # Assert |
| 50 | + arrays = model.solutions.raw_arrays # * arrays is equivalent to gempy v2 solutions |
| 51 | + assert arrays.scalar_field_matrix.shape == (2, 250_000) # * 2 groups, 250000 points |
| 52 | + |
| 53 | + if PLOT: |
| 54 | + gpv = require_gempy_viewer() |
| 55 | + gpv.plot_2d( |
| 56 | + model=model, |
| 57 | + show_data=True, |
| 58 | + show_boundaries=False, |
| 59 | + show=True |
| 60 | + ) |
| 61 | + |
| 62 | + gpv.plot_2d( |
| 63 | + model=model, |
| 64 | + show_data=False, |
| 65 | + show_boundaries=False, |
| 66 | + show_scalar=True, |
| 67 | + show=True |
| 68 | + ) |
| 69 | + |
| 70 | + |
| 71 | + gpv.plot_2d( |
| 72 | + model=model, |
| 73 | + show_data=False, |
| 74 | + show_boundaries=False, |
| 75 | + show_scalar=True, |
| 76 | + series_n=1, |
| 77 | + show=True |
| 78 | + ) |
0 commit comments