LoopStructural 1.5.11__tar.gz → 1.6.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.
Potentially problematic release.
This version of LoopStructural might be problematic. Click here for more details.
- loopstructural-1.6.2/LoopStructural/__init__.py +52 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/__init__.py +2 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/_base.py +41 -12
- loopstructural-1.6.2/LoopStructural/datasets/_example_models.py +10 -0
- loopstructural-1.6.2/LoopStructural/datatypes/__init__.py +4 -0
- loopstructural-1.6.2/LoopStructural/datatypes/_bounding_box.py +422 -0
- loopstructural-1.6.2/LoopStructural/datatypes/_point.py +166 -0
- loopstructural-1.6.2/LoopStructural/datatypes/_structured_grid.py +94 -0
- loopstructural-1.6.2/LoopStructural/datatypes/_surface.py +184 -0
- loopstructural-1.6.2/LoopStructural/export/exporters.py +554 -0
- loopstructural-1.6.2/LoopStructural/export/file_formats.py +15 -0
- loopstructural-1.6.2/LoopStructural/export/geoh5.py +100 -0
- loopstructural-1.6.2/LoopStructural/export/gocad.py +126 -0
- loopstructural-1.6.2/LoopStructural/export/omf_wrapper.py +88 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/__init__.py +29 -16
- LoopStructural-1.5.11/LoopStructural/api/_interpolate.py → loopstructural-1.6.2/LoopStructural/interpolators/_api.py +8 -10
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/_builders.py +6 -10
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/_discrete_fold_interpolator.py +31 -102
- loopstructural-1.6.2/LoopStructural/interpolators/_discrete_interpolator.py +692 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/_finite_difference_interpolator.py +42 -88
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/_geological_interpolator.py +79 -28
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/_interpolator_factory.py +33 -27
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/_operator.py +1 -15
- loopstructural-1.6.2/LoopStructural/interpolators/_p1interpolator.py +228 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/_p2interpolator.py +29 -25
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/_surfe_wrapper.py +2 -7
- loopstructural-1.6.2/LoopStructural/interpolators/supports/_2d_base_unstructured.py +340 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/_2d_p1_unstructured.py +13 -8
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/_2d_p2_unstructured.py +135 -137
- loopstructural-1.6.2/LoopStructural/interpolators/supports/_2d_structured_grid.py +462 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/_3d_base_structured.py +63 -51
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/_3d_p2_tetra.py +11 -28
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/_3d_structured_grid.py +26 -42
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/_3d_structured_tetra.py +246 -82
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/_3d_unstructured_tetra.py +158 -77
- loopstructural-1.6.2/LoopStructural/interpolators/supports/_aabb.py +77 -0
- loopstructural-1.6.2/LoopStructural/interpolators/supports/_base_support.py +114 -0
- loopstructural-1.6.2/LoopStructural/interpolators/supports/_face_table.py +70 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/_support_factory.py +13 -3
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/__init__.py +2 -1
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/core/geological_model.py +315 -284
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/__init__.py +4 -8
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/_analytical_feature.py +22 -8
- loopstructural-1.6.2/LoopStructural/modelling/features/_base_geological_feature.py +364 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/_cross_product_geological_feature.py +9 -6
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/_geological_feature.py +114 -13
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/_lambda_geological_feature.py +20 -12
- loopstructural-1.6.2/LoopStructural/modelling/features/_region.py +18 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/_structural_frame.py +57 -14
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/_unconformity_feature.py +19 -3
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/builders/_base_builder.py +20 -6
- loopstructural-1.6.2/LoopStructural/modelling/features/builders/_fault_builder.py +590 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/builders/_folded_feature_builder.py +8 -6
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/builders/_geological_feature_builder.py +121 -92
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/builders/_structural_frame_builder.py +12 -18
- loopstructural-1.6.2/LoopStructural/modelling/features/fault/_fault_function.py +444 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fault/_fault_function_feature.py +5 -5
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fault/_fault_segment.py +129 -22
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fold/__init__.py +1 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fold/_fold.py +15 -5
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fold/_fold_rotation_angle.py +3 -9
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fold/_fold_rotation_angle_feature.py +1 -5
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fold/_foldframe.py +7 -18
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fold/_svariogram.py +1 -5
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/input/map2loop_processor.py +7 -20
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/input/process_data.py +24 -38
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/input/project_file.py +11 -9
- loopstructural-1.6.2/LoopStructural/modelling/intrusions/geom_conceptual_models.py +142 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/intrusions/geometric_scaling_functions.py +3 -5
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/intrusions/intrusion_builder.py +87 -151
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/intrusions/intrusion_feature.py +38 -40
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/intrusions/intrusion_frame_builder.py +67 -122
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/intrusions/intrusion_support_functions.py +2 -13
- loopstructural-1.6.2/LoopStructural/utils/__init__.py +38 -0
- loopstructural-1.6.2/LoopStructural/utils/_surface.py +143 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/_transformation.py +1 -4
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/dtm_creator.py +11 -7
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/exceptions.py +4 -2
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/helper.py +37 -174
- loopstructural-1.6.2/LoopStructural/utils/linalg.py +8 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/logging.py +1 -3
- loopstructural-1.6.2/LoopStructural/utils/maths.py +246 -0
- loopstructural-1.6.2/LoopStructural/utils/typing.py +7 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/utils.py +1 -5
- loopstructural-1.6.2/LoopStructural/version.py +1 -0
- loopstructural-1.6.2/LoopStructural/visualisation/__init__.py +11 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural.egg-info/PKG-INFO +39 -18
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural.egg-info/SOURCES.txt +18 -38
- loopstructural-1.6.2/LoopStructural.egg-info/requires.txt +26 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural.egg-info/top_level.txt +0 -1
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/PKG-INFO +39 -18
- loopstructural-1.6.2/pyproject.toml +161 -0
- loopstructural-1.6.2/setup.py +12 -0
- LoopStructural-1.5.11/LoopStructural/__init__.py +0 -27
- LoopStructural-1.5.11/LoopStructural/analysis/__init__.py +0 -17
- LoopStructural-1.5.11/LoopStructural/analysis/_fault_displacement.py +0 -132
- LoopStructural-1.5.11/LoopStructural/analysis/_fault_intersection.py +0 -69
- LoopStructural-1.5.11/LoopStructural/analysis/_plane_fit.py +0 -67
- LoopStructural-1.5.11/LoopStructural/analysis/_topology.py +0 -38
- LoopStructural-1.5.11/LoopStructural/api/_surface.py +0 -47
- LoopStructural-1.5.11/LoopStructural/api/model.py +0 -6
- LoopStructural-1.5.11/LoopStructural/datasets/_example_models.py +0 -13
- LoopStructural-1.5.11/LoopStructural/datatypes/__init__.py +0 -2
- LoopStructural-1.5.11/LoopStructural/datatypes/_bounding_box.py +0 -147
- LoopStructural-1.5.11/LoopStructural/datatypes/_point.py +0 -5
- LoopStructural-1.5.11/LoopStructural/datatypes/_point_set.py +0 -6
- LoopStructural-1.5.11/LoopStructural/datatypes/_structured_grid.py +0 -0
- LoopStructural-1.5.11/LoopStructural/datatypes/_surface.py +0 -30
- LoopStructural-1.5.11/LoopStructural/datatypes/_tangent.py +0 -0
- LoopStructural-1.5.11/LoopStructural/interpolators/_cython/dsi_helper.c +0 -36678
- LoopStructural-1.5.11/LoopStructural/interpolators/_discrete_interpolator.py +0 -859
- LoopStructural-1.5.11/LoopStructural/interpolators/_interpolator_factor.py +0 -27
- LoopStructural-1.5.11/LoopStructural/interpolators/_p1interpolator.py +0 -125
- LoopStructural-1.5.11/LoopStructural/interpolators/_python/__init__.py +0 -0
- LoopStructural-1.5.11/LoopStructural/interpolators/_python/dsi_helper.py +0 -187
- LoopStructural-1.5.11/LoopStructural/interpolators/piecewiselinear_interpolator.py +0 -475
- LoopStructural-1.5.11/LoopStructural/interpolators/supports/_2d_base_unstructured.py +0 -184
- LoopStructural-1.5.11/LoopStructural/interpolators/supports/_2d_structured_grid.py +0 -399
- LoopStructural-1.5.11/LoopStructural/modelling/core/__init__.py +0 -0
- LoopStructural-1.5.11/LoopStructural/modelling/core/geological_model_builder.py +0 -38
- LoopStructural-1.5.11/LoopStructural/modelling/core/stratigraphic_column.py +0 -32
- LoopStructural-1.5.11/LoopStructural/modelling/features/_base_geological_feature.py +0 -209
- LoopStructural-1.5.11/LoopStructural/modelling/features/builders/_fault_builder.py +0 -381
- LoopStructural-1.5.11/LoopStructural/modelling/features/fault/_fault_function.py +0 -226
- LoopStructural-1.5.11/LoopStructural/modelling/input/ponicode/__init__.py +0 -0
- LoopStructural-1.5.11/LoopStructural/modelling/intrusions/geom_conceptual_models.py +0 -132
- LoopStructural-1.5.11/LoopStructural/utils/__init__.py +0 -24
- LoopStructural-1.5.11/LoopStructural/utils/map2loop.py +0 -526
- LoopStructural-1.5.11/LoopStructural/version.py +0 -1
- LoopStructural-1.5.11/LoopStructural/visualisation/__init__.py +0 -32
- LoopStructural-1.5.11/LoopStructural/visualisation/_dash_view.py +0 -137
- LoopStructural-1.5.11/LoopStructural/visualisation/_scalar_field.py +0 -76
- LoopStructural-1.5.11/LoopStructural/visualisation/lavavu.py +0 -465
- LoopStructural-1.5.11/LoopStructural/visualisation/map_viewer.py +0 -385
- LoopStructural-1.5.11/LoopStructural/visualisation/model_plotter.py +0 -1070
- LoopStructural-1.5.11/LoopStructural/visualisation/rotation_angle_plotter.py +0 -98
- LoopStructural-1.5.11/LoopStructural/visualisation/sphinx_scraper.py +0 -37
- LoopStructural-1.5.11/LoopStructural/visualisation/stratigraphic_column.py +0 -63
- LoopStructural-1.5.11/LoopStructural/visualisation/vtk_exporter.py +0 -138
- LoopStructural-1.5.11/LoopStructural.egg-info/requires.txt +0 -6
- LoopStructural-1.5.11/setup.py +0 -86
- LoopStructural-1.5.11/tests/__init__.py +0 -0
- LoopStructural-1.5.11/tests/conftest.py +0 -13
- LoopStructural-1.5.11/tests/fixtures/__init__.py +0 -0
- LoopStructural-1.5.11/tests/fixtures/data.py +0 -43
- LoopStructural-1.5.11/tests/fixtures/horizontal_data.py +0 -22
- LoopStructural-1.5.11/tests/fixtures/interpolator.py +0 -77
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LICENSE +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/claudius.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/claudiusbb.txt +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/duplex.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/duplexbb.txt +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/fault_trace/fault_trace.cpg +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/fault_trace/fault_trace.dbf +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/fault_trace/fault_trace.prj +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/fault_trace/fault_trace.shp +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/fault_trace/fault_trace.shx +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/bbox.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/contacts.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/fault_displacement.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/fault_edges.txt +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/fault_locations.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/fault_orientations.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/stratigraphic_order.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/stratigraphic_orientations.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/geological_map_data/stratigraphic_thickness.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/intrusion.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/intrusionbb.txt +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/onefoldbb.txt +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/onefolddata.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/refolded_bb.txt +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/refolded_fold.csv +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/datasets/data/tabular_intrusion.csv +0 -0
- {LoopStructural-1.5.11/LoopStructural/api → loopstructural-1.6.2/LoopStructural/interpolators/_cython}/__init__.py +0 -0
- /LoopStructural-1.5.11/LoopStructural/datatypes/_inequality.py → /loopstructural-1.6.2/LoopStructural/interpolators/_non_linear_discrete_interpolator.py +0 -0
- /LoopStructural-1.5.11/LoopStructural/datatypes/_normal.py → /loopstructural-1.6.2/LoopStructural/interpolators/supports/_2d_structured_tetra.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/interpolators/supports/__init__.py +0 -0
- {LoopStructural-1.5.11/LoopStructural/interpolators/_cython → loopstructural-1.6.2/LoopStructural/modelling/core}/__init__.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/builders/__init__.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/features/fault/__init__.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/input/__init__.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/input/fault_network.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/modelling/intrusions/__init__.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/config.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/json_encoder.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural/utils/regions.py +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/LoopStructural.egg-info/dependency_links.txt +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/README.md +0 -0
- {LoopStructural-1.5.11 → loopstructural-1.6.2}/setup.cfg +0 -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}')
|
|
@@ -4,6 +4,7 @@ Demo Datasets
|
|
|
4
4
|
|
|
5
5
|
Various datasets used for documentation and tutorials.
|
|
6
6
|
"""
|
|
7
|
+
|
|
7
8
|
from ._base import load_claudius
|
|
8
9
|
from ._base import load_grose2017
|
|
9
10
|
from ._base import load_grose2018
|
|
@@ -19,3 +20,4 @@ from ._base import load_duplex
|
|
|
19
20
|
from ._base import load_tabular_intrusion
|
|
20
21
|
from ._base import load_geological_map_data
|
|
21
22
|
from ._base import load_fault_trace
|
|
23
|
+
from ._base import load_horizontal
|
|
@@ -1,9 +1,46 @@
|
|
|
1
1
|
from os.path import dirname, join
|
|
2
2
|
from pathlib import Path
|
|
3
|
+
from typing import Tuple
|
|
3
4
|
import numpy as np
|
|
4
5
|
import pandas as pd
|
|
5
6
|
|
|
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
|
+
|
|
7
44
|
def load_claudius():
|
|
8
45
|
"""Model dataset sampled from 3D seismic data
|
|
9
46
|
|
|
@@ -199,13 +236,9 @@ def load_geological_map_data():
|
|
|
199
236
|
)
|
|
200
237
|
"""
|
|
201
238
|
module_path = dirname(__file__)
|
|
202
|
-
contacts = pd.read_csv(
|
|
203
|
-
join(module_path, Path("data/geological_map_data/contacts.csv"))
|
|
204
|
-
)
|
|
239
|
+
contacts = pd.read_csv(join(module_path, Path("data/geological_map_data/contacts.csv")))
|
|
205
240
|
stratigraphic_orientations = pd.read_csv(
|
|
206
|
-
join(
|
|
207
|
-
module_path, Path("data/geological_map_data/stratigraphic_orientations.csv")
|
|
208
|
-
)
|
|
241
|
+
join(module_path, Path("data/geological_map_data/stratigraphic_orientations.csv"))
|
|
209
242
|
)
|
|
210
243
|
stratigraphic_thickness = pd.read_csv(
|
|
211
244
|
join(module_path, Path("data/geological_map_data/stratigraphic_thickness.csv")),
|
|
@@ -228,9 +261,7 @@ def load_geological_map_data():
|
|
|
228
261
|
index_col=0,
|
|
229
262
|
)
|
|
230
263
|
fault_edges = []
|
|
231
|
-
with open(
|
|
232
|
-
join(module_path, Path("data/geological_map_data/fault_edges.txt")), "r"
|
|
233
|
-
) as f:
|
|
264
|
+
with open(join(module_path, Path("data/geological_map_data/fault_edges.txt")), "r") as f:
|
|
234
265
|
for l in f.read().split("\n"):
|
|
235
266
|
faults = l.split(",")
|
|
236
267
|
if len(faults) == 2:
|
|
@@ -266,7 +297,5 @@ def load_fault_trace():
|
|
|
266
297
|
|
|
267
298
|
module_path = dirname(__file__)
|
|
268
299
|
|
|
269
|
-
fault_trace = geopandas.read_file(
|
|
270
|
-
join(module_path, Path("data/fault_trace/fault_trace.shp"))
|
|
271
|
-
)
|
|
300
|
+
fault_trace = geopandas.read_file(join(module_path, Path("data/fault_trace/fault_trace.shp")))
|
|
272
301
|
return fault_trace
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from typing import Optional, Union, Dict
|
|
3
|
+
from LoopStructural.utils.exceptions import LoopValueError
|
|
4
|
+
from LoopStructural.utils import rng
|
|
5
|
+
from LoopStructural.datatypes._structured_grid import StructuredGrid
|
|
6
|
+
import numpy as np
|
|
7
|
+
|
|
8
|
+
from LoopStructural.utils.logging import getLogger
|
|
9
|
+
|
|
10
|
+
logger = getLogger(__name__)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
class BoundingBox:
|
|
14
|
+
def __init__(
|
|
15
|
+
self,
|
|
16
|
+
origin: Optional[np.ndarray] = None,
|
|
17
|
+
maximum: Optional[np.ndarray] = None,
|
|
18
|
+
global_origin: Optional[np.ndarray] = None,
|
|
19
|
+
nsteps: Optional[np.ndarray] = None,
|
|
20
|
+
step_vector: Optional[np.ndarray] = None,
|
|
21
|
+
dimensions: Optional[int] = 3,
|
|
22
|
+
):
|
|
23
|
+
"""A bounding box for a model, defined by the
|
|
24
|
+
origin, maximum and number of steps in each direction
|
|
25
|
+
|
|
26
|
+
Parameters
|
|
27
|
+
----------
|
|
28
|
+
dimensions : int, optional
|
|
29
|
+
_description_, by default 3
|
|
30
|
+
origin : Optional[np.ndarray], optional
|
|
31
|
+
_description_, by default None
|
|
32
|
+
maximum : Optional[np.ndarray], optional
|
|
33
|
+
_description_, by default None
|
|
34
|
+
nsteps : Optional[np.ndarray], optional
|
|
35
|
+
_description_, by default None
|
|
36
|
+
"""
|
|
37
|
+
# reproject relative to the global origin, if origin is not provided.
|
|
38
|
+
# we want the local coordinates to start at 0
|
|
39
|
+
# otherwise uses provided origin. This is useful for having multiple bounding boxes rela
|
|
40
|
+
if global_origin is not None and origin is None:
|
|
41
|
+
origin = np.zeros(global_origin.shape)
|
|
42
|
+
if maximum is None and nsteps is not None and step_vector is not None:
|
|
43
|
+
maximum = origin + nsteps * step_vector
|
|
44
|
+
if origin is not None and global_origin is None:
|
|
45
|
+
global_origin = origin
|
|
46
|
+
self._origin = np.array(origin)
|
|
47
|
+
self._maximum = np.array(maximum)
|
|
48
|
+
self.dimensions = dimensions
|
|
49
|
+
if self.origin.shape:
|
|
50
|
+
if self.origin.shape[0] != self.dimensions:
|
|
51
|
+
logger.warning(
|
|
52
|
+
f"Origin has {self.origin.shape[0]} dimensions but bounding box has {self.dimensions}"
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
else:
|
|
56
|
+
self.dimensions = dimensions
|
|
57
|
+
self._global_origin = global_origin
|
|
58
|
+
self.nsteps = np.array([50, 50, 25])
|
|
59
|
+
if nsteps is not None:
|
|
60
|
+
self.nsteps = np.array(nsteps)
|
|
61
|
+
self.name_map = {
|
|
62
|
+
"xmin": (0, 0),
|
|
63
|
+
"ymin": (0, 1),
|
|
64
|
+
"zmin": (0, 2),
|
|
65
|
+
"xmax": (1, 0),
|
|
66
|
+
"ymax": (1, 1),
|
|
67
|
+
"zmax": (1, 2),
|
|
68
|
+
"lower": (0, 2),
|
|
69
|
+
"upper": (1, 2),
|
|
70
|
+
"minx": (0, 0),
|
|
71
|
+
"miny": (0, 1),
|
|
72
|
+
"minz": (0, 2),
|
|
73
|
+
"maxx": (1, 0),
|
|
74
|
+
"maxy": (1, 1),
|
|
75
|
+
"maxz": (1, 2),
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@property
|
|
79
|
+
def global_origin(self):
|
|
80
|
+
return self._global_origin
|
|
81
|
+
|
|
82
|
+
@global_origin.setter
|
|
83
|
+
def global_origin(self, global_origin):
|
|
84
|
+
if self.dimensions != len(global_origin):
|
|
85
|
+
logger.warning(
|
|
86
|
+
f"Global origin has {len(global_origin)} dimensions but bounding box has {self.dimensions}"
|
|
87
|
+
)
|
|
88
|
+
self._global_origin = global_origin
|
|
89
|
+
|
|
90
|
+
@property
|
|
91
|
+
def global_maximum(self):
|
|
92
|
+
return self.maximum - self.origin + self._global_origin
|
|
93
|
+
|
|
94
|
+
@property
|
|
95
|
+
def valid(self):
|
|
96
|
+
return self._origin is not None and self._maximum is not None
|
|
97
|
+
|
|
98
|
+
@property
|
|
99
|
+
def origin(self) -> np.ndarray:
|
|
100
|
+
if self._origin is None:
|
|
101
|
+
raise LoopValueError("Origin is not set")
|
|
102
|
+
return self._origin
|
|
103
|
+
|
|
104
|
+
@origin.setter
|
|
105
|
+
def origin(self, origin: np.ndarray):
|
|
106
|
+
if self.dimensions != len(origin):
|
|
107
|
+
logger.warning(
|
|
108
|
+
f"Origin has {len(origin)} dimensions but bounding box has {self.dimensions}"
|
|
109
|
+
)
|
|
110
|
+
self._origin = origin
|
|
111
|
+
|
|
112
|
+
@property
|
|
113
|
+
def maximum(self) -> np.ndarray:
|
|
114
|
+
if self._maximum is None:
|
|
115
|
+
raise LoopValueError("Maximum is not set")
|
|
116
|
+
return self._maximum
|
|
117
|
+
|
|
118
|
+
@maximum.setter
|
|
119
|
+
def maximum(self, maximum: np.ndarray):
|
|
120
|
+
self._maximum = maximum
|
|
121
|
+
|
|
122
|
+
@property
|
|
123
|
+
def nelements(self):
|
|
124
|
+
return self.nsteps.prod()
|
|
125
|
+
|
|
126
|
+
@property
|
|
127
|
+
def volume(self):
|
|
128
|
+
return np.prod(self.maximum - self.origin)
|
|
129
|
+
|
|
130
|
+
@property
|
|
131
|
+
def bb(self):
|
|
132
|
+
return np.array([self.origin, self.maximum])
|
|
133
|
+
|
|
134
|
+
@nelements.setter
|
|
135
|
+
def nelements(self, nelements: Union[int, float]):
|
|
136
|
+
"""Update the number of elements in the associated grid
|
|
137
|
+
This is for visualisation, not for the interpolation
|
|
138
|
+
When set it will update the nsteps/step vector for cubic
|
|
139
|
+
elements
|
|
140
|
+
|
|
141
|
+
Parameters
|
|
142
|
+
----------
|
|
143
|
+
nelements : int,float
|
|
144
|
+
The new number of elements
|
|
145
|
+
"""
|
|
146
|
+
box_vol = self.volume
|
|
147
|
+
ele_vol = box_vol / nelements
|
|
148
|
+
# calculate the step vector of a regular cube
|
|
149
|
+
step_vector = np.zeros(self.dimensions)
|
|
150
|
+
step_vector[:] = ele_vol ** (1.0 / 3.0)
|
|
151
|
+
# number of steps is the length of the box / step vector
|
|
152
|
+
nsteps = np.ceil((self.maximum - self.origin) / step_vector).astype(int)
|
|
153
|
+
self.nsteps = nsteps
|
|
154
|
+
|
|
155
|
+
@property
|
|
156
|
+
def corners(self) -> np.ndarray:
|
|
157
|
+
"""Returns the corners of the bounding box in local coordinates
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
Returns
|
|
162
|
+
-------
|
|
163
|
+
np.ndarray
|
|
164
|
+
array of corners in clockwise order
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
return np.array(
|
|
168
|
+
[
|
|
169
|
+
self.origin.tolist(),
|
|
170
|
+
[self.maximum[0], self.origin[1], self.origin[2]],
|
|
171
|
+
[self.maximum[0], self.maximum[1], self.origin[2]],
|
|
172
|
+
[self.origin[0], self.maximum[1], self.origin[2]],
|
|
173
|
+
[self.origin[0], self.origin[1], self.maximum[2]],
|
|
174
|
+
[self.maximum[0], self.origin[1], self.maximum[2]],
|
|
175
|
+
self.maximum.tolist(),
|
|
176
|
+
[self.origin[0], self.maximum[1], self.maximum[2]],
|
|
177
|
+
]
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
@property
|
|
181
|
+
def corners_global(self) -> np.ndarray:
|
|
182
|
+
"""Returns the corners of the bounding box
|
|
183
|
+
in the original space
|
|
184
|
+
|
|
185
|
+
Returns
|
|
186
|
+
-------
|
|
187
|
+
np.ndarray
|
|
188
|
+
corners of the bounding box
|
|
189
|
+
"""
|
|
190
|
+
return np.array(
|
|
191
|
+
[
|
|
192
|
+
self.global_origin.tolist(),
|
|
193
|
+
[self.global_maximum[0], self.global_origin[1], self.global_origin[2]],
|
|
194
|
+
[self.global_maximum[0], self.global_maximum[1], self.global_origin[2]],
|
|
195
|
+
[self.global_origin[0], self.global_maximum[1], self.global_origin[2]],
|
|
196
|
+
[self.global_origin[0], self.global_origin[1], self.global_maximum[2]],
|
|
197
|
+
[self.global_maximum[0], self.global_origin[1], self.global_maximum[2]],
|
|
198
|
+
self.global_maximum.tolist(),
|
|
199
|
+
[self.global_origin[0], self.global_maximum[1], self.global_maximum[2]],
|
|
200
|
+
]
|
|
201
|
+
)
|
|
202
|
+
|
|
203
|
+
@property
|
|
204
|
+
def step_vector(self):
|
|
205
|
+
return (self.maximum - self.origin) / self.nsteps
|
|
206
|
+
|
|
207
|
+
@property
|
|
208
|
+
def length(self):
|
|
209
|
+
return self.maximum - self.origin
|
|
210
|
+
|
|
211
|
+
def fit(self, locations: np.ndarray, local_coordinate: bool = False) -> BoundingBox:
|
|
212
|
+
"""Initialise the bounding box from a set of points.
|
|
213
|
+
|
|
214
|
+
Parameters
|
|
215
|
+
----------
|
|
216
|
+
locations : np.ndarray
|
|
217
|
+
xyz locations of the points to fit the bbox
|
|
218
|
+
local_coordinate : bool, optional
|
|
219
|
+
whether to set the origin to [0,0,0], by default False
|
|
220
|
+
|
|
221
|
+
Returns
|
|
222
|
+
-------
|
|
223
|
+
BoundingBox
|
|
224
|
+
A reference to the bounding box object, note this is not a new bounding box
|
|
225
|
+
it updates the current one in place.
|
|
226
|
+
|
|
227
|
+
Raises
|
|
228
|
+
------
|
|
229
|
+
LoopValueError
|
|
230
|
+
_description_
|
|
231
|
+
"""
|
|
232
|
+
if locations.shape[1] != self.dimensions:
|
|
233
|
+
raise LoopValueError(
|
|
234
|
+
f"locations array is {locations.shape[1]}D but bounding box is {self.dimensions}"
|
|
235
|
+
)
|
|
236
|
+
origin = locations.min(axis=0)
|
|
237
|
+
maximum = locations.max(axis=0)
|
|
238
|
+
if local_coordinate:
|
|
239
|
+
self.global_origin = origin
|
|
240
|
+
self.origin = np.zeros(3)
|
|
241
|
+
self.maximum = maximum - origin
|
|
242
|
+
else:
|
|
243
|
+
self.origin = origin
|
|
244
|
+
self.maximum = maximum
|
|
245
|
+
self.global_origin = np.zeros(3)
|
|
246
|
+
return self
|
|
247
|
+
|
|
248
|
+
def with_buffer(self, buffer: float = 0.2) -> BoundingBox:
|
|
249
|
+
"""Create a new bounding box with a buffer around the existing bounding box
|
|
250
|
+
|
|
251
|
+
Parameters
|
|
252
|
+
----------
|
|
253
|
+
buffer : float, optional
|
|
254
|
+
percentage to expand the dimensions by, by default 0.2
|
|
255
|
+
|
|
256
|
+
Returns
|
|
257
|
+
-------
|
|
258
|
+
BoundingBox
|
|
259
|
+
The new bounding box object.
|
|
260
|
+
|
|
261
|
+
Raises
|
|
262
|
+
------
|
|
263
|
+
LoopValueError
|
|
264
|
+
if the current bounding box is invalid
|
|
265
|
+
"""
|
|
266
|
+
if self.origin is None or self.maximum is None:
|
|
267
|
+
raise LoopValueError("Cannot create bounding box with buffer, no origin or maximum")
|
|
268
|
+
# local coordinates, rescale into the original bounding boxes global coordinates
|
|
269
|
+
origin = self.origin - buffer * (self.maximum - self.origin)
|
|
270
|
+
maximum = self.maximum + buffer * (self.maximum - self.origin)
|
|
271
|
+
return BoundingBox(
|
|
272
|
+
origin=origin, maximum=maximum, global_origin=self.global_origin + origin
|
|
273
|
+
)
|
|
274
|
+
|
|
275
|
+
def get_value(self, name):
|
|
276
|
+
ix, iy = self.name_map.get(name, (-1, -1))
|
|
277
|
+
if ix == -1 and iy == -1:
|
|
278
|
+
raise LoopValueError(f"{name} is not a valid bounding box name")
|
|
279
|
+
if iy == -1:
|
|
280
|
+
return self.origin[ix]
|
|
281
|
+
|
|
282
|
+
return self.bb[ix,]
|
|
283
|
+
|
|
284
|
+
def __getitem__(self, name):
|
|
285
|
+
if isinstance(name, str):
|
|
286
|
+
return self.get_value(name)
|
|
287
|
+
elif isinstance(name, tuple):
|
|
288
|
+
return self.origin
|
|
289
|
+
return self.get_value(name)
|
|
290
|
+
|
|
291
|
+
def is_inside(self, xyz):
|
|
292
|
+
xyz = np.array(xyz)
|
|
293
|
+
if len(xyz.shape) == 1:
|
|
294
|
+
xyz = xyz.reshape((1, -1))
|
|
295
|
+
if xyz.shape[1] != 3:
|
|
296
|
+
raise LoopValueError(
|
|
297
|
+
f"locations array is {xyz.shape[1]}D but bounding box is {self.dimensions}"
|
|
298
|
+
)
|
|
299
|
+
inside = np.ones(xyz.shape[0], dtype=bool)
|
|
300
|
+
inside = np.logical_and(inside, xyz[:, 0] > self.origin[0])
|
|
301
|
+
inside = np.logical_and(inside, xyz[:, 0] < self.maximum[0])
|
|
302
|
+
inside = np.logical_and(inside, xyz[:, 1] > self.origin[1])
|
|
303
|
+
inside = np.logical_and(inside, xyz[:, 1] < self.maximum[1])
|
|
304
|
+
inside = np.logical_and(inside, xyz[:, 2] > self.origin[2])
|
|
305
|
+
inside = np.logical_and(inside, xyz[:, 2] < self.maximum[2])
|
|
306
|
+
return inside
|
|
307
|
+
|
|
308
|
+
def regular_grid(
|
|
309
|
+
self,
|
|
310
|
+
nsteps: Optional[Union[list, np.ndarray]] = None,
|
|
311
|
+
shuffle: bool = False,
|
|
312
|
+
order: str = "C",
|
|
313
|
+
local: bool = True,
|
|
314
|
+
) -> np.ndarray:
|
|
315
|
+
"""Get the grid of points from the bounding box
|
|
316
|
+
|
|
317
|
+
Parameters
|
|
318
|
+
----------
|
|
319
|
+
nsteps : Optional[Union[list, np.ndarray]], optional
|
|
320
|
+
number of steps, by default None uses self.nsteps
|
|
321
|
+
shuffle : bool, optional
|
|
322
|
+
Whether to return points in order or random, by default False
|
|
323
|
+
order : str, optional
|
|
324
|
+
when flattening using numpy "C" or "F", by default "C"
|
|
325
|
+
local : bool, optional
|
|
326
|
+
Whether to return the points in the local coordinate system of global
|
|
327
|
+
, by default True
|
|
328
|
+
|
|
329
|
+
Returns
|
|
330
|
+
-------
|
|
331
|
+
np.ndarray
|
|
332
|
+
numpy array N,3 of the points
|
|
333
|
+
"""
|
|
334
|
+
|
|
335
|
+
if nsteps is None:
|
|
336
|
+
nsteps = self.nsteps
|
|
337
|
+
coordinates = [
|
|
338
|
+
np.linspace(self.origin[i], self.maximum[i], nsteps[i]) for i in range(self.dimensions)
|
|
339
|
+
]
|
|
340
|
+
|
|
341
|
+
if not local:
|
|
342
|
+
coordinates = [
|
|
343
|
+
np.linspace(self.global_origin[i], self.global_maximum[i], nsteps[i])
|
|
344
|
+
for i in range(self.dimensions)
|
|
345
|
+
]
|
|
346
|
+
coordinate_grid = np.meshgrid(*coordinates, indexing="ij")
|
|
347
|
+
locs = np.array([coord.flatten(order=order) for coord in coordinate_grid]).T
|
|
348
|
+
|
|
349
|
+
if shuffle:
|
|
350
|
+
# logger.info("Shuffling points")
|
|
351
|
+
rng.shuffle(locs)
|
|
352
|
+
return locs
|
|
353
|
+
|
|
354
|
+
def cell_centers(self, order: str = "F") -> np.ndarray:
|
|
355
|
+
"""Get the cell centers of a regular grid
|
|
356
|
+
|
|
357
|
+
Parameters
|
|
358
|
+
----------
|
|
359
|
+
order : str, optional
|
|
360
|
+
order of the grid, by default "C"
|
|
361
|
+
|
|
362
|
+
Returns
|
|
363
|
+
-------
|
|
364
|
+
np.ndarray
|
|
365
|
+
array of cell centers
|
|
366
|
+
"""
|
|
367
|
+
locs = self.regular_grid(order=order, nsteps=self.nsteps - 1)
|
|
368
|
+
|
|
369
|
+
return locs + 0.5 * self.step_vector
|
|
370
|
+
|
|
371
|
+
def to_dict(self) -> dict:
|
|
372
|
+
"""Export the defining characteristics of the bounding
|
|
373
|
+
box to a dictionary for json serialisation
|
|
374
|
+
|
|
375
|
+
Returns
|
|
376
|
+
-------
|
|
377
|
+
dict
|
|
378
|
+
dictionary with origin, maximum and nsteps
|
|
379
|
+
"""
|
|
380
|
+
return {
|
|
381
|
+
"origin": self.origin.tolist(),
|
|
382
|
+
"maximum": self.maximum.tolist(),
|
|
383
|
+
"nsteps": self.nsteps.tolist(),
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
def vtk(self):
|
|
387
|
+
"""Export the model as a pyvista RectilinearGrid
|
|
388
|
+
|
|
389
|
+
Returns
|
|
390
|
+
-------
|
|
391
|
+
pv.RectilinearGrid
|
|
392
|
+
a pyvista grid object
|
|
393
|
+
|
|
394
|
+
Raises
|
|
395
|
+
------
|
|
396
|
+
ImportError
|
|
397
|
+
If pyvista is not installed raise import error
|
|
398
|
+
"""
|
|
399
|
+
try:
|
|
400
|
+
import pyvista as pv
|
|
401
|
+
except ImportError:
|
|
402
|
+
raise ImportError("pyvista is required for vtk support")
|
|
403
|
+
x = np.linspace(self.global_origin[0], self.global_maximum[0], self.nsteps[0])
|
|
404
|
+
y = np.linspace(self.global_origin[1], self.global_maximum[1], self.nsteps[1])
|
|
405
|
+
z = np.linspace(self.global_origin[2], self.global_maximum[2], self.nsteps[2])
|
|
406
|
+
return pv.RectilinearGrid(
|
|
407
|
+
x,
|
|
408
|
+
y,
|
|
409
|
+
z,
|
|
410
|
+
)
|
|
411
|
+
|
|
412
|
+
def structured_grid(
|
|
413
|
+
self, cell_data: Dict[str, np.ndarray] = {}, vertex_data={}, name: str = "bounding_box"
|
|
414
|
+
):
|
|
415
|
+
return StructuredGrid(
|
|
416
|
+
origin=self.global_origin,
|
|
417
|
+
step_vector=self.step_vector,
|
|
418
|
+
nsteps=self.nsteps,
|
|
419
|
+
cell_properties=cell_data,
|
|
420
|
+
properties=vertex_data,
|
|
421
|
+
name=name,
|
|
422
|
+
)
|