subsurface-terra 2025.1.0rc15__py3-none-any.whl → 2025.1.0rc17__py3-none-any.whl
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.
- subsurface/__init__.py +31 -31
- subsurface/_version.py +34 -21
- subsurface/api/__init__.py +13 -13
- subsurface/api/interfaces/__init__.py +3 -3
- subsurface/api/interfaces/stream.py +136 -136
- subsurface/api/reader/read_wells.py +78 -78
- subsurface/core/geological_formats/boreholes/_combine_trajectories.py +117 -117
- subsurface/core/geological_formats/boreholes/_map_attrs_to_survey.py +236 -234
- subsurface/core/geological_formats/boreholes/_survey_to_unstruct.py +163 -163
- subsurface/core/geological_formats/boreholes/boreholes.py +140 -140
- subsurface/core/geological_formats/boreholes/collars.py +26 -26
- subsurface/core/geological_formats/boreholes/survey.py +86 -86
- subsurface/core/geological_formats/fault.py +47 -47
- subsurface/core/reader_helpers/reader_unstruct.py +11 -11
- subsurface/core/reader_helpers/readers_data.py +130 -130
- subsurface/core/reader_helpers/readers_wells.py +13 -13
- subsurface/core/structs/__init__.py +3 -3
- subsurface/core/structs/base_structures/__init__.py +2 -2
- subsurface/core/structs/base_structures/_aux.py +69 -0
- subsurface/core/structs/base_structures/_liquid_earth_mesh.py +121 -121
- subsurface/core/structs/base_structures/_unstructured_data_constructor.py +70 -70
- subsurface/core/structs/base_structures/base_structures_enum.py +6 -6
- subsurface/core/structs/base_structures/structured_data.py +282 -282
- subsurface/core/structs/base_structures/unstructured_data.py +338 -319
- subsurface/core/structs/structured_elements/octree_mesh.py +10 -10
- subsurface/core/structs/structured_elements/structured_grid.py +59 -59
- subsurface/core/structs/structured_elements/structured_mesh.py +9 -9
- subsurface/core/structs/unstructured_elements/__init__.py +3 -3
- subsurface/core/structs/unstructured_elements/line_set.py +72 -72
- subsurface/core/structs/unstructured_elements/point_set.py +43 -43
- subsurface/core/structs/unstructured_elements/tetrahedron_mesh.py +35 -35
- subsurface/core/structs/unstructured_elements/triangular_surface.py +62 -62
- subsurface/core/utils/utils_core.py +38 -38
- subsurface/modules/reader/__init__.py +13 -13
- subsurface/modules/reader/faults/faults.py +80 -80
- subsurface/modules/reader/from_binary.py +46 -46
- subsurface/modules/reader/mesh/_GOCAD_mesh.py +82 -82
- subsurface/modules/reader/mesh/_trimesh_reader.py +447 -447
- subsurface/modules/reader/mesh/csv_mesh_reader.py +53 -53
- subsurface/modules/reader/mesh/dxf_reader.py +177 -177
- subsurface/modules/reader/mesh/glb_reader.py +30 -30
- subsurface/modules/reader/mesh/mx_reader.py +232 -232
- subsurface/modules/reader/mesh/obj_reader.py +53 -53
- subsurface/modules/reader/mesh/omf_mesh_reader.py +43 -43
- subsurface/modules/reader/mesh/surface_reader.py +56 -56
- subsurface/modules/reader/mesh/surfaces_api.py +41 -41
- subsurface/modules/reader/profiles/__init__.py +3 -3
- subsurface/modules/reader/profiles/profiles_core.py +197 -197
- subsurface/modules/reader/read_netcdf.py +38 -38
- subsurface/modules/reader/topography/__init__.py +7 -7
- subsurface/modules/reader/topography/topo_core.py +100 -100
- subsurface/modules/reader/volume/read_grav3d.py +447 -428
- subsurface/modules/reader/volume/read_volume.py +327 -230
- subsurface/modules/reader/volume/segy_reader.py +105 -105
- subsurface/modules/reader/volume/seismic.py +173 -173
- subsurface/modules/reader/volume/volume_utils.py +43 -43
- subsurface/modules/reader/wells/DEP/__init__.py +43 -43
- subsurface/modules/reader/wells/DEP/_well_files_reader.py +167 -167
- subsurface/modules/reader/wells/DEP/_wells_api.py +61 -61
- subsurface/modules/reader/wells/DEP/_welly_reader.py +180 -180
- subsurface/modules/reader/wells/DEP/pandas_to_welly.py +212 -212
- subsurface/modules/reader/wells/_read_to_df.py +57 -57
- subsurface/modules/reader/wells/read_borehole_interface.py +148 -148
- subsurface/modules/reader/wells/wells_utils.py +68 -68
- subsurface/modules/tools/mocking_aux.py +104 -104
- subsurface/modules/visualization/__init__.py +2 -2
- subsurface/modules/visualization/to_pyvista.py +320 -320
- subsurface/modules/writer/to_binary.py +12 -12
- subsurface/modules/writer/to_rex/common.py +78 -78
- subsurface/modules/writer/to_rex/data_struct.py +74 -74
- subsurface/modules/writer/to_rex/gempy_to_rexfile.py +791 -791
- subsurface/modules/writer/to_rex/material_encoder.py +44 -44
- subsurface/modules/writer/to_rex/mesh_encoder.py +152 -152
- subsurface/modules/writer/to_rex/to_rex.py +115 -115
- subsurface/modules/writer/to_rex/utils.py +15 -15
- subsurface/optional_requirements.py +116 -116
- {subsurface_terra-2025.1.0rc15.dist-info → subsurface_terra-2025.1.0rc17.dist-info}/METADATA +194 -194
- subsurface_terra-2025.1.0rc17.dist-info/RECORD +99 -0
- {subsurface_terra-2025.1.0rc15.dist-info → subsurface_terra-2025.1.0rc17.dist-info}/WHEEL +1 -1
- {subsurface_terra-2025.1.0rc15.dist-info → subsurface_terra-2025.1.0rc17.dist-info}/licenses/LICENSE +203 -203
- subsurface_terra-2025.1.0rc15.dist-info/RECORD +0 -98
- {subsurface_terra-2025.1.0rc15.dist-info → subsurface_terra-2025.1.0rc17.dist-info}/top_level.txt +0 -0
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
import numpy as np
|
|
2
|
-
|
|
3
|
-
__all__ = ['write_data_block_header', 'encode']
|
|
4
|
-
|
|
5
|
-
rexFileHeaderSize = 64
|
|
6
|
-
rexCoordSize = 22
|
|
7
|
-
|
|
8
|
-
file_header_size = 86
|
|
9
|
-
rexDataBlockHeaderSize = 16
|
|
10
|
-
|
|
11
|
-
file_header_and_data_header = 102
|
|
12
|
-
mesh_header_size = 128
|
|
13
|
-
all_header_size = 230
|
|
14
|
-
|
|
15
|
-
# Supported block types
|
|
16
|
-
# typeLineSet = 0
|
|
17
|
-
# typeText = 1
|
|
18
|
-
# typePointList = 2
|
|
19
|
-
typeMesh = 3
|
|
20
|
-
# typeImage = 4
|
|
21
|
-
# typeMaterial = 5
|
|
22
|
-
# typePeopleSimulation = 6
|
|
23
|
-
# typeUnityPackage = 7
|
|
24
|
-
# typeSceneNode = 8
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
n_bytes = 0
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
def write_data_block_header(size_data, data_id=1, data_type=3, version_data=1):
|
|
31
|
-
"""Function to write a DATA BLOCK header.
|
|
32
|
-
|
|
33
|
-
Args:
|
|
34
|
-
size_data: data block size (without header)
|
|
35
|
-
data_id: id which is used in the database
|
|
36
|
-
data_type (int): Type of data the data block contains:
|
|
37
|
-
* 0 LineSet A list of vertices which get connected by line segments
|
|
38
|
-
* 1 Text A position information and the actual text
|
|
39
|
-
* 2 PointList A list of 3D points with color information (e.g. point cloud)
|
|
40
|
-
* 3 Mesh A triangle mesh datastructure️
|
|
41
|
-
* 4 Image A single of arbitrary format can be stored in this block
|
|
42
|
-
* 5 MaterialStandard A standard (mesh) material definition
|
|
43
|
-
* 6 SceneNode A wrapper around a data block which can be used in the scenegraph
|
|
44
|
-
* 7 Track A track is a tracked position and orientation of an AR device
|
|
45
|
-
version_data: version for this data block
|
|
46
|
-
|
|
47
|
-
Returns:
|
|
48
|
-
|
|
49
|
-
"""
|
|
50
|
-
|
|
51
|
-
input_ = [(data_type, 'uint16'), # data type
|
|
52
|
-
(version_data, 'uint16'), # version for this data block
|
|
53
|
-
(size_data, 'uint32'), # data block size (without header)
|
|
54
|
-
(data_id, 'uint64')] # id which is used in the database
|
|
55
|
-
|
|
56
|
-
block_bytes = encode(input_)
|
|
57
|
-
return block_bytes
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def encode(input_: list):
|
|
61
|
-
"""Encode python objects - normally Python primitives or numpy arrays - into
|
|
62
|
-
its correspondent byte representation
|
|
63
|
-
|
|
64
|
-
Args:
|
|
65
|
-
input_ (List[tuples]): List of tuples: (object, type)
|
|
66
|
-
|
|
67
|
-
Returns:
|
|
68
|
-
byte: Array of bytes
|
|
69
|
-
"""
|
|
70
|
-
global n_bytes
|
|
71
|
-
block = bytearray()
|
|
72
|
-
|
|
73
|
-
for tup in input_:
|
|
74
|
-
arr = np.array(tup[0], dtype=tup[1]).tobytes()
|
|
75
|
-
n_bytes += len(arr)
|
|
76
|
-
block += arr
|
|
77
|
-
|
|
78
|
-
return block
|
|
1
|
+
import numpy as np
|
|
2
|
+
|
|
3
|
+
__all__ = ['write_data_block_header', 'encode']
|
|
4
|
+
|
|
5
|
+
rexFileHeaderSize = 64
|
|
6
|
+
rexCoordSize = 22
|
|
7
|
+
|
|
8
|
+
file_header_size = 86
|
|
9
|
+
rexDataBlockHeaderSize = 16
|
|
10
|
+
|
|
11
|
+
file_header_and_data_header = 102
|
|
12
|
+
mesh_header_size = 128
|
|
13
|
+
all_header_size = 230
|
|
14
|
+
|
|
15
|
+
# Supported block types
|
|
16
|
+
# typeLineSet = 0
|
|
17
|
+
# typeText = 1
|
|
18
|
+
# typePointList = 2
|
|
19
|
+
typeMesh = 3
|
|
20
|
+
# typeImage = 4
|
|
21
|
+
# typeMaterial = 5
|
|
22
|
+
# typePeopleSimulation = 6
|
|
23
|
+
# typeUnityPackage = 7
|
|
24
|
+
# typeSceneNode = 8
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
n_bytes = 0
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def write_data_block_header(size_data, data_id=1, data_type=3, version_data=1):
|
|
31
|
+
"""Function to write a DATA BLOCK header.
|
|
32
|
+
|
|
33
|
+
Args:
|
|
34
|
+
size_data: data block size (without header)
|
|
35
|
+
data_id: id which is used in the database
|
|
36
|
+
data_type (int): Type of data the data block contains:
|
|
37
|
+
* 0 LineSet A list of vertices which get connected by line segments
|
|
38
|
+
* 1 Text A position information and the actual text
|
|
39
|
+
* 2 PointList A list of 3D points with color information (e.g. point cloud)
|
|
40
|
+
* 3 Mesh A triangle mesh datastructure️
|
|
41
|
+
* 4 Image A single of arbitrary format can be stored in this block
|
|
42
|
+
* 5 MaterialStandard A standard (mesh) material definition
|
|
43
|
+
* 6 SceneNode A wrapper around a data block which can be used in the scenegraph
|
|
44
|
+
* 7 Track A track is a tracked position and orientation of an AR device
|
|
45
|
+
version_data: version for this data block
|
|
46
|
+
|
|
47
|
+
Returns:
|
|
48
|
+
|
|
49
|
+
"""
|
|
50
|
+
|
|
51
|
+
input_ = [(data_type, 'uint16'), # data type
|
|
52
|
+
(version_data, 'uint16'), # version for this data block
|
|
53
|
+
(size_data, 'uint32'), # data block size (without header)
|
|
54
|
+
(data_id, 'uint64')] # id which is used in the database
|
|
55
|
+
|
|
56
|
+
block_bytes = encode(input_)
|
|
57
|
+
return block_bytes
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
def encode(input_: list):
|
|
61
|
+
"""Encode python objects - normally Python primitives or numpy arrays - into
|
|
62
|
+
its correspondent byte representation
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
input_ (List[tuples]): List of tuples: (object, type)
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
byte: Array of bytes
|
|
69
|
+
"""
|
|
70
|
+
global n_bytes
|
|
71
|
+
block = bytearray()
|
|
72
|
+
|
|
73
|
+
for tup in input_:
|
|
74
|
+
arr = np.array(tup[0], dtype=tup[1]).tobytes()
|
|
75
|
+
n_bytes += len(arr)
|
|
76
|
+
block += arr
|
|
77
|
+
|
|
78
|
+
return block
|
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
from dataclasses import dataclass
|
|
2
|
-
from typing import Optional, List
|
|
3
|
-
import numpy as np
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
__all__ = ['RexMesh', 'RexMaterial', 'RexLineSet']
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
@dataclass
|
|
10
|
-
class RexMesh:
|
|
11
|
-
"""Data structure that can be converted to rex binary. Represent
|
|
12
|
-
a Datatype Mesh"""
|
|
13
|
-
name: str
|
|
14
|
-
vertex: np.ndarray
|
|
15
|
-
edges: np.ndarray
|
|
16
|
-
normals: Optional[np.ndarray] = np.array([])
|
|
17
|
-
texture: Optional[np.ndarray] = np.array([])
|
|
18
|
-
color: Optional[np.ndarray] = np.array([])
|
|
19
|
-
material_id: Optional[int] = np.array([])
|
|
20
|
-
|
|
21
|
-
@property
|
|
22
|
-
def ver_ravel(self):
|
|
23
|
-
return self.vertex.ravel().astype('float32')
|
|
24
|
-
|
|
25
|
-
@property
|
|
26
|
-
def tri_ravel(self):
|
|
27
|
-
return self.edges.ravel().astype('int32')
|
|
28
|
-
|
|
29
|
-
@property
|
|
30
|
-
def color_ravel(self):
|
|
31
|
-
return self.color.ravel()
|
|
32
|
-
|
|
33
|
-
@property
|
|
34
|
-
def n_vtx(self):
|
|
35
|
-
return self.ver_ravel.shape[0]
|
|
36
|
-
|
|
37
|
-
@property
|
|
38
|
-
def n_triangles(self):
|
|
39
|
-
return self.tri_ravel.shape[0]
|
|
40
|
-
|
|
41
|
-
@property
|
|
42
|
-
def n_color(self):
|
|
43
|
-
return self.color_ravel.shape[0]
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
@dataclass
|
|
47
|
-
class RexMaterial:
|
|
48
|
-
# ambient
|
|
49
|
-
ka_red: float = 1
|
|
50
|
-
ka_green: float = 1
|
|
51
|
-
ka_blue: float = 1
|
|
52
|
-
# specular
|
|
53
|
-
ks_red: float = 1
|
|
54
|
-
ks_green: float = 1
|
|
55
|
-
ks_blue: float = 1
|
|
56
|
-
|
|
57
|
-
# difuse
|
|
58
|
-
kd_red: float = 1
|
|
59
|
-
kd_green: float = 1
|
|
60
|
-
kd_blue: float = 1
|
|
61
|
-
|
|
62
|
-
# textures
|
|
63
|
-
ka_texture_ID: int = 9223372036854775807
|
|
64
|
-
ks_texture_ID: int = 9223372036854775807
|
|
65
|
-
kd_texture_ID: int = 9223372036854775807
|
|
66
|
-
|
|
67
|
-
ns: float = 0.1 # specular exponent
|
|
68
|
-
alpha: float = 1
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
@dataclass
|
|
72
|
-
class RexLineSet:
|
|
73
|
-
foo: int
|
|
74
|
-
|
|
1
|
+
from dataclasses import dataclass
|
|
2
|
+
from typing import Optional, List
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
__all__ = ['RexMesh', 'RexMaterial', 'RexLineSet']
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
@dataclass
|
|
10
|
+
class RexMesh:
|
|
11
|
+
"""Data structure that can be converted to rex binary. Represent
|
|
12
|
+
a Datatype Mesh"""
|
|
13
|
+
name: str
|
|
14
|
+
vertex: np.ndarray
|
|
15
|
+
edges: np.ndarray
|
|
16
|
+
normals: Optional[np.ndarray] = np.array([])
|
|
17
|
+
texture: Optional[np.ndarray] = np.array([])
|
|
18
|
+
color: Optional[np.ndarray] = np.array([])
|
|
19
|
+
material_id: Optional[int] = np.array([])
|
|
20
|
+
|
|
21
|
+
@property
|
|
22
|
+
def ver_ravel(self):
|
|
23
|
+
return self.vertex.ravel().astype('float32')
|
|
24
|
+
|
|
25
|
+
@property
|
|
26
|
+
def tri_ravel(self):
|
|
27
|
+
return self.edges.ravel().astype('int32')
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def color_ravel(self):
|
|
31
|
+
return self.color.ravel()
|
|
32
|
+
|
|
33
|
+
@property
|
|
34
|
+
def n_vtx(self):
|
|
35
|
+
return self.ver_ravel.shape[0]
|
|
36
|
+
|
|
37
|
+
@property
|
|
38
|
+
def n_triangles(self):
|
|
39
|
+
return self.tri_ravel.shape[0]
|
|
40
|
+
|
|
41
|
+
@property
|
|
42
|
+
def n_color(self):
|
|
43
|
+
return self.color_ravel.shape[0]
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass
|
|
47
|
+
class RexMaterial:
|
|
48
|
+
# ambient
|
|
49
|
+
ka_red: float = 1
|
|
50
|
+
ka_green: float = 1
|
|
51
|
+
ka_blue: float = 1
|
|
52
|
+
# specular
|
|
53
|
+
ks_red: float = 1
|
|
54
|
+
ks_green: float = 1
|
|
55
|
+
ks_blue: float = 1
|
|
56
|
+
|
|
57
|
+
# difuse
|
|
58
|
+
kd_red: float = 1
|
|
59
|
+
kd_green: float = 1
|
|
60
|
+
kd_blue: float = 1
|
|
61
|
+
|
|
62
|
+
# textures
|
|
63
|
+
ka_texture_ID: int = 9223372036854775807
|
|
64
|
+
ks_texture_ID: int = 9223372036854775807
|
|
65
|
+
kd_texture_ID: int = 9223372036854775807
|
|
66
|
+
|
|
67
|
+
ns: float = 0.1 # specular exponent
|
|
68
|
+
alpha: float = 1
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
@dataclass
|
|
72
|
+
class RexLineSet:
|
|
73
|
+
foo: int
|
|
74
|
+
|