LoopStructural 1.7.3__tar.gz → 1.8.0__tar.gz
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.
- loopstructural-1.8.0/LoopStructural/modelling/core/_model_exporter.py +129 -0
- loopstructural-1.8.0/LoopStructural/modelling/core/_model_feature_factory.py +760 -0
- loopstructural-1.8.0/LoopStructural/modelling/core/_model_relationships.py +177 -0
- loopstructural-1.8.0/LoopStructural/modelling/core/_model_serializer.py +240 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/core/geological_model.py +67 -1089
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_geological_feature.py +2 -2
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/intrusion_builder.py +19 -40
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/intrusion_feature.py +2 -82
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/intrusion_frame_builder.py +12 -11
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural.egg-info/PKG-INFO +1 -1
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural.egg-info/SOURCES.txt +4 -1
- {loopstructural-1.7.3 → loopstructural-1.8.0}/PKG-INFO +1 -1
- {loopstructural-1.7.3 → loopstructural-1.8.0}/pyproject.toml +8 -2
- loopstructural-1.7.3/LoopStructural/modelling/intrusions/intrusion_support_functions.py +0 -389
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LICENSE +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/_base.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/_example_models.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/claudius.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/claudiusbb.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/duplex.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/duplexbb.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.cpg +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.dbf +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.prj +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.shp +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.shx +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/bbox.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/contacts.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/fault_displacement.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/fault_edges.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/fault_locations.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/fault_orientations.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/stratigraphic_order.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/stratigraphic_orientations.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/stratigraphic_thickness.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/intrusion.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/intrusionbb.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/onefoldbb.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/onefolddata.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/refolded_bb.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/refolded_fold.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datasets/data/tabular_intrusion.csv +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/datatypes/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/export/exporters.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/export/file_formats.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/export/geoh5.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/export/gocad.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/export/omf_wrapper.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/geometry/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/geometry/_structured_grid.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/interpolators/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/interpolators/_api.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/interpolators/_builders.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/interpolators/_constant_norm.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/interpolators/_cython/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/interpolators/_discrete_fold_interpolator.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/interpolators/_interpolatortype.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/core/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/core/_feature_registry.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/core/fault_topology.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/core/stratigraphic_column.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_analytical_feature.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_base_geological_feature.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_cross_product_geological_feature.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_feature_converters.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_lambda_geological_feature.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_projected_vector_feature.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_region.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_structural_frame.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/_unconformity_feature.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_analytical_fold_builder.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_base_builder.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_fault_builder.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_folded_feature_builder.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_geological_feature_builder.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_structural_frame_builder.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fault/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fault/_fault_function.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fault/_fault_function_feature.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fault/_fault_segment.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/_fold.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/_fold_rotation_angle_feature.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/_foldframe.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/_svariogram.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/_base_fold_rotation_angle.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/_fourier_series_fold_rotation_angle.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/_lambda_fold_rotation_angle.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/_trigo_fold_rotation_angle.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/input/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/input/fault_network.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/input/map2loop_processor.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/input/process_data.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/input/project_file.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/geom_conceptual_models.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/geometric_scaling_functions.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/intrusion_frame.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/_api_registry.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/_surface.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/_transformation.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/colours.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/config.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/dtm_creator.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/exceptions.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/features.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/helper.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/json_encoder.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/linalg.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/logging.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/maths.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/observer.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/regions.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/typing.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/utils/utils.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural/visualisation/__init__.py +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural.egg-info/dependency_links.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural.egg-info/requires.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/LoopStructural.egg-info/top_level.txt +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/README.md +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/setup.cfg +0 -0
- {loopstructural-1.7.3 → loopstructural-1.8.0}/setup.py +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""Surface/block-model export logic for GeologicalModel (see API.md).
|
|
2
|
+
|
|
3
|
+
Extracted from GeologicalModel to separate export/visualization data prep
|
|
4
|
+
from feature-container orchestration. GeologicalModel's @public_api methods
|
|
5
|
+
(``get_fault_surfaces``, ``get_stratigraphic_surfaces``, ``get_block_model``,
|
|
6
|
+
``save``) stay defined directly on the class -- their __qualname__ is part
|
|
7
|
+
of the CI-checked stable API surface -- and delegate to the staticmethods
|
|
8
|
+
here.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
import pathlib
|
|
12
|
+
|
|
13
|
+
from ...geometry import StructuredGrid
|
|
14
|
+
from ...utils import getLogger
|
|
15
|
+
|
|
16
|
+
logger = getLogger(__name__)
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
class ModelExporter:
|
|
20
|
+
@staticmethod
|
|
21
|
+
def get_fault_surfaces(model, faults=None):
|
|
22
|
+
if faults is None:
|
|
23
|
+
faults = []
|
|
24
|
+
surfaces = []
|
|
25
|
+
if len(faults) == 0:
|
|
26
|
+
faults = model.fault_names()
|
|
27
|
+
|
|
28
|
+
for f in faults:
|
|
29
|
+
surfaces.extend(model.get_feature_by_name(f).surfaces([0], model.bounding_box))
|
|
30
|
+
return surfaces
|
|
31
|
+
|
|
32
|
+
@staticmethod
|
|
33
|
+
def get_stratigraphic_surfaces(model, units=None, bottoms=True):
|
|
34
|
+
if units is None:
|
|
35
|
+
units = []
|
|
36
|
+
## TODO change the stratigraphic column to its own class and have methods to get the relevant surfaces
|
|
37
|
+
surfaces = []
|
|
38
|
+
units = []
|
|
39
|
+
if model.stratigraphic_column is None:
|
|
40
|
+
return []
|
|
41
|
+
units = model.stratigraphic_column.get_isovalues()
|
|
42
|
+
units_for_group = {}
|
|
43
|
+
for name, u in units.items():
|
|
44
|
+
if u['group'] not in model:
|
|
45
|
+
logger.warning(f"Group {u['group']} not found in model")
|
|
46
|
+
continue
|
|
47
|
+
if u['group'] not in units_for_group:
|
|
48
|
+
units_for_group[u['group']] = []
|
|
49
|
+
u['name'] = name
|
|
50
|
+
units_for_group[u['group']].append(u)
|
|
51
|
+
for group, us in units_for_group.items():
|
|
52
|
+
feature = model.get_feature_by_name(group)
|
|
53
|
+
values = [u['value'] for u in us]
|
|
54
|
+
colours = [u['colour'] for u in us]
|
|
55
|
+
names = [u['name'] for u in us]
|
|
56
|
+
surfaces.extend(
|
|
57
|
+
feature.surfaces(values, model.bounding_box, name=names, colours=colours)
|
|
58
|
+
)
|
|
59
|
+
|
|
60
|
+
return surfaces
|
|
61
|
+
|
|
62
|
+
@staticmethod
|
|
63
|
+
def get_block_model(model, name='block model'):
|
|
64
|
+
# NOTE: bounding_box.structured_grid() returns loop_common's
|
|
65
|
+
# interpolation-support StructuredGrid (no properties dict); use
|
|
66
|
+
# LoopStructural's own geometry StructuredGrid for storing values.
|
|
67
|
+
grid = StructuredGrid(
|
|
68
|
+
origin=model.bounding_box.origin,
|
|
69
|
+
step_vector=model.bounding_box.step_vector,
|
|
70
|
+
nsteps=model.bounding_box.nsteps,
|
|
71
|
+
name=name,
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
grid.cell_properties['stratigraphy'] = model.evaluate_model(
|
|
75
|
+
model.rescale(model.bounding_box.cell_centres())
|
|
76
|
+
)
|
|
77
|
+
return grid, model.stratigraphic_ids()
|
|
78
|
+
|
|
79
|
+
@staticmethod
|
|
80
|
+
def save(
|
|
81
|
+
model,
|
|
82
|
+
filename: str,
|
|
83
|
+
block_model: bool = True,
|
|
84
|
+
stratigraphic_surfaces=True,
|
|
85
|
+
fault_surfaces=True,
|
|
86
|
+
stratigraphic_data=True,
|
|
87
|
+
fault_data=True,
|
|
88
|
+
):
|
|
89
|
+
path = pathlib.Path(filename)
|
|
90
|
+
extension = path.suffix
|
|
91
|
+
parent = path.parent
|
|
92
|
+
name = path.stem
|
|
93
|
+
stratigraphic_surfaces = model.get_stratigraphic_surfaces()
|
|
94
|
+
if fault_surfaces:
|
|
95
|
+
for s in model.get_fault_surfaces():
|
|
96
|
+
## geoh5 can save everything into the same file
|
|
97
|
+
if extension == ".geoh5" or extension == '.omf':
|
|
98
|
+
s.save(filename)
|
|
99
|
+
else:
|
|
100
|
+
s.save(f'{parent}/{name}_{s.name}{extension}')
|
|
101
|
+
if stratigraphic_surfaces:
|
|
102
|
+
for s in model.get_stratigraphic_surfaces():
|
|
103
|
+
if extension == ".geoh5" or extension == '.omf':
|
|
104
|
+
s.save(filename)
|
|
105
|
+
else:
|
|
106
|
+
s.save(f'{parent}/{name}_{s.name}{extension}')
|
|
107
|
+
if block_model:
|
|
108
|
+
grid, _ids = model.get_block_model()
|
|
109
|
+
if extension == ".geoh5" or extension == '.omf':
|
|
110
|
+
grid.save(filename)
|
|
111
|
+
else:
|
|
112
|
+
grid.save(f'{parent}/{name}_block_model{extension}')
|
|
113
|
+
if stratigraphic_data and model.stratigraphic_column is not None:
|
|
114
|
+
for group in model.stratigraphic_column:
|
|
115
|
+
if group == "faults":
|
|
116
|
+
continue
|
|
117
|
+
for data in model.__getitem__(group).get_data():
|
|
118
|
+
if extension == ".geoh5" or extension == '.omf':
|
|
119
|
+
data.save(filename)
|
|
120
|
+
else:
|
|
121
|
+
data.save(f'{parent}/{name}_{group}_data{extension}')
|
|
122
|
+
if fault_data:
|
|
123
|
+
for f in model.fault_names():
|
|
124
|
+
for d in model.__getitem__(f).get_data():
|
|
125
|
+
if extension == ".geoh5" or extension == '.omf':
|
|
126
|
+
|
|
127
|
+
d.save(filename)
|
|
128
|
+
else:
|
|
129
|
+
d.save(f'{parent}/{name}_{group}{extension}')
|