LoopStructural 1.6.1__py3-none-any.whl

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.

Potentially problematic release.


This version of LoopStructural might be problematic. Click here for more details.

Files changed (129) hide show
  1. LoopStructural/__init__.py +52 -0
  2. LoopStructural/datasets/__init__.py +23 -0
  3. LoopStructural/datasets/_base.py +301 -0
  4. LoopStructural/datasets/_example_models.py +10 -0
  5. LoopStructural/datasets/data/claudius.csv +21049 -0
  6. LoopStructural/datasets/data/claudiusbb.txt +2 -0
  7. LoopStructural/datasets/data/duplex.csv +126 -0
  8. LoopStructural/datasets/data/duplexbb.txt +2 -0
  9. LoopStructural/datasets/data/fault_trace/fault_trace.cpg +1 -0
  10. LoopStructural/datasets/data/fault_trace/fault_trace.dbf +0 -0
  11. LoopStructural/datasets/data/fault_trace/fault_trace.prj +1 -0
  12. LoopStructural/datasets/data/fault_trace/fault_trace.shp +0 -0
  13. LoopStructural/datasets/data/fault_trace/fault_trace.shx +0 -0
  14. LoopStructural/datasets/data/geological_map_data/bbox.csv +2 -0
  15. LoopStructural/datasets/data/geological_map_data/contacts.csv +657 -0
  16. LoopStructural/datasets/data/geological_map_data/fault_displacement.csv +7 -0
  17. LoopStructural/datasets/data/geological_map_data/fault_edges.txt +2 -0
  18. LoopStructural/datasets/data/geological_map_data/fault_locations.csv +79 -0
  19. LoopStructural/datasets/data/geological_map_data/fault_orientations.csv +19 -0
  20. LoopStructural/datasets/data/geological_map_data/stratigraphic_order.csv +13 -0
  21. LoopStructural/datasets/data/geological_map_data/stratigraphic_orientations.csv +207 -0
  22. LoopStructural/datasets/data/geological_map_data/stratigraphic_thickness.csv +13 -0
  23. LoopStructural/datasets/data/intrusion.csv +1017 -0
  24. LoopStructural/datasets/data/intrusionbb.txt +2 -0
  25. LoopStructural/datasets/data/onefoldbb.txt +2 -0
  26. LoopStructural/datasets/data/onefolddata.csv +2226 -0
  27. LoopStructural/datasets/data/refolded_bb.txt +2 -0
  28. LoopStructural/datasets/data/refolded_fold.csv +205 -0
  29. LoopStructural/datasets/data/tabular_intrusion.csv +23 -0
  30. LoopStructural/datatypes/__init__.py +4 -0
  31. LoopStructural/datatypes/_bounding_box.py +422 -0
  32. LoopStructural/datatypes/_point.py +166 -0
  33. LoopStructural/datatypes/_structured_grid.py +94 -0
  34. LoopStructural/datatypes/_surface.py +184 -0
  35. LoopStructural/export/exporters.py +554 -0
  36. LoopStructural/export/file_formats.py +15 -0
  37. LoopStructural/export/geoh5.py +100 -0
  38. LoopStructural/export/gocad.py +126 -0
  39. LoopStructural/export/omf_wrapper.py +88 -0
  40. LoopStructural/interpolators/__init__.py +105 -0
  41. LoopStructural/interpolators/_api.py +143 -0
  42. LoopStructural/interpolators/_builders.py +149 -0
  43. LoopStructural/interpolators/_cython/__init__.py +0 -0
  44. LoopStructural/interpolators/_discrete_fold_interpolator.py +183 -0
  45. LoopStructural/interpolators/_discrete_interpolator.py +692 -0
  46. LoopStructural/interpolators/_finite_difference_interpolator.py +470 -0
  47. LoopStructural/interpolators/_geological_interpolator.py +380 -0
  48. LoopStructural/interpolators/_interpolator_factory.py +89 -0
  49. LoopStructural/interpolators/_non_linear_discrete_interpolator.py +0 -0
  50. LoopStructural/interpolators/_operator.py +38 -0
  51. LoopStructural/interpolators/_p1interpolator.py +228 -0
  52. LoopStructural/interpolators/_p2interpolator.py +277 -0
  53. LoopStructural/interpolators/_surfe_wrapper.py +174 -0
  54. LoopStructural/interpolators/supports/_2d_base_unstructured.py +340 -0
  55. LoopStructural/interpolators/supports/_2d_p1_unstructured.py +68 -0
  56. LoopStructural/interpolators/supports/_2d_p2_unstructured.py +288 -0
  57. LoopStructural/interpolators/supports/_2d_structured_grid.py +462 -0
  58. LoopStructural/interpolators/supports/_2d_structured_tetra.py +0 -0
  59. LoopStructural/interpolators/supports/_3d_base_structured.py +467 -0
  60. LoopStructural/interpolators/supports/_3d_p2_tetra.py +331 -0
  61. LoopStructural/interpolators/supports/_3d_structured_grid.py +470 -0
  62. LoopStructural/interpolators/supports/_3d_structured_tetra.py +746 -0
  63. LoopStructural/interpolators/supports/_3d_unstructured_tetra.py +637 -0
  64. LoopStructural/interpolators/supports/__init__.py +55 -0
  65. LoopStructural/interpolators/supports/_aabb.py +77 -0
  66. LoopStructural/interpolators/supports/_base_support.py +114 -0
  67. LoopStructural/interpolators/supports/_face_table.py +70 -0
  68. LoopStructural/interpolators/supports/_support_factory.py +32 -0
  69. LoopStructural/modelling/__init__.py +29 -0
  70. LoopStructural/modelling/core/__init__.py +0 -0
  71. LoopStructural/modelling/core/geological_model.py +1867 -0
  72. LoopStructural/modelling/features/__init__.py +32 -0
  73. LoopStructural/modelling/features/_analytical_feature.py +79 -0
  74. LoopStructural/modelling/features/_base_geological_feature.py +364 -0
  75. LoopStructural/modelling/features/_cross_product_geological_feature.py +100 -0
  76. LoopStructural/modelling/features/_geological_feature.py +288 -0
  77. LoopStructural/modelling/features/_lambda_geological_feature.py +93 -0
  78. LoopStructural/modelling/features/_region.py +18 -0
  79. LoopStructural/modelling/features/_structural_frame.py +186 -0
  80. LoopStructural/modelling/features/_unconformity_feature.py +83 -0
  81. LoopStructural/modelling/features/builders/__init__.py +5 -0
  82. LoopStructural/modelling/features/builders/_base_builder.py +111 -0
  83. LoopStructural/modelling/features/builders/_fault_builder.py +590 -0
  84. LoopStructural/modelling/features/builders/_folded_feature_builder.py +129 -0
  85. LoopStructural/modelling/features/builders/_geological_feature_builder.py +543 -0
  86. LoopStructural/modelling/features/builders/_structural_frame_builder.py +237 -0
  87. LoopStructural/modelling/features/fault/__init__.py +3 -0
  88. LoopStructural/modelling/features/fault/_fault_function.py +444 -0
  89. LoopStructural/modelling/features/fault/_fault_function_feature.py +82 -0
  90. LoopStructural/modelling/features/fault/_fault_segment.py +505 -0
  91. LoopStructural/modelling/features/fold/__init__.py +9 -0
  92. LoopStructural/modelling/features/fold/_fold.py +167 -0
  93. LoopStructural/modelling/features/fold/_fold_rotation_angle.py +149 -0
  94. LoopStructural/modelling/features/fold/_fold_rotation_angle_feature.py +67 -0
  95. LoopStructural/modelling/features/fold/_foldframe.py +194 -0
  96. LoopStructural/modelling/features/fold/_svariogram.py +188 -0
  97. LoopStructural/modelling/input/__init__.py +2 -0
  98. LoopStructural/modelling/input/fault_network.py +80 -0
  99. LoopStructural/modelling/input/map2loop_processor.py +165 -0
  100. LoopStructural/modelling/input/process_data.py +650 -0
  101. LoopStructural/modelling/input/project_file.py +84 -0
  102. LoopStructural/modelling/intrusions/__init__.py +25 -0
  103. LoopStructural/modelling/intrusions/geom_conceptual_models.py +142 -0
  104. LoopStructural/modelling/intrusions/geometric_scaling_functions.py +123 -0
  105. LoopStructural/modelling/intrusions/intrusion_builder.py +672 -0
  106. LoopStructural/modelling/intrusions/intrusion_feature.py +410 -0
  107. LoopStructural/modelling/intrusions/intrusion_frame_builder.py +971 -0
  108. LoopStructural/modelling/intrusions/intrusion_support_functions.py +460 -0
  109. LoopStructural/utils/__init__.py +38 -0
  110. LoopStructural/utils/_surface.py +143 -0
  111. LoopStructural/utils/_transformation.py +76 -0
  112. LoopStructural/utils/config.py +18 -0
  113. LoopStructural/utils/dtm_creator.py +17 -0
  114. LoopStructural/utils/exceptions.py +31 -0
  115. LoopStructural/utils/helper.py +292 -0
  116. LoopStructural/utils/json_encoder.py +18 -0
  117. LoopStructural/utils/linalg.py +8 -0
  118. LoopStructural/utils/logging.py +79 -0
  119. LoopStructural/utils/maths.py +245 -0
  120. LoopStructural/utils/regions.py +103 -0
  121. LoopStructural/utils/typing.py +7 -0
  122. LoopStructural/utils/utils.py +68 -0
  123. LoopStructural/version.py +1 -0
  124. LoopStructural/visualisation/__init__.py +11 -0
  125. LoopStructural-1.6.1.dist-info/LICENSE +21 -0
  126. LoopStructural-1.6.1.dist-info/METADATA +81 -0
  127. LoopStructural-1.6.1.dist-info/RECORD +129 -0
  128. LoopStructural-1.6.1.dist-info/WHEEL +5 -0
  129. LoopStructural-1.6.1.dist-info/top_level.txt +1 -0
@@ -0,0 +1,52 @@
1
+ """
2
+ LoopStructural
3
+ ==============
4
+
5
+ """
6
+
7
+ import logging
8
+ from logging.config import dictConfig
9
+
10
+ __all__ = ["GeologicalModel"]
11
+ import tempfile
12
+ from pathlib import Path
13
+ from .version import __version__
14
+
15
+ experimental = False
16
+ ch = logging.StreamHandler()
17
+ formatter = logging.Formatter("%(levelname)s: %(asctime)s: %(filename)s:%(lineno)d -- %(message)s")
18
+ ch.setFormatter(formatter)
19
+ ch.setLevel(logging.WARNING)
20
+ loggers = {}
21
+ from .modelling.core.geological_model import GeologicalModel
22
+ from .interpolators._api import LoopInterpolator
23
+ from .datatypes import BoundingBox
24
+ from .utils import log_to_console, log_to_file, getLogger, rng, get_levels
25
+
26
+ logger = getLogger(__name__)
27
+ logger.info("Imported LoopStructural")
28
+
29
+
30
+ def setLogging(level="info"):
31
+ """
32
+ Set the logging parameters for log file
33
+
34
+ Parameters
35
+ ----------
36
+ filename : string
37
+ name of file or path to file
38
+ level : str, optional
39
+ 'info', 'warning', 'error', 'debug' mapped to logging levels, by default 'info'
40
+ """
41
+ import LoopStructural
42
+
43
+ logger = getLogger(__name__)
44
+
45
+ levels = get_levels()
46
+ level = levels.get(level, logging.WARNING)
47
+ LoopStructural.ch.setLevel(level)
48
+
49
+ for name in LoopStructural.loggers:
50
+ logger = logging.getLogger(name)
51
+ logger.setLevel(level)
52
+ logger.info(f'Set logging to {level}')
@@ -0,0 +1,23 @@
1
+ """
2
+ Demo Datasets
3
+ =============
4
+
5
+ Various datasets used for documentation and tutorials.
6
+ """
7
+
8
+ from ._base import load_claudius
9
+ from ._base import load_grose2017
10
+ from ._base import load_grose2018
11
+ from ._base import load_grose2019
12
+ from ._base import load_laurent2016
13
+ from ._base import load_noddy_single_fold
14
+ from ._base import load_intrusion
15
+ from ._base import normal_vector_headers
16
+ from ._base import strike_dip_headers
17
+ from ._base import value_headers
18
+ from ._base import load_unconformity
19
+ from ._base import load_duplex
20
+ from ._base import load_tabular_intrusion
21
+ from ._base import load_geological_map_data
22
+ from ._base import load_fault_trace
23
+ from ._base import load_horizontal
@@ -0,0 +1,301 @@
1
+ from os.path import dirname, join
2
+ from pathlib import Path
3
+ from typing import Tuple
4
+ import numpy as np
5
+ import pandas as pd
6
+
7
+
8
+ def load_horizontal() -> Tuple[pd.DataFrame, np.ndarray]:
9
+ """Synthetic model for horizontal layers
10
+
11
+ Returns
12
+ -------
13
+ Tuple[pd.DataFrame, np.ndarray]
14
+ dataframe with feature_name 'strati', bounding box array
15
+ """
16
+ bb = np.array([[0, 0, 0], [10, 10, 10]])
17
+ xy = np.mgrid[0:10, 0:10].reshape(2, -1).T
18
+ data = pd.DataFrame(
19
+ np.vstack(
20
+ [
21
+ np.hstack(
22
+ [
23
+ xy,
24
+ np.zeros(xy.shape[0])[:, None] + 2,
25
+ np.zeros(xy.shape[0])[:, None] + 2,
26
+ ]
27
+ ),
28
+ np.hstack(
29
+ [
30
+ xy,
31
+ np.zeros(xy.shape[0])[:, None] + 3,
32
+ np.zeros(xy.shape[0])[:, None] + 3,
33
+ ]
34
+ ),
35
+ ]
36
+ ),
37
+ columns=["X", "Y", "Z", "val"],
38
+ )
39
+
40
+ data["feature_name"] = "strati"
41
+ return data, bb
42
+
43
+
44
+ def load_claudius():
45
+ """Model dataset sampled from 3D seismic data
46
+
47
+
48
+ Returns
49
+ -------
50
+ tuple
51
+ pandas data frame with loopstructural dataset and numpy array for bounding box
52
+ """
53
+ module_path = dirname(__file__)
54
+ data = pd.read_csv(join(module_path, Path("data/claudius.csv")))
55
+ bb = np.loadtxt(join(module_path, Path("data/claudiusbb.txt")))
56
+ return data, bb
57
+
58
+
59
+ def load_noddy_single_fold():
60
+ """Model dataset for plunging cylindrical fold
61
+
62
+
63
+ Returns
64
+ -------
65
+ tuple
66
+ pandas data frame with loopstructural dataset and numpy array for bounding box
67
+ """
68
+
69
+ module_path = dirname(__file__)
70
+ data = pd.read_csv(join(module_path, Path("data/onefolddata.csv")))
71
+ bb = np.loadtxt(join(module_path, Path("data/onefoldbb.txt")))
72
+ return data, bb
73
+
74
+
75
+ def load_laurent2016():
76
+ """Model dataset for refolded fold
77
+
78
+
79
+ Returns
80
+ -------
81
+ tuple
82
+ pandas data frame with loopstructural dataset and numpy array for bounding box
83
+ """
84
+ module_path = dirname(__file__)
85
+ data = pd.read_csv(join(module_path, Path("data/refolded_fold.csv")))
86
+ bb = np.loadtxt(join(module_path, Path("data/refolded_bb.txt")))
87
+ return data, bb
88
+
89
+
90
+ def load_duplex():
91
+ """Model dataset for synthetic duplex example
92
+
93
+
94
+ Returns
95
+ -------
96
+ tuple
97
+ pandas data frame with loopstructural dataset and numpy array for bounding box
98
+ """
99
+ module_path = dirname(__file__)
100
+ data = pd.read_csv(join(module_path, Path("data/duplex.csv")))
101
+ bb = np.loadtxt(join(module_path, Path("data/duplexbb.txt")))
102
+ return data, bb
103
+
104
+
105
+ def load_grose2017():
106
+ """Model dataset for Cape Conran
107
+
108
+
109
+ Returns
110
+ -------
111
+ tuple
112
+ pandas data frame with loopstructural dataset and numpy array for bounding box
113
+ """
114
+ pass
115
+
116
+
117
+ def load_grose2018():
118
+ """Model dataset for synthetic parasitic fold series
119
+
120
+
121
+ Returns
122
+ -------
123
+ tuple
124
+ pandas data frame with loopstructural dataset and numpy array for bounding box
125
+ """
126
+ pass
127
+
128
+
129
+ def load_grose2019():
130
+ """Model dataset for Davenport ranges
131
+
132
+
133
+ Returns
134
+ -------
135
+ tuple
136
+ pandas data frame with loopstructural dataset and numpy array for bounding box
137
+ """
138
+ pass
139
+
140
+
141
+ def load_intrusion():
142
+ """Model dataset for a faulted intrusion
143
+
144
+
145
+ Returns
146
+ -------
147
+ tuple
148
+ pandas data frame with loopstructural dataset and numpy array for bounding box
149
+ """
150
+ module_path = dirname(__file__)
151
+ data = pd.read_csv(join(module_path, Path("data/intrusion.csv")))
152
+ bb = np.loadtxt(join(module_path, Path("data/intrusionbb.txt")))
153
+ return data, bb
154
+
155
+
156
+ def load_unconformity():
157
+ """Model dataset sampled for a model containing an unconformity
158
+
159
+
160
+ Returns
161
+ -------
162
+ tuple
163
+ pandas data frame with loopstructural dataset and numpy array for bounding box
164
+ """
165
+ module_path = dirname(__file__)
166
+ data = pd.read_csv(join(module_path, Path("data/unconformity.csv")))
167
+ bb = np.array([[0, 0, 0], [4, 6, 4]])
168
+ return data, bb
169
+
170
+
171
+ def value_headers():
172
+ """Default pandas column names for location and value
173
+
174
+ Returns
175
+ -------
176
+ list
177
+ X,Y,Z,val
178
+ """
179
+
180
+ return ["X", "Y", "Z", "val"]
181
+
182
+
183
+ def strike_dip_headers():
184
+ """Default pandas column names for location and strike and dip
185
+
186
+ Returns
187
+ -------
188
+ list
189
+ X,Y,Z,strike,dip
190
+ """
191
+ return ["X", "Y", "Z", "strike", "dip"]
192
+
193
+
194
+ def normal_vector_headers():
195
+ """Default pandas column names for location and normal vector
196
+
197
+ Returns
198
+ -------
199
+ list
200
+ X,Y,Z,nx,ny,nz
201
+ """
202
+ return ["X", "Y", "Z", "nx", "ny", "nz"]
203
+
204
+
205
+ def load_tabular_intrusion():
206
+ """Model dataset sampled for a model of a tabular intrusion
207
+
208
+
209
+ Returns
210
+ -------
211
+ tuple
212
+ pandas data frame with loopstructural dataset and numpy array for bounding box
213
+ """
214
+ module_path = dirname(__file__)
215
+ data = pd.read_csv(join(module_path, Path("data/tabular_intrusion.csv")))
216
+ bb = np.array([[0, 0, 0], [5, 5, 5]])
217
+ return data, bb
218
+
219
+
220
+ def load_geological_map_data():
221
+ """An example dataset to use the processinput data class
222
+
223
+ Returns
224
+ -------
225
+ tuple
226
+ (
227
+ contacts,
228
+ stratigraphic_orientations,
229
+ stratigraphic_thickness,
230
+ stratigraphic_order,
231
+ bbox,
232
+ fault_locations,
233
+ fault_orientations,
234
+ fault_properties,
235
+ fault_edges,
236
+ )
237
+ """
238
+ module_path = dirname(__file__)
239
+ contacts = pd.read_csv(join(module_path, Path("data/geological_map_data/contacts.csv")))
240
+ stratigraphic_orientations = pd.read_csv(
241
+ join(module_path, Path("data/geological_map_data/stratigraphic_orientations.csv"))
242
+ )
243
+ stratigraphic_thickness = pd.read_csv(
244
+ join(module_path, Path("data/geological_map_data/stratigraphic_thickness.csv")),
245
+ skiprows=1,
246
+ names=["name", "thickness"],
247
+ )
248
+ stratigraphic_order = pd.read_csv(
249
+ join(module_path, Path("data/geological_map_data/stratigraphic_order.csv")),
250
+ skiprows=1,
251
+ names=["order", "unit name"],
252
+ )
253
+ bbox = pd.read_csv(
254
+ join(module_path, Path("data/geological_map_data/bbox.csv")),
255
+ index_col=0,
256
+ header=None,
257
+ names=["X", "Y", "Z"],
258
+ )
259
+ fault_properties = pd.read_csv(
260
+ join(module_path, Path("data/geological_map_data/fault_displacement.csv")),
261
+ index_col=0,
262
+ )
263
+ fault_edges = []
264
+ with open(join(module_path, Path("data/geological_map_data/fault_edges.txt")), "r") as f:
265
+ for l in f.read().split("\n"):
266
+ faults = l.split(",")
267
+ if len(faults) == 2:
268
+ fault_edges.append((faults[0], faults[1]))
269
+ fault_locations = pd.read_csv(
270
+ join(module_path, Path("data/geological_map_data/fault_locations.csv"))
271
+ )
272
+ fault_orientations = pd.read_csv(
273
+ join(module_path, Path("data/geological_map_data/fault_orientations.csv"))
274
+ )
275
+ return (
276
+ contacts,
277
+ stratigraphic_orientations,
278
+ stratigraphic_thickness,
279
+ stratigraphic_order,
280
+ bbox,
281
+ fault_locations,
282
+ fault_orientations,
283
+ fault_properties,
284
+ fault_edges,
285
+ )
286
+
287
+
288
+ def load_fault_trace():
289
+ """Load the fault trace dataset, requires geopandas
290
+
291
+ Returns
292
+ -------
293
+ GeoDataFrame
294
+ dataframe of a shapefile for two faults
295
+ """
296
+ import geopandas
297
+
298
+ module_path = dirname(__file__)
299
+
300
+ fault_trace = geopandas.read_file(join(module_path, Path("data/fault_trace/fault_trace.shp")))
301
+ return fault_trace
@@ -0,0 +1,10 @@
1
+ vis = True
2
+ try:
3
+ pass
4
+ except:
5
+ print("No visualisation")
6
+ vis = False
7
+
8
+
9
+ def _build_claudius():
10
+ pass