LoopStructural 1.0.3__zip → 1.0.71.dev0__zip
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__init__.py +12 -7
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__pycache__/_base.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__init__.py +3 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/base_structured_3d_support.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_fold_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/finite_difference_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/geological_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/operator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/piecewiselinear_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_grid.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_tetra.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/surfe_wrapper.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/base_structured_3d_support.py +101 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.c +4137 -2716
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.cp36-win_amd64.pyd +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/discrete_fold_interpolator.py +56 -22
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/discrete_interpolator.py +61 -28
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/finite_difference_interpolator.py +71 -11
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/geological_interpolator.py +22 -3
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/operator.py +16 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/piecewiselinear_interpolator.py +150 -11
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/structured_grid.py +31 -69
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/structured_tetra.py +89 -45
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/surfe_wrapper.py +7 -8
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/geological_model.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/geological_model_graph.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/stratigraphic_column.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/geological_model.py +515 -197
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/geological_model_graph.py +881 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/stratigraphic_column.py +5 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__init__.py +1 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_segment.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_builder.py +127 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_function.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_function_feature.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_segment.py +30 -3
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__init__.py +1 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/cross_product_geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/lambda_geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/region_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/unconformity_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/cross_product_geological_feature.py +18 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/geological_feature.py +22 -49
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/geological_feature_builder.py +171 -47
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/lambda_geological_feature.py +31 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/region_feature.py +3 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/structural_frame.py +28 -11
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/structural_frame_builder.py +32 -22
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/unconformity_feature.py +6 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/foldframe.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/svariogram.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold.py +13 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold_rotation_angle.py +5 -4
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold_rotation_angle_feature.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/foldframe.py +7 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/svariogram.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__init__.py +5 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/bounding_box.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/exceptions.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/helper.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/logging.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/map2loop.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/regions.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/utils.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/bounding_box.py +21 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/exceptions.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/helper.py +10 -2
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/logging.py +60 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/map2loop.py +128 -37
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/regions.py +11 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/utils.py +40 -47
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/map_viewer.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_plotter.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_visualisation.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/rotation_angle_plotter.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/sphinx_scraper.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/stratigraphic_column.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/map_viewer.py +236 -36
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/model_plotter.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/model_visualisation.py +427 -79
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/rotation_angle_plotter.py +29 -12
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/stratigraphic_column.py +60 -0
- Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.3-py3.6.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/PKG-INFO +1 -1
- Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.3-py3.6.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/SOURCES.txt +10 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.71.dev0-py3.6.egg-info/requires.txt +8 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.3-py3.6.egg-info/requires.txt +0 -3
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_faults.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_fold.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_refolded.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/test_faults.py +0 -17
- Miniconda/envs/loop/Lib/site-packages/tests/test_fold.py +0 -57
- Miniconda/envs/loop/Lib/site-packages/tests/test_interpolator.py +0 -88
- Miniconda/envs/loop/Lib/site-packages/tests/test_refolded.py +0 -22
- /Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.3-py3.6.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/dependency_links.txt +0 -0
- /Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.3-py3.6.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/top_level.txt +0 -0
|
@@ -3,14 +3,15 @@ import logging
|
|
|
3
3
|
import matplotlib.pyplot as plt
|
|
4
4
|
import numpy as np
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
from LoopStructural.utils import getLogger
|
|
7
|
+
logger = getLogger(__name__)
|
|
7
8
|
|
|
8
9
|
|
|
9
10
|
class MapView:
|
|
10
11
|
"""
|
|
11
12
|
|
|
12
13
|
"""
|
|
13
|
-
def __init__(self, model = None, bounding_box=
|
|
14
|
+
def __init__(self, model = None, bounding_box=np.zeros((2,2)), nsteps=None, ax = None, **kwargs):
|
|
14
15
|
"""
|
|
15
16
|
|
|
16
17
|
Parameters
|
|
@@ -20,61 +21,173 @@ class MapView:
|
|
|
20
21
|
nsteps - number of cells
|
|
21
22
|
kwargs
|
|
22
23
|
"""
|
|
23
|
-
|
|
24
|
-
self.
|
|
24
|
+
|
|
25
|
+
self.xx = None
|
|
26
|
+
self.yy = None
|
|
27
|
+
|
|
28
|
+
self._bounding_box = bounding_box
|
|
29
|
+
self._nsteps = nsteps
|
|
30
|
+
if self._nsteps is not None and self._bounding_box is not None:
|
|
31
|
+
self._update_grid()
|
|
25
32
|
if model is not None:
|
|
26
|
-
self.
|
|
27
|
-
self.
|
|
33
|
+
#make sure self._nsteps is 2d
|
|
34
|
+
self.model = model
|
|
35
|
+
self.ax = ax
|
|
36
|
+
if self.ax is None:
|
|
37
|
+
fig, self.ax = plt.subplots(1, figsize=(10, 10))
|
|
38
|
+
self.ax.set_aspect('equal', adjustable='box')
|
|
39
|
+
|
|
40
|
+
# set plot limits to model bounding box
|
|
41
|
+
self._xmin = self.bounding_box[0,0]
|
|
42
|
+
self._xmax = self.bounding_box[1,0]
|
|
43
|
+
self._ymin = self.bounding_box[0,1]
|
|
44
|
+
self._ymax = self.bounding_box[1,1]
|
|
45
|
+
self._update_plot_limits()
|
|
46
|
+
@property
|
|
47
|
+
def model(self):
|
|
48
|
+
return self._model
|
|
49
|
+
|
|
50
|
+
@model.setter
|
|
51
|
+
def model(self,model):
|
|
52
|
+
if model is not None:
|
|
53
|
+
bb = np.array([model.origin[:2],model.maximum[:2]])
|
|
54
|
+
self.bounding_box = bb#model.bounding_box
|
|
55
|
+
self.nsteps = model.nsteps[:2]
|
|
56
|
+
self._model = model
|
|
57
|
+
self._update_grid()
|
|
58
|
+
|
|
59
|
+
@property
|
|
60
|
+
def nsteps(self):
|
|
61
|
+
return self._nsteps
|
|
62
|
+
|
|
63
|
+
@nsteps.setter
|
|
64
|
+
def nsteps(self,nsteps):
|
|
65
|
+
if len(nsteps) != 2:
|
|
66
|
+
logger.error("Can't update nsteps, needs to be 2D")
|
|
67
|
+
return
|
|
68
|
+
self._nsteps = nsteps
|
|
69
|
+
self._update_grid()
|
|
70
|
+
|
|
71
|
+
@property
|
|
72
|
+
def bounding_box(self):
|
|
73
|
+
return self._bounding_box
|
|
74
|
+
@bounding_box.setter
|
|
75
|
+
def bounding_box(self,bounding_box):
|
|
76
|
+
self._bounding_box = bounding_box
|
|
77
|
+
self._update_grid()
|
|
28
78
|
|
|
79
|
+
@property
|
|
80
|
+
def xmin(self):
|
|
81
|
+
return self._xmin
|
|
82
|
+
|
|
83
|
+
@xmin.setter
|
|
84
|
+
def xmin(self,xmin):
|
|
85
|
+
self._xmin = xmin
|
|
86
|
+
self._update_plot_limits()
|
|
87
|
+
|
|
88
|
+
@property
|
|
89
|
+
def xmax(self):
|
|
90
|
+
return self._xmax
|
|
91
|
+
|
|
92
|
+
@xmax.setter
|
|
93
|
+
def xmax(self,xmax):
|
|
94
|
+
self._xmax = xmax
|
|
95
|
+
self._update_plot_limits()
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def ymin(self):
|
|
99
|
+
return self._ymin
|
|
100
|
+
|
|
101
|
+
@ymin.setter
|
|
102
|
+
def ymin(self,ymin):
|
|
103
|
+
self._ymin = ymin
|
|
104
|
+
self._update_plot_limits()
|
|
105
|
+
|
|
106
|
+
@property
|
|
107
|
+
def ymax(self):
|
|
108
|
+
return self._ymax
|
|
109
|
+
|
|
110
|
+
@ymax.setter
|
|
111
|
+
def ymax(self,ymax):
|
|
112
|
+
self._ymax = ymax
|
|
113
|
+
self._update_plot_limits()
|
|
114
|
+
|
|
115
|
+
def _update_plot_limits(self):
|
|
116
|
+
self.ax.set_xlim([self._xmin,self._xmax])
|
|
117
|
+
self.ax.set_ylim([self._ymin,self._ymax])
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def _update_grid(self):
|
|
121
|
+
"""Internal function to update the current grid when the bounding box
|
|
122
|
+
or number of steps changes
|
|
123
|
+
"""
|
|
124
|
+
if self.nsteps is None or self.bounding_box is None:
|
|
125
|
+
return
|
|
29
126
|
x = np.linspace(self.bounding_box[0,0], self.bounding_box[1,0], self.nsteps[0])
|
|
30
127
|
y = np.linspace(self.bounding_box[0,1], self.bounding_box[1,1], self.nsteps[1])
|
|
31
128
|
self.xx, self.yy = np.meshgrid(x, y, indexing='ij')
|
|
32
129
|
self.xx = self.xx.flatten()
|
|
33
130
|
self.yy = self.yy.flatten()
|
|
34
|
-
self.ax = ax
|
|
35
|
-
if self.ax is None:
|
|
36
|
-
fig, self.ax = plt.subplots(1, figsize=(10, 10))
|
|
37
131
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def add_data(self, feature, val=True, grad=True, **kwargs):
|
|
132
|
+
def add_data(self, feature, val=True, grad=True, unfault=False, dip=True, **kwargs):
|
|
41
133
|
"""
|
|
42
134
|
Adds the data associated to the feature to the plot
|
|
43
135
|
Parameters
|
|
44
136
|
----------
|
|
45
|
-
feature
|
|
137
|
+
feature : GeologicalFeature
|
|
138
|
+
the feature whose data you want to add
|
|
139
|
+
val : bool
|
|
140
|
+
whether to add value data
|
|
141
|
+
grad : bool
|
|
142
|
+
whether to add gradient data
|
|
143
|
+
unfault : bool
|
|
144
|
+
plot points in their restored location
|
|
145
|
+
dip : bool
|
|
146
|
+
whether to annotate the dip, default False
|
|
147
|
+
|
|
46
148
|
kwargs are passed to matplotlib functions and draw strike
|
|
47
149
|
Returns
|
|
48
150
|
-------
|
|
49
151
|
|
|
50
152
|
"""
|
|
51
|
-
|
|
153
|
+
# logger.warning("Plotting restored data locations")
|
|
52
154
|
ori_data = []
|
|
53
|
-
gradient_data = feature.
|
|
155
|
+
gradient_data = feature.builder.get_gradient_constraints()
|
|
156
|
+
if unfault:
|
|
157
|
+
gradient_data = feature.interpolator.get_gradient_constraints()
|
|
158
|
+
|
|
54
159
|
if gradient_data.shape[0] > 0:
|
|
55
160
|
ori_data.append(gradient_data)
|
|
56
|
-
norm_data = feature.
|
|
161
|
+
norm_data = feature.builder.get_norm_constraints()
|
|
162
|
+
if unfault:
|
|
163
|
+
norm_data = feature.interpolator.get_norm_constraints()
|
|
164
|
+
|
|
57
165
|
if norm_data.shape[0] > 0:
|
|
58
166
|
ori_data.append(norm_data)
|
|
59
167
|
cmap = kwargs.pop('cmap','rainbow')
|
|
60
168
|
# if single colour then specify kwarg, otherwise use point value
|
|
61
169
|
if val:
|
|
62
|
-
value_data = feature.
|
|
170
|
+
value_data = np.copy(feature.builder.get_value_constraints())
|
|
171
|
+
if unfault:
|
|
172
|
+
value_data = np.copy(feature.interpolator.get_value_constraints())
|
|
173
|
+
|
|
174
|
+
value_data[:,:3] = self.model.rescale(value_data[:,:3],inplace=False)
|
|
63
175
|
point_colour = kwargs.pop('point_colour',None)
|
|
64
176
|
if point_colour is None:
|
|
65
177
|
self.ax.scatter(value_data[:, 0], value_data[:, 1], c=value_data[:,3],
|
|
66
178
|
vmin=feature.min(), vmax=feature.max(),cmap=cmap)
|
|
67
179
|
if point_colour is not None:
|
|
68
180
|
self.ax.scatter(value_data[:, 0], value_data[:, 1], c=point_colour)
|
|
69
|
-
# points = strati.interpolator.get_gradient_control()
|
|
70
181
|
if grad:
|
|
71
182
|
symb_colour = kwargs.pop('symb_colour','black')
|
|
183
|
+
symb_scale=kwargs.pop('symb_scale',1.)
|
|
72
184
|
gradient_data = np.hstack(ori_data)
|
|
185
|
+
gradient_data[:,:3] = self.model.rescale(gradient_data[:,:3],inplace=False)
|
|
73
186
|
gradient_data[:, 3:5] /= np.linalg.norm(gradient_data[:, 3:5], axis=1)[:, None]
|
|
74
187
|
t = gradient_data[:, [4, 3]] * np.array([1, -1]).T
|
|
75
188
|
n = gradient_data[:, 3:5]
|
|
76
|
-
t *=
|
|
77
|
-
n *= 0.
|
|
189
|
+
t *= symb_scale
|
|
190
|
+
n *= 0.5*symb_scale
|
|
78
191
|
p1 = gradient_data[:, [0, 1]] - t
|
|
79
192
|
p2 = gradient_data[:, [0, 1]] + t
|
|
80
193
|
# plt.scatter(val[:,0],val[:,1],c='black')
|
|
@@ -82,19 +195,33 @@ class MapView:
|
|
|
82
195
|
p1 = gradient_data[:, [0, 1]]
|
|
83
196
|
p2 = gradient_data[:, [0, 1]] + n
|
|
84
197
|
self.ax.plot([p1[:, 0], p2[:, 0]], [p1[:, 1], p2[:, 1]], symb_colour)
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
198
|
+
if dip:
|
|
199
|
+
dip_v = np.rad2deg(np.arccos(gradient_data[:,5])).astype(int)
|
|
200
|
+
for d, xy, v in zip(dip_v,gradient_data[:,:2],gradient_data[:,3:6]):
|
|
201
|
+
self.ax.annotate(d,xy,xytext=xy+v[:2]*.03,fontsize='small')
|
|
202
|
+
|
|
203
|
+
def add_fault_ellipse(self, faults=None, **kwargs):
|
|
204
|
+
from matplotlib.patches import Ellipse
|
|
205
|
+
for k, f in self.model.stratigraphic_column['faults'].items():
|
|
206
|
+
center = self.model.rescale(f['FaultCenter'])
|
|
207
|
+
e = Ellipse((center[0],center[1]),
|
|
208
|
+
f['HorizontalRadius']*2,
|
|
209
|
+
f['InfluenceDistance']*2,
|
|
210
|
+
360-f['FaultDipDirection'],
|
|
211
|
+
facecolor='None',edgecolor='k')
|
|
212
|
+
|
|
213
|
+
self.ax.add_patch(e)
|
|
90
214
|
|
|
91
215
|
def add_scalar_field(self, feature, z=0, **kwargs):
|
|
92
216
|
"""
|
|
93
|
-
|
|
217
|
+
Plot the scalar field value on a map
|
|
218
|
+
|
|
94
219
|
Parameters
|
|
95
220
|
----------
|
|
96
|
-
feature
|
|
97
|
-
|
|
221
|
+
feature : GeologicalFeature
|
|
222
|
+
which feature to plot on the map
|
|
223
|
+
z : double/np.array
|
|
224
|
+
height
|
|
98
225
|
kwargs
|
|
99
226
|
|
|
100
227
|
Returns
|
|
@@ -103,20 +230,93 @@ class MapView:
|
|
|
103
230
|
"""
|
|
104
231
|
zz = np.zeros(self.xx.shape)
|
|
105
232
|
zz[:] = z
|
|
106
|
-
v = feature.evaluate_value(np.array([self.xx, self.yy, zz]).T)
|
|
107
|
-
self.ax.imshow(v.reshape(self.nsteps).T,
|
|
233
|
+
v = feature.evaluate_value(self.model.scale(np.array([self.xx, self.yy, zz]).T,inplace=False))
|
|
234
|
+
return self.ax.imshow(v.reshape(self.nsteps).T,
|
|
108
235
|
extent=[self.bounding_box[0,0], self.bounding_box[1,0], self.bounding_box[0,1],
|
|
109
236
|
self.bounding_box[1,1]],
|
|
110
237
|
vmin=feature.min(), vmax=feature.max(),
|
|
238
|
+
origin='lower',
|
|
111
239
|
**kwargs)
|
|
112
240
|
|
|
113
|
-
def add_contour(self, feature, values, z=0):
|
|
241
|
+
def add_contour(self, feature, values, z=0, mask = None, **kwargs):
|
|
242
|
+
"""Add an isoline of a scalar field to the map
|
|
243
|
+
|
|
244
|
+
Parameters
|
|
245
|
+
----------
|
|
246
|
+
feature : GeologicalFeature
|
|
247
|
+
the feature to isosurface
|
|
248
|
+
values : list
|
|
249
|
+
list of values to contour
|
|
250
|
+
z : double/np.array, optional
|
|
251
|
+
elevation of map, by default 0
|
|
252
|
+
"""
|
|
114
253
|
zz = np.zeros(self.xx.shape)
|
|
115
254
|
zz[:] = z
|
|
116
|
-
v = feature.evaluate_value(np.array([self.xx, self.yy, zz]).T)
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
255
|
+
v = feature.evaluate_value(self.model.scale(np.array([self.xx, self.yy, zz]).T,inplace=False))
|
|
256
|
+
if mask:
|
|
257
|
+
maskv = mask(self.model.scale(np.array([self.xx, self.yy, zz]).T,inplace=False))
|
|
258
|
+
v[~maskv] = np.nan
|
|
259
|
+
return self.ax.contour(v.reshape(self.nsteps).T,extent=[self.bounding_box[0,0], self.bounding_box[1,0], self.bounding_box[0,1],
|
|
260
|
+
self.bounding_box[1,1]],origin='lower',levels=values,**kwargs
|
|
120
261
|
)
|
|
121
262
|
|
|
122
|
-
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def add_model(self, z = 0,cmap=None):
|
|
266
|
+
"""Plot the model onto a map
|
|
267
|
+
|
|
268
|
+
Parameters
|
|
269
|
+
----------
|
|
270
|
+
z : int/numpy array, optional
|
|
271
|
+
height of the map surface (could also be a dem), by default 0
|
|
272
|
+
cmap : str/matplotlib colourmap, optional
|
|
273
|
+
specify a colour map, by default 'tab20'
|
|
274
|
+
"""
|
|
275
|
+
if cmap is None:
|
|
276
|
+
import matplotlib.colors as colors
|
|
277
|
+
colours = []
|
|
278
|
+
boundaries = []
|
|
279
|
+
data = []
|
|
280
|
+
for g in self.model.stratigraphic_column.keys():
|
|
281
|
+
if g == 'faults':
|
|
282
|
+
continue
|
|
283
|
+
for u, v in self.model.stratigraphic_column[g].items():
|
|
284
|
+
data.append((v['id'],v['colour']))
|
|
285
|
+
colours.append(v['colour'])
|
|
286
|
+
boundaries.append(v['id'])#print(u,v)
|
|
287
|
+
cmap = colors.ListedColormap(colours)
|
|
288
|
+
|
|
289
|
+
zz = np.zeros_like(self.xx)
|
|
290
|
+
zz[:] = z#self.bounding_box[1,2]
|
|
291
|
+
pts = np.vstack([self.xx.flatten(),self.yy.flatten(),zz.flatten()])
|
|
292
|
+
if self.model is None:
|
|
293
|
+
logger.error("Mapview needs a model assigned to plot model on map")
|
|
294
|
+
return
|
|
295
|
+
vals = self.model.evaluate_model(pts.T,scale=True)
|
|
296
|
+
return self.ax.imshow(vals.reshape(self.nsteps).T,extent=[self.bounding_box[0,0], self.bounding_box[1,0], self.bounding_box[0,1],
|
|
297
|
+
self.bounding_box[1,1]],origin='lower',cmap=cmap)
|
|
298
|
+
|
|
299
|
+
def add_fault_displacements(self,z = 0, cmap='rainbow'):
|
|
300
|
+
|
|
301
|
+
zz = np.zeros_like(self.xx)
|
|
302
|
+
zz[:] = z#self.bounding_box[1,2]
|
|
303
|
+
pts = np.vstack([self.xx.flatten(),self.yy.flatten(),zz.flatten()])
|
|
304
|
+
if self.model is None:
|
|
305
|
+
logger.error("Mapview needs a model assigned to plot model on map")
|
|
306
|
+
return
|
|
307
|
+
vals = self.model.evaluate_fault_displacements(pts.T,scale=True)
|
|
308
|
+
return self.ax.imshow(vals.reshape(self.nsteps).T,extent=[self.bounding_box[0,0], self.bounding_box[1,0], self.bounding_box[0,1],
|
|
309
|
+
self.bounding_box[1,1]],origin='lower',cmap=cmap)
|
|
310
|
+
|
|
311
|
+
def add_faults(self,**kwargs):
|
|
312
|
+
for f in self.model.features:
|
|
313
|
+
if f.type=='fault':
|
|
314
|
+
# create a function to return true if displacement > 0
|
|
315
|
+
def mask(x):
|
|
316
|
+
val = f.displacementfeature.evaluate_value(x)
|
|
317
|
+
val[np.isnan(val)] = 0
|
|
318
|
+
maskv = np.zeros(val.shape).astype(bool)
|
|
319
|
+
maskv[np.abs(val) > 0.001] = 1
|
|
320
|
+
return maskv
|
|
321
|
+
|
|
322
|
+
self.add_contour(f,0,mask=mask,**kwargs)
|