LoopStructural 1.7.0__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.
Files changed (131) hide show
  1. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/__init__.py +2 -1
  2. loopstructural-1.8.0/LoopStructural/modelling/core/_model_exporter.py +129 -0
  3. loopstructural-1.8.0/LoopStructural/modelling/core/_model_feature_factory.py +760 -0
  4. loopstructural-1.8.0/LoopStructural/modelling/core/_model_relationships.py +177 -0
  5. loopstructural-1.8.0/LoopStructural/modelling/core/_model_serializer.py +240 -0
  6. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/core/geological_model.py +67 -1089
  7. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_geological_feature.py +2 -2
  8. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/intrusion_builder.py +19 -40
  9. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/intrusion_feature.py +2 -82
  10. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/intrusion_frame_builder.py +12 -11
  11. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural.egg-info/PKG-INFO +3 -3
  12. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural.egg-info/SOURCES.txt +4 -2
  13. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural.egg-info/requires.txt +2 -2
  14. {loopstructural-1.7.0 → loopstructural-1.8.0}/PKG-INFO +3 -3
  15. {loopstructural-1.7.0 → loopstructural-1.8.0}/pyproject.toml +10 -8
  16. loopstructural-1.8.0/setup.py +5 -0
  17. loopstructural-1.7.0/LoopStructural/modelling/intrusions/intrusion_support_functions.py +0 -389
  18. loopstructural-1.7.0/LoopStructural/version.py +0 -1
  19. loopstructural-1.7.0/setup.py +0 -12
  20. {loopstructural-1.7.0 → loopstructural-1.8.0}/LICENSE +0 -0
  21. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/__init__.py +0 -0
  22. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/_base.py +0 -0
  23. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/_example_models.py +0 -0
  24. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/claudius.csv +0 -0
  25. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/claudiusbb.txt +0 -0
  26. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/duplex.csv +0 -0
  27. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/duplexbb.txt +0 -0
  28. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.cpg +0 -0
  29. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.dbf +0 -0
  30. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.prj +0 -0
  31. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.shp +0 -0
  32. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/fault_trace/fault_trace.shx +0 -0
  33. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/bbox.csv +0 -0
  34. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/contacts.csv +0 -0
  35. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/fault_displacement.csv +0 -0
  36. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/fault_edges.txt +0 -0
  37. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/fault_locations.csv +0 -0
  38. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/fault_orientations.csv +0 -0
  39. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/stratigraphic_order.csv +0 -0
  40. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/stratigraphic_orientations.csv +0 -0
  41. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/geological_map_data/stratigraphic_thickness.csv +0 -0
  42. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/intrusion.csv +0 -0
  43. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/intrusionbb.txt +0 -0
  44. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/onefoldbb.txt +0 -0
  45. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/onefolddata.csv +0 -0
  46. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/refolded_bb.txt +0 -0
  47. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/refolded_fold.csv +0 -0
  48. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datasets/data/tabular_intrusion.csv +0 -0
  49. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/datatypes/__init__.py +0 -0
  50. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/export/exporters.py +0 -0
  51. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/export/file_formats.py +0 -0
  52. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/export/geoh5.py +0 -0
  53. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/export/gocad.py +0 -0
  54. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/export/omf_wrapper.py +0 -0
  55. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/geometry/__init__.py +0 -0
  56. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/geometry/_structured_grid.py +0 -0
  57. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/interpolators/__init__.py +0 -0
  58. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/interpolators/_api.py +0 -0
  59. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/interpolators/_builders.py +0 -0
  60. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/interpolators/_constant_norm.py +0 -0
  61. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/interpolators/_cython/__init__.py +0 -0
  62. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/interpolators/_discrete_fold_interpolator.py +0 -0
  63. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/interpolators/_interpolatortype.py +0 -0
  64. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/__init__.py +0 -0
  65. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/core/__init__.py +0 -0
  66. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/core/_feature_registry.py +0 -0
  67. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/core/fault_topology.py +0 -0
  68. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/core/stratigraphic_column.py +0 -0
  69. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/__init__.py +0 -0
  70. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_analytical_feature.py +0 -0
  71. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_base_geological_feature.py +0 -0
  72. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_cross_product_geological_feature.py +0 -0
  73. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_feature_converters.py +0 -0
  74. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_lambda_geological_feature.py +0 -0
  75. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_projected_vector_feature.py +0 -0
  76. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_region.py +0 -0
  77. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_structural_frame.py +0 -0
  78. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/_unconformity_feature.py +0 -0
  79. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/__init__.py +0 -0
  80. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_analytical_fold_builder.py +0 -0
  81. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_base_builder.py +0 -0
  82. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_fault_builder.py +0 -0
  83. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_folded_feature_builder.py +0 -0
  84. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_geological_feature_builder.py +0 -0
  85. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/builders/_structural_frame_builder.py +0 -0
  86. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fault/__init__.py +0 -0
  87. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fault/_fault_function.py +0 -0
  88. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fault/_fault_function_feature.py +0 -0
  89. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fault/_fault_segment.py +0 -0
  90. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/__init__.py +0 -0
  91. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/_fold.py +0 -0
  92. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/_fold_rotation_angle_feature.py +0 -0
  93. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/_foldframe.py +0 -0
  94. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/_svariogram.py +0 -0
  95. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/__init__.py +0 -0
  96. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/_base_fold_rotation_angle.py +0 -0
  97. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/_fourier_series_fold_rotation_angle.py +0 -0
  98. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/_lambda_fold_rotation_angle.py +0 -0
  99. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/features/fold/fold_function/_trigo_fold_rotation_angle.py +0 -0
  100. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/input/__init__.py +0 -0
  101. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/input/fault_network.py +0 -0
  102. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/input/map2loop_processor.py +0 -0
  103. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/input/process_data.py +0 -0
  104. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/input/project_file.py +0 -0
  105. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/__init__.py +0 -0
  106. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/geom_conceptual_models.py +0 -0
  107. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/geometric_scaling_functions.py +0 -0
  108. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/modelling/intrusions/intrusion_frame.py +0 -0
  109. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/__init__.py +0 -0
  110. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/_api_registry.py +0 -0
  111. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/_surface.py +0 -0
  112. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/_transformation.py +0 -0
  113. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/colours.py +0 -0
  114. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/config.py +0 -0
  115. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/dtm_creator.py +0 -0
  116. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/exceptions.py +0 -0
  117. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/features.py +0 -0
  118. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/helper.py +0 -0
  119. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/json_encoder.py +0 -0
  120. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/linalg.py +0 -0
  121. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/logging.py +0 -0
  122. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/maths.py +0 -0
  123. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/observer.py +0 -0
  124. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/regions.py +0 -0
  125. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/typing.py +0 -0
  126. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/utils/utils.py +0 -0
  127. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural/visualisation/__init__.py +0 -0
  128. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural.egg-info/dependency_links.txt +0 -0
  129. {loopstructural-1.7.0 → loopstructural-1.8.0}/LoopStructural.egg-info/top_level.txt +0 -0
  130. {loopstructural-1.7.0 → loopstructural-1.8.0}/README.md +0 -0
  131. {loopstructural-1.7.0 → loopstructural-1.8.0}/setup.cfg +0 -0
@@ -32,9 +32,10 @@ __all__ = [
32
32
  "timed_stage",
33
33
  ]
34
34
  import tempfile
35
+ from importlib.metadata import version
35
36
  from pathlib import Path
36
37
 
37
- from .version import __version__
38
+ __version__ = version("LoopStructural")
38
39
 
39
40
  experimental = False
40
41
  ch = logging.StreamHandler()
@@ -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}')