LoopStructural 1.0.3__zip → 1.0.71.dev0__zip
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.
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__init__.py +12 -7
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/datasets/__pycache__/_base.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__init__.py +3 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/base_structured_3d_support.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_fold_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/discrete_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/finite_difference_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/geological_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/operator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/piecewiselinear_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_grid.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/structured_tetra.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/__pycache__/surfe_wrapper.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/base_structured_3d_support.py +101 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.c +4137 -2716
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/cython/dsi_helper.cp36-win_amd64.pyd +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/discrete_fold_interpolator.py +56 -22
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/discrete_interpolator.py +61 -28
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/finite_difference_interpolator.py +71 -11
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/geological_interpolator.py +22 -3
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/operator.py +16 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/piecewiselinear_interpolator.py +150 -11
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/structured_grid.py +31 -69
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/structured_tetra.py +89 -45
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/interpolators/surfe_wrapper.py +7 -8
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/geological_model.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/geological_model_graph.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/__pycache__/stratigraphic_column.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/geological_model.py +515 -197
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/geological_model_graph.py +881 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/core/stratigraphic_column.py +5 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__init__.py +1 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_function_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/__pycache__/fault_segment.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_builder.py +127 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_function.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_function_feature.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fault/fault_segment.py +30 -3
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__init__.py +1 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/cross_product_geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/geological_feature_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/lambda_geological_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/region_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/structural_frame_builder.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/__pycache__/unconformity_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/cross_product_geological_feature.py +18 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/geological_feature.py +22 -49
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/geological_feature_builder.py +171 -47
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/lambda_geological_feature.py +31 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/region_feature.py +3 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/structural_frame.py +28 -11
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/structural_frame_builder.py +32 -22
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/features/unconformity_feature.py +6 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/fold_rotation_angle_feature.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/foldframe.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/__pycache__/svariogram.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold.py +13 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold_rotation_angle.py +5 -4
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/fold_rotation_angle_feature.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/foldframe.py +7 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/modelling/fold/svariogram.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__init__.py +5 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/bounding_box.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/exceptions.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/helper.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/logging.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/map2loop.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/regions.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/utils.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/bounding_box.py +21 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/exceptions.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/helper.py +10 -2
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/logging.py +60 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/map2loop.py +128 -37
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/regions.py +11 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/utils.py +40 -47
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/map_viewer.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_plotter.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/model_visualisation.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/rotation_angle_plotter.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/sphinx_scraper.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/__pycache__/stratigraphic_column.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/map_viewer.py +236 -36
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/model_plotter.py +2 -1
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/model_visualisation.py +427 -79
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/rotation_angle_plotter.py +29 -12
- Miniconda/envs/loop/Lib/site-packages/LoopStructural/visualisation/stratigraphic_column.py +60 -0
- Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.3-py3.6.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/PKG-INFO +1 -1
- Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.3-py3.6.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/SOURCES.txt +10 -5
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.71.dev0-py3.6.egg-info/requires.txt +8 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/__init__.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/LoopStructural-1.0.3-py3.6.egg-info/requires.txt +0 -3
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_faults.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_fold.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_interpolator.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/__pycache__/test_refolded.cpython-36.pyc +0 -0
- Miniconda/envs/loop/Lib/site-packages/tests/test_faults.py +0 -17
- Miniconda/envs/loop/Lib/site-packages/tests/test_fold.py +0 -57
- Miniconda/envs/loop/Lib/site-packages/tests/test_interpolator.py +0 -88
- Miniconda/envs/loop/Lib/site-packages/tests/test_refolded.py +0 -22
- /Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.3-py3.6.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/dependency_links.txt +0 -0
- /Miniconda/envs/loop/Lib/site-packages/{LoopStructural-1.0.3-py3.6.egg-info → LoopStructural-1.0.71.dev0-py3.6.egg-info}/top_level.txt +0 -0
|
@@ -7,7 +7,8 @@ from LoopStructural.modelling.fold.fold_rotation_angle_feature import \
|
|
|
7
7
|
fourier_series
|
|
8
8
|
from LoopStructural.modelling.fold import SVariogram
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
from LoopStructural.utils import getLogger
|
|
11
|
+
logger = getLogger(__name__)
|
|
11
12
|
|
|
12
13
|
|
|
13
14
|
class FoldRotationAngle:
|
|
@@ -31,7 +32,7 @@ class FoldRotationAngle:
|
|
|
31
32
|
self.svario = SVariogram(self.fold_frame_coordinate, self.rotation_angle)
|
|
32
33
|
self.fitted_params = None
|
|
33
34
|
|
|
34
|
-
def fit_fourier_series(self, wl = None, lags = None, nlag = None, lag = None):
|
|
35
|
+
def fit_fourier_series(self, wl = None, lags = None, nlag = None, lag = None, skip_variogram=False,**kwargs):
|
|
35
36
|
"""
|
|
36
37
|
|
|
37
38
|
Parameters
|
|
@@ -48,8 +49,8 @@ class FoldRotationAngle:
|
|
|
48
49
|
if self.svario is None:
|
|
49
50
|
self.svario = SVariogram(self.fold_frame_coordinate,
|
|
50
51
|
self.rotation_angle)
|
|
51
|
-
|
|
52
|
-
|
|
52
|
+
if skip_variogram == False:
|
|
53
|
+
self.svario.calc_semivariogram(lags=lags, nlag=nlag, lag=lag)
|
|
53
54
|
if wl is None:
|
|
54
55
|
wl = self.svario.find_wavelengths(lags=lags, nlag=nlag, lag=lag)
|
|
55
56
|
# for now only consider single fold wavelength
|
|
@@ -4,7 +4,8 @@ import numpy as np
|
|
|
4
4
|
|
|
5
5
|
from LoopStructural.modelling.features.structural_frame import StructuralFrame
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
from LoopStructural.utils import getLogger
|
|
8
|
+
logger = getLogger(__name__)
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
class FoldFrame(StructuralFrame):
|
|
@@ -21,10 +22,7 @@ class FoldFrame(StructuralFrame):
|
|
|
21
22
|
super().__init__(name, features, fold)
|
|
22
23
|
self.model = None
|
|
23
24
|
|
|
24
|
-
def
|
|
25
|
-
self.model = model
|
|
26
|
-
|
|
27
|
-
def calculate_fold_axis_rotation(self, feature_builder):
|
|
25
|
+
def calculate_fold_axis_rotation(self, feature_builder,fold_axis=None):
|
|
28
26
|
"""
|
|
29
27
|
Calculate the fold axis rotation angle by finding the angle between the
|
|
30
28
|
intersection lineation and the gradient to the 1st coordinate of the
|
|
@@ -45,6 +43,9 @@ class FoldFrame(StructuralFrame):
|
|
|
45
43
|
points.append(gpoints)
|
|
46
44
|
if npoints.shape[0] > 0:
|
|
47
45
|
points.append(npoints)
|
|
46
|
+
if fold_axis is not None:
|
|
47
|
+
if fold_axis.shape[0] > 0 and fold_axis.shape[1] == 6:
|
|
48
|
+
points.append(fold_axis)
|
|
48
49
|
if len(points) == 0:
|
|
49
50
|
return 0, 0
|
|
50
51
|
points = np.vstack(points)
|
|
@@ -119,6 +120,7 @@ class FoldFrame(StructuralFrame):
|
|
|
119
120
|
# get the normals from the points array
|
|
120
121
|
s0g = points[:, 3:]
|
|
121
122
|
|
|
123
|
+
s0g/=np.linalg.norm(s0g,axis=1)[:,None]
|
|
122
124
|
# calculate the gradient and value of the first coordinate of the
|
|
123
125
|
# fold frame
|
|
124
126
|
# for the locations and normalise
|
|
@@ -11,4 +11,8 @@ Submodules
|
|
|
11
11
|
utils
|
|
12
12
|
|
|
13
13
|
"""
|
|
14
|
-
from .
|
|
14
|
+
from .logging import getLogger, log_to_file, log_to_console
|
|
15
|
+
from .map2loop import process_map2loop, build_model
|
|
16
|
+
from .helper import get_data_axis_aligned_bounding_box, get_data_bounding_box, get_data_bounding_box_map
|
|
17
|
+
from .helper import get_dip_vector,get_strike_vector, get_vectors
|
|
18
|
+
from .regions import RegionEverywhere
|
Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/__init__.cpython-36.pyc
CHANGED
|
Binary file
|
Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/bounding_box.cpython-36.pyc
ADDED
|
Binary file
|
Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/exceptions.cpython-36.pyc
CHANGED
|
Binary file
|
Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/helper.cpython-36.pyc
CHANGED
|
Binary file
|
|
Binary file
|
Miniconda/envs/loop/Lib/site-packages/LoopStructural/utils/__pycache__/map2loop.cpython-36.pyc
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# class BoundingBox:
|
|
2
|
+
# def __init__(self,origin,maximum):
|
|
3
|
+
# self.bb = np.array([origin,maximum])
|
|
4
|
+
# self.maximum = maximum
|
|
5
|
+
# self.name_map = {'xmin':(0,0),'ymin':(0,1),'zmin':(0,2),'xmax':(1,0),'ymax':(1,1),'zmax':(1,2)
|
|
6
|
+
# 'lower':(0,2),'upper':(1,2),
|
|
7
|
+
# 'minx':(0,0),'miny':(0,1),'minz':(0,2),'maxx':(1,0),'maxy':(1,1),'maxz':(1,2)}
|
|
8
|
+
# def get_value(self,name):
|
|
9
|
+
# ix,iy = self.name_map.get(name,(-1,-1))
|
|
10
|
+
|
|
11
|
+
# return self.bb[ix,]
|
|
12
|
+
|
|
13
|
+
# def is_inside(self,xyz):
|
|
14
|
+
# inside = np.zeros(xy.shape[0],dtype=bool)
|
|
15
|
+
# inside = np.logical_and(inside,xyz[:,0]>self.bb[0,0])
|
|
16
|
+
# inside = np.logical_and(inside,xyz[:,0]<self.bb[1,0])
|
|
17
|
+
# inside = np.logical_and(inside,xyz[:,1]>self.bb[0,1])
|
|
18
|
+
# inside = np.logical_and(inside,xyz[:,1]<self.bb[1,1])
|
|
19
|
+
# inside = np.logical_and(inside,xyz[:,2]>self.bb[0,2])
|
|
20
|
+
# inside = np.logical_and(inside,xyz[:,2]<self.bb[1,2])
|
|
21
|
+
# return inside
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
4
5
|
from sklearn.decomposition import PCA
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
from LoopStructural.utils import getLogger
|
|
8
|
+
logger = getLogger(__name__)
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
def get_data_axis_aligned_bounding_box(xyz, buffer):
|
|
@@ -366,9 +368,15 @@ def val_name():
|
|
|
366
368
|
def coord_name():
|
|
367
369
|
return ['coord']
|
|
368
370
|
|
|
371
|
+
def interface_name():
|
|
372
|
+
return ['interface']
|
|
373
|
+
|
|
374
|
+
|
|
369
375
|
def feature_name():
|
|
370
376
|
return ['feature_name']
|
|
371
377
|
|
|
372
378
|
def all_heading():
|
|
373
379
|
return xyz_names() + normal_vec_names() + tangent_vec_names() + \
|
|
374
|
-
gradient_vec_names() + weight_name() + val_name() + coord_name() + feature_name()
|
|
380
|
+
gradient_vec_names() + weight_name() + val_name() + coord_name() + feature_name() + interface_name()
|
|
381
|
+
def empty_dataframe():
|
|
382
|
+
empty_data_frame =pd.DataFrame(columns=[all_heading()])
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
import LoopStructural
|
|
3
|
+
|
|
4
|
+
def get_levels():
|
|
5
|
+
"""dict for converting to logger levels from string
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
Returns
|
|
9
|
+
-------
|
|
10
|
+
dict
|
|
11
|
+
contains all strings with corresponding logging levels.
|
|
12
|
+
"""
|
|
13
|
+
return {'info':logging.INFO,'warning':logging.WARNING,'error':logging.ERROR,'debug':logging.DEBUG}
|
|
14
|
+
|
|
15
|
+
def getLogger(name):
|
|
16
|
+
logger = logging.getLogger(name)
|
|
17
|
+
logger.addHandler(LoopStructural.ch)
|
|
18
|
+
LoopStructural.loggers[name] = logger
|
|
19
|
+
return logger
|
|
20
|
+
|
|
21
|
+
def log_to_file(filename,level='info'):
|
|
22
|
+
"""Set the logging parameters for log file
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
Parameters
|
|
26
|
+
----------
|
|
27
|
+
filename : string
|
|
28
|
+
name of file or path to file
|
|
29
|
+
level : str, optional
|
|
30
|
+
'info', 'warning', 'error', 'debug' mapped to logging levels, by default 'info'
|
|
31
|
+
"""
|
|
32
|
+
levels = get_levels()
|
|
33
|
+
level = levels.get(level,logging.WARNING)
|
|
34
|
+
fh = logging.FileHandler(filename)
|
|
35
|
+
fh.setFormatter(LoopStructural.formatter)
|
|
36
|
+
fh.setLevel(level)
|
|
37
|
+
for logger in LoopStructural.loggers.values():
|
|
38
|
+
for hdlr in logger.handlers[:]: # remove the existing file handlers
|
|
39
|
+
if isinstance(hdlr,logging.FileHandler): #fixed two typos here
|
|
40
|
+
logger.removeHandler(hdlr)
|
|
41
|
+
logger.addHandler(fh)
|
|
42
|
+
logger.setLevel(level)
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def log_to_console(level='warning'):
|
|
46
|
+
"""Set the level of logging to the console
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
Parameters
|
|
50
|
+
----------
|
|
51
|
+
level : str, optional
|
|
52
|
+
'info', 'warning', 'error', 'debug' mapped to logging levels, by default 'info'
|
|
53
|
+
"""
|
|
54
|
+
levels = get_levels()
|
|
55
|
+
level = levels.get(level,logging.WARNING)
|
|
56
|
+
for logger in LoopStructural.loggers.values():
|
|
57
|
+
for hdlr in logger.handlers:
|
|
58
|
+
# both stream and file are base stream, so check if not a filehandler
|
|
59
|
+
if not isinstance(hdlr,logging.FileHandler):
|
|
60
|
+
hdlr.setLevel(level)
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import pandas as pd
|
|
2
2
|
import numpy as np
|
|
3
|
+
import os
|
|
3
4
|
import logging
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
from LoopStructural.utils import getLogger
|
|
7
|
+
logger = getLogger(__name__)
|
|
6
8
|
|
|
7
9
|
def process_map2loop(m2l_directory, flags={}):
|
|
8
10
|
"""
|
|
@@ -17,16 +19,20 @@ def process_map2loop(m2l_directory, flags={}):
|
|
|
17
19
|
m2l_data : dict
|
|
18
20
|
a dictionary containing the extracted and collated data
|
|
19
21
|
"""
|
|
22
|
+
gradient = flags.get('gradient',False)
|
|
23
|
+
vector_scale = flags.get('vector_scale',None)
|
|
20
24
|
tangents = pd.read_csv(m2l_directory + '/tmp/raw_contacts.csv')
|
|
21
|
-
groups = pd.read_csv(m2l_directory + '/tmp/
|
|
22
|
-
contact_orientations = pd.read_csv(m2l_directory + '/output/
|
|
25
|
+
groups = pd.read_csv(m2l_directory + '/tmp/all_sorts_clean.csv', index_col=0)
|
|
26
|
+
contact_orientations = pd.read_csv(m2l_directory + '/output/orientations_clean.csv')
|
|
23
27
|
# formation_thickness = pd.read_csv)
|
|
24
|
-
contacts = pd.read_csv(m2l_directory + '/output/
|
|
28
|
+
contacts = pd.read_csv(m2l_directory + '/output/contacts_clean.csv')
|
|
25
29
|
displacements = pd.read_csv(m2l_directory + '/output/fault_displacements3.csv')
|
|
26
30
|
fault_orientations = pd.read_csv(m2l_directory + '/output/fault_orientations.csv')
|
|
27
31
|
fault_locations = pd.read_csv(m2l_directory + '/output/faults.csv')
|
|
28
32
|
fault_fault_relations = pd.read_csv(m2l_directory + '/output/fault-fault-relationships.csv')
|
|
29
33
|
fault_strat_relations = pd.read_csv(m2l_directory + '/output/group-fault-relationships.csv')
|
|
34
|
+
fault_dimensions = pd.read_csv(m2l_directory + '/output/fault_dimensions.csv')
|
|
35
|
+
|
|
30
36
|
supergroups = {}
|
|
31
37
|
sgi = 0
|
|
32
38
|
try:
|
|
@@ -64,9 +70,10 @@ def process_map2loop(m2l_directory, flags={}):
|
|
|
64
70
|
i = 0
|
|
65
71
|
thickness = {}
|
|
66
72
|
max_thickness = 0
|
|
67
|
-
|
|
73
|
+
thickness_file = flags.get('thickness',m2l_directory + '/output/formation_summary_thicknesses.csv')
|
|
74
|
+
with open(thickness_file) as file:
|
|
68
75
|
for l in file:
|
|
69
|
-
if i
|
|
76
|
+
if i>=1:
|
|
70
77
|
linesplit = l.split(',')
|
|
71
78
|
thickness[linesplit[0]] = float(linesplit[1])
|
|
72
79
|
# normalise the thicknesses
|
|
@@ -76,14 +83,28 @@ def process_map2loop(m2l_directory, flags={}):
|
|
|
76
83
|
i+=1
|
|
77
84
|
# for k in thickness.keys():
|
|
78
85
|
# thickness[k] /= max_thickness
|
|
86
|
+
if vector_scale is None:
|
|
87
|
+
vector_scale = max_thickness
|
|
79
88
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
89
|
+
if gradient:
|
|
90
|
+
from LoopStructural.utils.helper import strike_dip_vector
|
|
91
|
+
contact_orientations['strike'] = contact_orientations['azimuth'] - 90
|
|
92
|
+
contact_orientations['gx'] = np.nan
|
|
93
|
+
contact_orientations['gy'] = np.nan
|
|
94
|
+
contact_orientations['gz'] = np.nan
|
|
95
|
+
contact_orientations[['gx', 'gy', 'gz']] = strike_dip_vector(contact_orientations['strike'],
|
|
96
|
+
contact_orientations['dip'])*max_thickness
|
|
97
|
+
if np.sum(contact_orientations['polarity']==0) >0 and np.sum(contact_orientations['polarity']==-1)==0:
|
|
98
|
+
# contact_orientations['polarity']+=1
|
|
99
|
+
contact_orientations.loc[contact_orientations['polarity']==0]=-1
|
|
100
|
+
if not gradient:
|
|
101
|
+
from LoopStructural.utils.helper import strike_dip_vector
|
|
102
|
+
contact_orientations['strike'] = contact_orientations['azimuth'] - 90
|
|
103
|
+
contact_orientations['nx'] = np.nan
|
|
104
|
+
contact_orientations['ny'] = np.nan
|
|
105
|
+
contact_orientations['nz'] = np.nan
|
|
106
|
+
contact_orientations[['nx', 'ny', 'nz']] = strike_dip_vector(contact_orientations['strike'],
|
|
107
|
+
contact_orientations['dip'])*vector_scale *contact_orientations['polarity'].to_numpy()[:,None]
|
|
87
108
|
contact_orientations.drop(['strike', 'dip', 'azimuth'], inplace=True, axis=1)
|
|
88
109
|
# with open(m2l_directory + '/output/formation_summary_thicknesses.csv') as file:
|
|
89
110
|
|
|
@@ -101,12 +122,12 @@ def process_map2loop(m2l_directory, flags={}):
|
|
|
101
122
|
stratigraphic_column[g] = {}
|
|
102
123
|
val[g] = 0
|
|
103
124
|
|
|
104
|
-
for c in groups.loc[groups['group number'] == i, 'code']:
|
|
125
|
+
for c, colour in zip(groups.loc[groups['group number'] == i, 'code'],groups.loc[groups['group number'] == i, 'colour']):
|
|
105
126
|
strat_val[c] = np.nan
|
|
106
127
|
if c in thickness:
|
|
107
|
-
stratigraphic_column[g][c] = {'max': val[g], 'min': val[g] - thickness[c], 'id': unit_id}
|
|
128
|
+
stratigraphic_column[g][c] = {'max': val[g], 'min': val[g] - thickness[c], 'id': unit_id, 'colour':colour}
|
|
108
129
|
unit_id += 1
|
|
109
|
-
strat_val[c] = val[g]
|
|
130
|
+
strat_val[c] = val[g] - thickness[c]
|
|
110
131
|
val[g] -= thickness[c]
|
|
111
132
|
group_name = None
|
|
112
133
|
for g, i in stratigraphic_column.items():
|
|
@@ -125,10 +146,18 @@ def process_map2loop(m2l_directory, flags={}):
|
|
|
125
146
|
group_name = None
|
|
126
147
|
except:
|
|
127
148
|
print('Couldnt process {}'.format(g))
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
149
|
+
#whether to use thickness or interface
|
|
150
|
+
use_thickness = flags.get('use_thickness',True)
|
|
151
|
+
if use_thickness:
|
|
152
|
+
contacts['val'] = np.nan
|
|
153
|
+
for o in strat_val:
|
|
154
|
+
contacts.loc[contacts['formation'] == o, 'val'] = strat_val[o]
|
|
155
|
+
if use_thickness == False:
|
|
156
|
+
contacts['interface'] = np.nan
|
|
157
|
+
interface_val = 0
|
|
158
|
+
for u in contacts['formation'].unique():
|
|
159
|
+
contacts.loc[contacts['formation'] == u,'interface'] = interface_val
|
|
160
|
+
interface_val+=1
|
|
132
161
|
tangents['feature_name'] = tangents['group']
|
|
133
162
|
contact_orientations['feature_name'] = None
|
|
134
163
|
contacts['feature_name'] = None
|
|
@@ -142,35 +171,84 @@ def process_map2loop(m2l_directory, flags={}):
|
|
|
142
171
|
displacements.loc[displacements['fname'] == fname, 'dip_dir'] = np.mean(
|
|
143
172
|
fault_orientations.loc[fault_orientations['formation'] == fname, 'DipDirection'])
|
|
144
173
|
max_displacement = {}
|
|
174
|
+
downthrow_dir = {}
|
|
175
|
+
fault_locations['val'] = 0
|
|
176
|
+
fault_locations['coord'] = 0
|
|
177
|
+
fault_orientations['coord'] = 0
|
|
178
|
+
fault_orientations['gx'] = np.nan
|
|
179
|
+
fault_orientations['gy'] = np.nan
|
|
180
|
+
fault_orientations['gz'] = np.nan
|
|
181
|
+
|
|
182
|
+
stratigraphic_column['faults'] = {}
|
|
145
183
|
for f in displacements['fname'].unique():
|
|
184
|
+
fault_centers = np.zeros(6)
|
|
185
|
+
normal_vector = np.zeros(3)
|
|
186
|
+
strike_vector = np.zeros(3)
|
|
187
|
+
slip_vector = np.zeros(3)
|
|
188
|
+
|
|
189
|
+
fault_edges = np.zeros((2,3))
|
|
190
|
+
fault_tips = np.zeros((2,3))
|
|
191
|
+
fault_depth = np.zeros((2,3))
|
|
146
192
|
displacements_numpy = displacements.loc[
|
|
147
|
-
displacements['fname'] == f, ['vertical_displacement', 'downthrow_dir', 'dip_dir']].to_numpy()
|
|
193
|
+
displacements['fname'] == f, ['vertical_displacement', 'downthrow_dir', 'dip_dir','X','Y']].to_numpy()
|
|
148
194
|
# index = np.argmax(np.abs(displacements_numpy[:, 0]), )
|
|
149
195
|
index = np.argsort(np.abs(displacements_numpy[:, 0]))[len(np.abs(displacements_numpy[:, 0]))//2]
|
|
150
|
-
|
|
196
|
+
|
|
151
197
|
max_displacement[f] = displacements_numpy[
|
|
152
198
|
index, 0]
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
199
|
+
downthrow_dir[f] = displacements_numpy[index,[1,3,4]]
|
|
200
|
+
if np.abs(displacements_numpy[index, 1] - displacements_numpy[index, 2]) > 90:
|
|
201
|
+
# fault_orientations.loc[fault_orientations['formation'] == f, ['gx','gy','gy']]=-fault_orientations.loc[fault_orientations['formation'] == f, ['gx','gy','gy']]
|
|
202
|
+
fault_orientations.loc[fault_orientations['formation'] == f, 'DipDirection'] -= 180#displacements_numpy[
|
|
203
|
+
# index, 1]
|
|
204
|
+
# find the middle of the fault as the mean of the line, average dip direction and the influence distance
|
|
205
|
+
fault_centers[:3] = np.mean(fault_locations.loc[fault_locations['formation']==f,['X','Y','Z']],axis=0)
|
|
206
|
+
fault_centers[3] = np.mean(fault_orientations.loc[fault_orientations['formation']==f,['DipDirection']])
|
|
207
|
+
fault_centers[4] = fault_dimensions.loc[fault_dimensions['Fault']==f,'InfluenceDistance']
|
|
208
|
+
fault_centers[5] = fault_dimensions.loc[fault_dimensions['Fault']==f,'HorizontalRadius']
|
|
209
|
+
stratigraphic_column['faults'][f] = {'FaultCenter':fault_centers[:3],
|
|
210
|
+
'FaultDipDirection':fault_centers[3],
|
|
211
|
+
'InfluenceDistance':fault_dimensions.loc[fault_dimensions['Fault']==f,'InfluenceDistance'].to_numpy(),
|
|
212
|
+
'HorizontalRadius':fault_dimensions.loc[fault_dimensions['Fault']==f,'HorizontalRadius'].to_numpy(),
|
|
213
|
+
'VerticalRadius':fault_dimensions.loc[fault_dimensions['Fault']==f,'VerticalRadius'].to_numpy()}
|
|
214
|
+
if 'colour' in fault_dimensions.columns:
|
|
215
|
+
stratigraphic_column['faults'][f]['colour'] = fault_dimensions.loc[fault_dimensions['Fault']==f,'colour'].to_numpy()
|
|
216
|
+
normal_vector[0] = np.sin(np.deg2rad(fault_centers[3]))
|
|
217
|
+
normal_vector[1] = np.cos(np.deg2rad(fault_centers[3]))
|
|
218
|
+
strike_vector[0] = normal_vector[1]
|
|
219
|
+
strike_vector[1] = -normal_vector[0]
|
|
220
|
+
slip_vector[2]=1
|
|
221
|
+
fault_edges[0,:] = fault_centers[:3]+normal_vector*fault_centers[4]
|
|
222
|
+
fault_edges[1,:] = fault_centers[:3]-normal_vector*fault_centers[4]
|
|
223
|
+
fault_tips[0,:] = fault_centers[:3]+strike_vector*fault_centers[5]
|
|
224
|
+
fault_tips[1,:] = fault_centers[:3]-strike_vector*fault_centers[5]
|
|
225
|
+
# fault_depth[0,:] = fault_centers[:3]+slip_vector*fault_centers[5]
|
|
226
|
+
# fault_depth[1,:] = fault_centers[:3]-slip_vector*fault_centers[5]
|
|
227
|
+
# fault_locations.loc[len(fault_locations),['X','Y','Z','formation','val','coord']] = [fault_edges[0,0],fault_edges[0,1],fault_edges[0,2],f,1,0]
|
|
228
|
+
# fault_locations.loc[len(fault_locations),['X','Y','Z','formation','val','coord']] = [fault_edges[1,0],fault_edges[1,1],fault_edges[1,2],f,-1,0]
|
|
229
|
+
# fault_locations.loc[len(fault_locations),['X','Y','Z','formation','val','coord']] = [fault_tips[0,0],fault_tips[0,1],fault_tips[0,2],f,1,2]
|
|
230
|
+
# fault_locations.loc[len(fault_locations),['X','Y','Z','formation','val','coord']] = [fault_tips[1,0],fault_tips[1,1],fault_tips[1,2],f,-1,2]
|
|
231
|
+
# # add strike vector to constraint fault extent
|
|
232
|
+
# fault_orientations.loc[len(fault_orientations),['X','Y','Z','formation','DipDirection','coord']] = [fault_centers[0],fault_centers[1],fault_centers[2],f, fault_centers[3]-90,2]
|
|
233
|
+
# fault_orientations.loc[len(fault_orientations),['X','Y','Z','formation','dip','coord']] = [fault_centers[0],fault_centers[1],fault_centers[2],f, 0,2]
|
|
234
|
+
|
|
235
|
+
# print('downthro',displacements_numpy[index, 1])
|
|
236
|
+
|
|
237
|
+
fault_orientations['strike'] = fault_orientations['DipDirection'] - 90
|
|
238
|
+
fault_orientations[['gx', 'gy', 'gz']] = strike_dip_vector(fault_orientations['strike'], fault_orientations['dip'])
|
|
157
239
|
for g in groups['group'].unique():
|
|
158
240
|
groups.loc[groups['group']==g,'group'] = supergroups[g]
|
|
159
|
-
fault_orientations['strike'] = fault_orientations['DipDirection'] - 90
|
|
160
|
-
fault_orientations['gx'] = np.nan
|
|
161
|
-
fault_orientations['gy'] = np.nan
|
|
162
|
-
fault_orientations['gz'] = np.nan
|
|
241
|
+
# fault_orientations['strike'] = fault_orientations['DipDirection'] - 90
|
|
242
|
+
# fault_orientations['gx'] = np.nan
|
|
243
|
+
# fault_orientations['gy'] = np.nan
|
|
244
|
+
# fault_orientations['gz'] = np.nan
|
|
163
245
|
|
|
164
|
-
fault_orientations[['gx', 'gy', 'gz']] = strike_dip_vector(fault_orientations['strike'], fault_orientations['dip'])
|
|
165
246
|
fault_orientations.drop(['strike', 'DipDirection', 'dip', 'DipPolarity'], inplace=True, axis=1)
|
|
166
247
|
fault_orientations['feature_name'] = fault_orientations['formation']
|
|
167
|
-
|
|
168
|
-
fault_locations['val'] = 0
|
|
169
248
|
fault_locations['feature_name'] = fault_locations['formation']
|
|
170
249
|
|
|
171
|
-
|
|
172
250
|
data = pd.concat([tangents, contact_orientations, contacts, fault_orientations, fault_locations])
|
|
173
|
-
data.reset_index()
|
|
251
|
+
data.reset_index(inplace=True)
|
|
174
252
|
|
|
175
253
|
return {'data': data,
|
|
176
254
|
'groups': groups,
|
|
@@ -178,9 +256,10 @@ def process_map2loop(m2l_directory, flags={}):
|
|
|
178
256
|
'fault_fault': fault_fault_relations,
|
|
179
257
|
'stratigraphic_column': stratigraphic_column,
|
|
180
258
|
'bounding_box':bb,
|
|
181
|
-
'strat_va':strat_val
|
|
259
|
+
'strat_va':strat_val,
|
|
260
|
+
'downthrow_dir':downthrow_dir}
|
|
182
261
|
|
|
183
|
-
def build_model(m2l_data, skip_faults = False, unconformities=False, fault_params = None, foliation_params=None, rescale = True):
|
|
262
|
+
def build_model(m2l_data, evaluate=True, skip_faults = False, unconformities=False, fault_params = None, foliation_params=None, rescale = True,**kwargs):
|
|
184
263
|
"""[summary]
|
|
185
264
|
|
|
186
265
|
[extended_summary]
|
|
@@ -230,9 +309,19 @@ def build_model(m2l_data, skip_faults = False, unconformities=False, fault_param
|
|
|
230
309
|
except:
|
|
231
310
|
logger.info('No entry for %s in fault_fault_relations' % f)
|
|
232
311
|
# continue
|
|
312
|
+
|
|
313
|
+
fault_center = m2l_data['stratigraphic_column']['faults'][f]['FaultCenter']
|
|
314
|
+
fault_influence = m2l_data['stratigraphic_column']['faults'][f]['InfluenceDistance']
|
|
315
|
+
fault_extent = m2l_data['stratigraphic_column']['faults'][f]['HorizontalRadius']
|
|
316
|
+
fault_vertical_radius = m2l_data['stratigraphic_column']['faults'][f]['VerticalRadius']
|
|
233
317
|
faults.append(model.create_and_add_fault(f,
|
|
234
318
|
-m2l_data['max_displacement'][f],
|
|
235
319
|
faultfunction='BaseFault',
|
|
320
|
+
fault_slip_vector=np.array([0.,0.,-1.]),
|
|
321
|
+
fault_center=fault_center,
|
|
322
|
+
fault_extent=fault_extent,
|
|
323
|
+
fault_influence=fault_influence,
|
|
324
|
+
fault_vectical_radius=fault_vertical_radius,
|
|
236
325
|
overprints=overprints,
|
|
237
326
|
**fault_params,
|
|
238
327
|
)
|
|
@@ -248,4 +337,6 @@ def build_model(m2l_data, skip_faults = False, unconformities=False, fault_param
|
|
|
248
337
|
if group_features[-1] and unconformities:
|
|
249
338
|
model.add_unconformity(group_features[-1], 0)
|
|
250
339
|
model.set_stratigraphic_column(m2l_data['stratigraphic_column'])
|
|
340
|
+
if evaluate:
|
|
341
|
+
model.update(verbose=True)
|
|
251
342
|
return model
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
3
|
import numpy as np
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
import re
|
|
5
|
+
from LoopStructural.utils import getLogger
|
|
6
|
+
logger = getLogger(__name__)
|
|
6
7
|
|
|
7
8
|
|
|
8
9
|
def strike_symbol(strike):
|
|
@@ -22,55 +23,47 @@ def strike_symbol(strike):
|
|
|
22
23
|
vec2 = np.array([-0.5, 0])
|
|
23
24
|
r2 = R @ vec2
|
|
24
25
|
return rotated, r2
|
|
25
|
-
def get_levels():
|
|
26
|
-
"""dict for converting to logger levels from string
|
|
27
26
|
|
|
28
27
|
|
|
28
|
+
def read_voxet(voxetname,propertyfile):
|
|
29
|
+
"""
|
|
30
|
+
Read a gocad property file and the geometry information from the .vo file
|
|
31
|
+
voxetname - is the path to the voxet file
|
|
32
|
+
propertyfile is the path to the binary file
|
|
29
33
|
Returns
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
origin numpy array
|
|
35
|
+
voxet_extent - is the length of each axis of the voxet
|
|
36
|
+
N is the number of steps in the voxet
|
|
37
|
+
array is the property values
|
|
38
|
+
steps is the size of the step vector for the voxet
|
|
33
39
|
"""
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
40
|
+
array = np.fromfile(propertyfile,dtype='float32')
|
|
41
|
+
array = array.astype('<f4') # little endian
|
|
42
|
+
with open(voxetname,'r') as file:
|
|
43
|
+
for l in file:
|
|
44
|
+
if 'AXIS_O ' in l:
|
|
45
|
+
origin = np.array(re.findall(r"[-+]?\d*\.?\d+|[-+]?\d+",l)).astype(float)
|
|
46
|
+
if 'AXIS_U ' in l:
|
|
47
|
+
U = float(re.findall(r'[\d\.\d]+',l)[0])
|
|
48
|
+
if 'AXIS_V ' in l:
|
|
49
|
+
V = float(re.findall(r'[\d\.\d]+',l)[1])
|
|
50
|
+
if 'AXIS_W ' in l:
|
|
51
|
+
W = float(re.findall(r'[\d\.\d]+',l)[2])
|
|
52
|
+
if 'AXIS_N ' in l:
|
|
53
|
+
N = np.array(re.findall(r'[\d\.\d]+',l)).astype(int)
|
|
54
|
+
voxet_extent = np.array([U,V,W])
|
|
55
|
+
steps = (voxet_extent ) / (N-1)
|
|
56
|
+
return origin, voxet_extent, N, array, steps
|
|
39
57
|
|
|
40
|
-
|
|
41
|
-
----------
|
|
42
|
-
filename : string
|
|
43
|
-
name of file or path to file
|
|
44
|
-
level : str, optional
|
|
45
|
-
'info', 'warning', 'error', 'debug' mapped to logging levels, by default 'info'
|
|
58
|
+
def write_property_to_gocad_voxet(propertyfilename, propertyvalues):
|
|
46
59
|
"""
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
filename=filename,
|
|
53
|
-
filemode='w')
|
|
54
|
-
|
|
55
|
-
def log_to_console(level='warning'):
|
|
56
|
-
"""Set the level of logging to the console
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Parameters
|
|
60
|
-
----------
|
|
61
|
-
level : str, optional
|
|
62
|
-
'info', 'warning', 'error', 'debug' mapped to logging levels, by default 'info'
|
|
60
|
+
This function writes a numpy array into the right format for a gocad
|
|
61
|
+
voxet property file. This assumet there is a property already added to the .vo file,
|
|
62
|
+
and is just updating the file.
|
|
63
|
+
propertyfile - string giving the path to the file to write
|
|
64
|
+
propertyvalues - numpy array nz,ny,nx ordering and in float format
|
|
63
65
|
"""
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
for h in logging.getLogger().handlers:
|
|
69
|
-
if type(h) is logging.StreamHandler:
|
|
70
|
-
h.setLevel(level)
|
|
71
|
-
changed_level = True
|
|
72
|
-
if not changed_level:
|
|
73
|
-
console = logging.StreamHandler()
|
|
74
|
-
console.setLevel(level)
|
|
75
|
-
# add the handler to the root logger
|
|
76
|
-
logging.getLogger().addHandler(console)
|
|
66
|
+
propertyvalues = propertyvalues.astype('>f4') #big endian
|
|
67
|
+
# array = propertyvalues.newbyteorder()
|
|
68
|
+
propertyvalues.tofile(propertyfilename)
|
|
69
|
+
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|