15
15
along with gempy. If not, see <http://www.gnu.org/licenses/>.
16
16
17
17
18
- @author: Alexander Schaaf
18
+ @author: Alexander Schaaf and Miguel de la Varga
19
19
"""
20
+ import gempy as gp
20
21
import numpy as np
21
22
from typing import List , Set , Tuple , Dict , Union , Optional
22
23
import matplotlib .pyplot as plt
23
24
24
25
25
26
def _get_nunconf (geo_model ) -> int :
26
- return np .count_nonzero (
27
- geo_model ._stack .df .BottomRelation == "Erosion"
28
- ) - 2 # TODO -2 n other lith series
27
+ return np .count_nonzero ( geo_model ._stack .df .BottomRelation == "Erosion" ) - 2 # TODO -2 n other lith series
29
28
30
29
31
30
def _get_nfaults (geo_model ) -> int :
32
31
return np .count_nonzero (geo_model ._faults .df .isFault )
33
32
34
33
35
- def _get_fb (geo_model ) -> np .ndarray :
36
- n_unconf = _get_nunconf (geo_model )
37
- n_faults = _get_nfaults (geo_model )
38
- return np .round (
39
- geo_model .solutions .block_matrix [n_unconf :n_faults + n_unconf , 0 , :]
40
- ).astype (int ).sum (axis = 0 ).reshape (* geo_model ._grid .regular_grid .resolution )
34
+ def _get_fault_blocks (geo_model : gp .data .GeoModel ) -> np .ndarray :
35
+ # n_unconf = _get_nunconf(geo_model)
36
+ # n_faults = _get_nfaults(geo_model)
41
37
38
+ fault_blocks = geo_model .solutions .raw_arrays .block_matrix [geo_model .structural_frame .group_is_fault ]
39
+ resolution = geo_model .solutions .octrees_output [- 1 ].grid_centers .regular_grid .resolution
42
40
43
- def _get_lb (geo_model ) -> np .ndarray :
44
- return np .round (
45
- geo_model .solutions .lith_block
46
- ).astype (int ).reshape (* geo_model ._grid .regular_grid .resolution )
41
+ int__sum_axis__reshape = np .round (fault_blocks ).astype (int ).sum (axis = 0 ).reshape (* resolution )
42
+ return int__sum_axis__reshape
43
+
44
+
45
+ def _get_lith_blocks (geo_model : gp .data .GeoModel ) -> np .ndarray :
46
+
47
+ lith_blocks = geo_model .solutions .raw_arrays .block_matrix [[not x for x in geo_model .structural_frame .group_is_fault ]]
48
+ resolution = geo_model .solutions .octrees_output [- 1 ].grid_centers .regular_grid .resolution
49
+
50
+ int__sum_axis__reshape = np .round (lith_blocks ).astype (int ).sum (axis = 0 ).reshape (* resolution )
51
+ return int__sum_axis__reshape
47
52
48
53
49
54
def compute_topology (
@@ -65,9 +70,9 @@ def compute_topology(
65
70
Returns:
66
71
edges, centroids [numpy array]: edges and centroids of the topology graph
67
72
"""
68
- res = geo_model ._grid .regular_grid .resolution
69
- fb = _get_fb (geo_model )
70
- lb = _get_lb (geo_model )
73
+ res = geo_model .grid .regular_grid .resolution
74
+ fb = _get_fault_blocks (geo_model )
75
+ lb = _get_lith_blocks (geo_model )
71
76
n_lith = len (np .unique (lb )) # ? quicker looking it up in geomodel?
72
77
73
78
if cell_number is None or direction is None :
@@ -431,8 +436,7 @@ def _get_centroids(labels: np.ndarray) -> dict:
431
436
labels (Array[int, ..., ..., ...]): Uniquely labeled block.
432
437
433
438
Returns:
434
- dict: Geobody node keys yield centroid coordinate tuples in array
435
- coordinates.
439
+ dict: Geobody node keys yield centroid coordinate tuples in array coordinates.
436
440
"""
437
441
node_locs = []
438
442
ulabels = np .unique (labels )
0 commit comments