Skip to content

Commit 176c6f6

Browse files
authored
[BUG] Outliers in gempy v3 (#1009)
# Description Since the release of gempy v3 we noticed some outliers in the lithology block. These are basically single cells that have a wrong element ID in the lithology block. They generally appear close to surface boundaries and are appearing depending on resolution. This might be caused when mapping sclar field values to int for the lithology block. As I don't think the isse is related to Octrees or DC I opened a new pull request. This issue will cause problems when reintroducing MC as a meshing approach in #1000 and #1006 . For now I added a single example as a test (see screenshot). I will add more examples whe I come across them and have time. ![image](https://github.com/user-attachments/assets/5703b874-c566-4f7a-9771-bdaa2db7e2de) # Checklist - [ ] My code uses type hinting for function and method arguments and return values. - [x] I have created tests which cover my code. - [x] The test code either 1. demonstrates at least one valuable use case (e.g. integration tests) or 2. verifies that outputs are as expected for given inputs (e.g. unit tests). - [ ] New tests pass locally with my changes.
2 parents 96bc2bf + a33628c commit 176c6f6

File tree

3 files changed

+78
-0
lines changed

3 files changed

+78
-0
lines changed

test/test_QA/__init__.py

Whitespace-only changes.

test/test_QA/test_chuncking.py

Whitespace-only changes.

test/test_modules/test_outliers.py

+78
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
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

Comments
 (0)