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