subsurface-terra 2025.1.0rc18__py3-none-any.whl → 2025.1.0rc19__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 -34
- 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 -236
- 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 -69
- 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 +350 -350
- 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 -447
- subsurface/modules/reader/volume/read_volume.py +331 -327
- 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.0rc18.dist-info → subsurface_terra-2025.1.0rc19.dist-info}/METADATA +196 -194
- subsurface_terra-2025.1.0rc19.dist-info/RECORD +99 -0
- {subsurface_terra-2025.1.0rc18.dist-info → subsurface_terra-2025.1.0rc19.dist-info}/licenses/LICENSE +203 -203
- subsurface_terra-2025.1.0rc18.dist-info/RECORD +0 -99
- {subsurface_terra-2025.1.0rc18.dist-info → subsurface_terra-2025.1.0rc19.dist-info}/WHEEL +0 -0
- {subsurface_terra-2025.1.0rc18.dist-info → subsurface_terra-2025.1.0rc19.dist-info}/top_level.txt +0 -0
subsurface/__init__.py
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import subsurface.modules.reader
|
|
2
|
-
import subsurface.api.interfaces
|
|
3
|
-
import subsurface.modules.writer
|
|
4
|
-
from . import core
|
|
5
|
-
from .modules import visualization
|
|
6
|
-
from subsurface.core.structs import *
|
|
7
|
-
from datetime import datetime
|
|
8
|
-
import dotenv
|
|
9
|
-
|
|
10
|
-
dotenv.load_dotenv()
|
|
11
|
-
|
|
12
|
-
try:
|
|
13
|
-
from subsurface import visualization
|
|
14
|
-
except ImportError:
|
|
15
|
-
pass
|
|
16
|
-
try:
|
|
17
|
-
from importlib.metadata import version, PackageNotFoundError
|
|
18
|
-
except ImportError: # For Python <3.8, fallback
|
|
19
|
-
from importlib_metadata import version, PackageNotFoundError
|
|
20
|
-
|
|
21
|
-
# Version.
|
|
22
|
-
try:
|
|
23
|
-
__version__ = version("subsurface") # Use package name
|
|
24
|
-
except ImportError:
|
|
25
|
-
# If it was not installed, then we don't know the version. We could throw a
|
|
26
|
-
# warning here, but this case *should* be rare. subsurface should be
|
|
27
|
-
# installed properly!
|
|
28
|
-
__version__ = 'unknown-'+datetime.today().strftime('%Y%m%d')
|
|
29
|
-
|
|
30
|
-
if __name__ == '__main__':
|
|
31
|
-
pass
|
|
1
|
+
import subsurface.modules.reader
|
|
2
|
+
import subsurface.api.interfaces
|
|
3
|
+
import subsurface.modules.writer
|
|
4
|
+
from . import core
|
|
5
|
+
from .modules import visualization
|
|
6
|
+
from subsurface.core.structs import *
|
|
7
|
+
from datetime import datetime
|
|
8
|
+
import dotenv
|
|
9
|
+
|
|
10
|
+
dotenv.load_dotenv()
|
|
11
|
+
|
|
12
|
+
try:
|
|
13
|
+
from subsurface import visualization
|
|
14
|
+
except ImportError:
|
|
15
|
+
pass
|
|
16
|
+
try:
|
|
17
|
+
from importlib.metadata import version, PackageNotFoundError
|
|
18
|
+
except ImportError: # For Python <3.8, fallback
|
|
19
|
+
from importlib_metadata import version, PackageNotFoundError
|
|
20
|
+
|
|
21
|
+
# Version.
|
|
22
|
+
try:
|
|
23
|
+
__version__ = version("subsurface") # Use package name
|
|
24
|
+
except ImportError:
|
|
25
|
+
# If it was not installed, then we don't know the version. We could throw a
|
|
26
|
+
# warning here, but this case *should* be rare. subsurface should be
|
|
27
|
+
# installed properly!
|
|
28
|
+
__version__ = 'unknown-'+datetime.today().strftime('%Y%m%d')
|
|
29
|
+
|
|
30
|
+
if __name__ == '__main__':
|
|
31
|
+
pass
|
subsurface/_version.py
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
# file generated by setuptools-scm
|
|
2
|
-
# don't change, don't track in version control
|
|
3
|
-
|
|
4
|
-
__all__ = [
|
|
5
|
-
"__version__",
|
|
6
|
-
"__version_tuple__",
|
|
7
|
-
"version",
|
|
8
|
-
"version_tuple",
|
|
9
|
-
"__commit_id__",
|
|
10
|
-
"commit_id",
|
|
11
|
-
]
|
|
12
|
-
|
|
13
|
-
TYPE_CHECKING = False
|
|
14
|
-
if TYPE_CHECKING:
|
|
15
|
-
from typing import Tuple
|
|
16
|
-
from typing import Union
|
|
17
|
-
|
|
18
|
-
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
-
COMMIT_ID = Union[str, None]
|
|
20
|
-
else:
|
|
21
|
-
VERSION_TUPLE = object
|
|
22
|
-
COMMIT_ID = object
|
|
23
|
-
|
|
24
|
-
version: str
|
|
25
|
-
__version__: str
|
|
26
|
-
__version_tuple__: VERSION_TUPLE
|
|
27
|
-
version_tuple: VERSION_TUPLE
|
|
28
|
-
commit_id: COMMIT_ID
|
|
29
|
-
__commit_id__: COMMIT_ID
|
|
30
|
-
|
|
31
|
-
__version__ = version = '2025.1.
|
|
32
|
-
__version_tuple__ = version_tuple = (2025, 1, 0, '
|
|
33
|
-
|
|
34
|
-
__commit_id__ = commit_id = None
|
|
1
|
+
# file generated by setuptools-scm
|
|
2
|
+
# don't change, don't track in version control
|
|
3
|
+
|
|
4
|
+
__all__ = [
|
|
5
|
+
"__version__",
|
|
6
|
+
"__version_tuple__",
|
|
7
|
+
"version",
|
|
8
|
+
"version_tuple",
|
|
9
|
+
"__commit_id__",
|
|
10
|
+
"commit_id",
|
|
11
|
+
]
|
|
12
|
+
|
|
13
|
+
TYPE_CHECKING = False
|
|
14
|
+
if TYPE_CHECKING:
|
|
15
|
+
from typing import Tuple
|
|
16
|
+
from typing import Union
|
|
17
|
+
|
|
18
|
+
VERSION_TUPLE = Tuple[Union[int, str], ...]
|
|
19
|
+
COMMIT_ID = Union[str, None]
|
|
20
|
+
else:
|
|
21
|
+
VERSION_TUPLE = object
|
|
22
|
+
COMMIT_ID = object
|
|
23
|
+
|
|
24
|
+
version: str
|
|
25
|
+
__version__: str
|
|
26
|
+
__version_tuple__: VERSION_TUPLE
|
|
27
|
+
version_tuple: VERSION_TUPLE
|
|
28
|
+
commit_id: COMMIT_ID
|
|
29
|
+
__commit_id__: COMMIT_ID
|
|
30
|
+
|
|
31
|
+
__version__ = version = '2025.1.0rc19'
|
|
32
|
+
__version_tuple__ = version_tuple = (2025, 1, 0, 'rc19')
|
|
33
|
+
|
|
34
|
+
__commit_id__ = commit_id = None
|
subsurface/api/__init__.py
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
from .interfaces.stream import (
|
|
2
|
-
DXF_stream_to_unstruc,
|
|
3
|
-
OMF_stream_to_unstruc,
|
|
4
|
-
CSV_wells_stream_to_unstruc,
|
|
5
|
-
CSV_mesh_stream_to_unstruc,
|
|
6
|
-
CSV_volume_stream_to_unstruc,
|
|
7
|
-
CSV_volume_stream_to_struct,
|
|
8
|
-
VTK_stream_to_struct,
|
|
9
|
-
MX_stream_to_unstruc,
|
|
10
|
-
OBJ_stream_to_trisurf,
|
|
11
|
-
GLTF_stream_to_trisurf,
|
|
12
|
-
MSH_stream_to_struct,
|
|
13
|
-
)
|
|
1
|
+
from .interfaces.stream import (
|
|
2
|
+
DXF_stream_to_unstruc,
|
|
3
|
+
OMF_stream_to_unstruc,
|
|
4
|
+
CSV_wells_stream_to_unstruc,
|
|
5
|
+
CSV_mesh_stream_to_unstruc,
|
|
6
|
+
CSV_volume_stream_to_unstruc,
|
|
7
|
+
CSV_volume_stream_to_struct,
|
|
8
|
+
VTK_stream_to_struct,
|
|
9
|
+
MX_stream_to_unstruc,
|
|
10
|
+
OBJ_stream_to_trisurf,
|
|
11
|
+
GLTF_stream_to_trisurf,
|
|
12
|
+
MSH_stream_to_struct,
|
|
13
|
+
)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
@@ -1,136 +1,136 @@
|
|
|
1
|
-
import io
|
|
2
|
-
from io import BytesIO
|
|
3
|
-
from typing import TextIO, Optional
|
|
4
|
-
|
|
5
|
-
import pandas
|
|
6
|
-
|
|
7
|
-
from ...core.structs import TriSurf
|
|
8
|
-
from ...core.reader_helpers.reader_unstruct import ReaderUnstructuredHelper
|
|
9
|
-
from ...core.reader_helpers.readers_data import GenericReaderFilesHelper
|
|
10
|
-
from ...core.geological_formats import BoreholeSet
|
|
11
|
-
from ...core.structs.base_structures import UnstructuredData, StructuredData
|
|
12
|
-
|
|
13
|
-
from ...modules import reader
|
|
14
|
-
from ...modules.reader.mesh._trimesh_reader import TriMeshTransformations
|
|
15
|
-
from ...modules.reader.volume.read_volume import read_volumetric_mesh_to_subsurface, read_VTK_structured_grid
|
|
16
|
-
from ...modules.reader.mesh.surfaces_api import read_2d_mesh_to_unstruct
|
|
17
|
-
from ...modules.reader.volume.volume_utils import interpolate_unstructured_data_to_structured_data
|
|
18
|
-
|
|
19
|
-
from ..reader.read_wells import read_wells
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
def DXF_stream_to_unstruc(stream: TextIO) -> UnstructuredData:
|
|
23
|
-
vertex, cells, cell_attr_int, cell_attr_map = reader.dxf_stream_to_unstruct_input(stream)
|
|
24
|
-
|
|
25
|
-
unstruct = UnstructuredData.from_array(
|
|
26
|
-
vertex,
|
|
27
|
-
cells,
|
|
28
|
-
cells_attr=pandas.DataFrame(cell_attr_int, columns=["Id"]),
|
|
29
|
-
xarray_attributes={"cell_attr_map": cell_attr_map},
|
|
30
|
-
)
|
|
31
|
-
|
|
32
|
-
return unstruct
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def OMF_stream_to_unstruc(stream: BytesIO) -> list[UnstructuredData]:
|
|
36
|
-
list_unstruct: list[UnstructuredData] = reader.omf_stream_to_unstructs(stream)
|
|
37
|
-
return list_unstruct
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
def MX_stream_to_unstruc(stream: TextIO) -> list[UnstructuredData]:
|
|
41
|
-
list_unstruct: list[UnstructuredData] = [reader.mx_to_unstruc_from_binary(stream)]
|
|
42
|
-
return list_unstruct
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
def OBJ_stream_to_trisurf(obj_stream: TextIO, mtl_stream: list[TextIO],
|
|
46
|
-
texture_stream: list[io.BytesIO], coordinate_system: TriMeshTransformations) -> TriSurf:
|
|
47
|
-
tri_mesh: TriSurf = reader.load_obj_with_trimesh_from_binary(
|
|
48
|
-
obj_stream=obj_stream,
|
|
49
|
-
mtl_stream=mtl_stream,
|
|
50
|
-
texture_stream=texture_stream,
|
|
51
|
-
coord_system=coordinate_system
|
|
52
|
-
)
|
|
53
|
-
return tri_mesh
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def GLTF_stream_to_trisurf(gltf_stream: io.BytesIO, coordinate_system: TriMeshTransformations) -> TriSurf:
|
|
57
|
-
tri_mesh: TriSurf = reader.load_gltf_with_trimesh(gltf_stream, coordinate_system)
|
|
58
|
-
return tri_mesh
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def VTK_stream_to_struct(stream: BytesIO, attribute_name: str) -> list[StructuredData]:
|
|
62
|
-
struct = read_VTK_structured_grid(stream, attribute_name)
|
|
63
|
-
return [struct]
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
def MSH_stream_to_struct(grid_stream: TextIO, values_stream: TextIO, missing_value: Optional[float], attr_name: Optional[str]) -> list[StructuredData]:
|
|
67
|
-
struct = reader.read_msh_structured_grid(grid_stream, values_stream, missing_value, attr_name)
|
|
68
|
-
return [struct]
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
def CSV_wells_stream_to_unstruc(
|
|
72
|
-
collars_reader: GenericReaderFilesHelper,
|
|
73
|
-
surveys_reader: GenericReaderFilesHelper,
|
|
74
|
-
attrs_reader: GenericReaderFilesHelper,
|
|
75
|
-
is_lith_attr: bool,
|
|
76
|
-
number_nodes: int,
|
|
77
|
-
add_attrs_as_nodes: bool,
|
|
78
|
-
duplicate_attr_depths: bool
|
|
79
|
-
) -> list[UnstructuredData]:
|
|
80
|
-
borehole_set: BoreholeSet = read_wells(
|
|
81
|
-
collars_reader=collars_reader,
|
|
82
|
-
surveys_reader=surveys_reader,
|
|
83
|
-
attrs_reader=attrs_reader,
|
|
84
|
-
is_lith_attr=is_lith_attr,
|
|
85
|
-
number_nodes=number_nodes,
|
|
86
|
-
add_attrs_as_nodes=add_attrs_as_nodes,
|
|
87
|
-
duplicate_attr_depths=duplicate_attr_depths
|
|
88
|
-
)
|
|
89
|
-
|
|
90
|
-
list_unstruct: list[UnstructuredData] = [
|
|
91
|
-
borehole_set.collars.data,
|
|
92
|
-
borehole_set.combined_trajectory.data
|
|
93
|
-
]
|
|
94
|
-
return list_unstruct
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
def CSV_mesh_stream_to_unstruc(
|
|
98
|
-
vertex_reader: GenericReaderFilesHelper,
|
|
99
|
-
edges_reader: GenericReaderFilesHelper,
|
|
100
|
-
cells_attrs_reader: GenericReaderFilesHelper,
|
|
101
|
-
vertex_attrs_reader: GenericReaderFilesHelper
|
|
102
|
-
) -> list[UnstructuredData]:
|
|
103
|
-
reader_unstruc = ReaderUnstructuredHelper(vertex_reader, edges_reader, vertex_attrs_reader, cells_attrs_reader)
|
|
104
|
-
ud = read_2d_mesh_to_unstruct(reader_unstruc)
|
|
105
|
-
return [ud]
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
def CSV_volume_stream_to_unstruc(
|
|
109
|
-
coord_reader: GenericReaderFilesHelper,
|
|
110
|
-
attrs_reader: GenericReaderFilesHelper
|
|
111
|
-
) -> list[UnstructuredData]:
|
|
112
|
-
ud = read_volumetric_mesh_to_subsurface(
|
|
113
|
-
reader_helper_coord=coord_reader,
|
|
114
|
-
reader_helper_attr=attrs_reader
|
|
115
|
-
)
|
|
116
|
-
return [ud]
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
def CSV_volume_stream_to_struct(
|
|
120
|
-
coord_reader: GenericReaderFilesHelper,
|
|
121
|
-
attrs_reader: GenericReaderFilesHelper,
|
|
122
|
-
attr_name: str,
|
|
123
|
-
resolution: list[int]
|
|
124
|
-
) -> list[StructuredData]:
|
|
125
|
-
ud = read_volumetric_mesh_to_subsurface(
|
|
126
|
-
reader_helper_coord=coord_reader,
|
|
127
|
-
reader_helper_attr=attrs_reader
|
|
128
|
-
)
|
|
129
|
-
|
|
130
|
-
sd: StructuredData = interpolate_unstructured_data_to_structured_data(
|
|
131
|
-
ud=ud,
|
|
132
|
-
attr_name=attr_name,
|
|
133
|
-
resolution=resolution
|
|
134
|
-
)
|
|
135
|
-
|
|
136
|
-
return [sd]
|
|
1
|
+
import io
|
|
2
|
+
from io import BytesIO
|
|
3
|
+
from typing import TextIO, Optional
|
|
4
|
+
|
|
5
|
+
import pandas
|
|
6
|
+
|
|
7
|
+
from ...core.structs import TriSurf
|
|
8
|
+
from ...core.reader_helpers.reader_unstruct import ReaderUnstructuredHelper
|
|
9
|
+
from ...core.reader_helpers.readers_data import GenericReaderFilesHelper
|
|
10
|
+
from ...core.geological_formats import BoreholeSet
|
|
11
|
+
from ...core.structs.base_structures import UnstructuredData, StructuredData
|
|
12
|
+
|
|
13
|
+
from ...modules import reader
|
|
14
|
+
from ...modules.reader.mesh._trimesh_reader import TriMeshTransformations
|
|
15
|
+
from ...modules.reader.volume.read_volume import read_volumetric_mesh_to_subsurface, read_VTK_structured_grid
|
|
16
|
+
from ...modules.reader.mesh.surfaces_api import read_2d_mesh_to_unstruct
|
|
17
|
+
from ...modules.reader.volume.volume_utils import interpolate_unstructured_data_to_structured_data
|
|
18
|
+
|
|
19
|
+
from ..reader.read_wells import read_wells
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def DXF_stream_to_unstruc(stream: TextIO) -> UnstructuredData:
|
|
23
|
+
vertex, cells, cell_attr_int, cell_attr_map = reader.dxf_stream_to_unstruct_input(stream)
|
|
24
|
+
|
|
25
|
+
unstruct = UnstructuredData.from_array(
|
|
26
|
+
vertex,
|
|
27
|
+
cells,
|
|
28
|
+
cells_attr=pandas.DataFrame(cell_attr_int, columns=["Id"]),
|
|
29
|
+
xarray_attributes={"cell_attr_map": cell_attr_map},
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
return unstruct
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
def OMF_stream_to_unstruc(stream: BytesIO) -> list[UnstructuredData]:
|
|
36
|
+
list_unstruct: list[UnstructuredData] = reader.omf_stream_to_unstructs(stream)
|
|
37
|
+
return list_unstruct
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def MX_stream_to_unstruc(stream: TextIO) -> list[UnstructuredData]:
|
|
41
|
+
list_unstruct: list[UnstructuredData] = [reader.mx_to_unstruc_from_binary(stream)]
|
|
42
|
+
return list_unstruct
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
def OBJ_stream_to_trisurf(obj_stream: TextIO, mtl_stream: list[TextIO],
|
|
46
|
+
texture_stream: list[io.BytesIO], coordinate_system: TriMeshTransformations) -> TriSurf:
|
|
47
|
+
tri_mesh: TriSurf = reader.load_obj_with_trimesh_from_binary(
|
|
48
|
+
obj_stream=obj_stream,
|
|
49
|
+
mtl_stream=mtl_stream,
|
|
50
|
+
texture_stream=texture_stream,
|
|
51
|
+
coord_system=coordinate_system
|
|
52
|
+
)
|
|
53
|
+
return tri_mesh
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def GLTF_stream_to_trisurf(gltf_stream: io.BytesIO, coordinate_system: TriMeshTransformations) -> TriSurf:
|
|
57
|
+
tri_mesh: TriSurf = reader.load_gltf_with_trimesh(gltf_stream, coordinate_system)
|
|
58
|
+
return tri_mesh
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def VTK_stream_to_struct(stream: BytesIO, attribute_name: str) -> list[StructuredData]:
|
|
62
|
+
struct = read_VTK_structured_grid(stream, attribute_name)
|
|
63
|
+
return [struct]
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
def MSH_stream_to_struct(grid_stream: TextIO, values_stream: TextIO, missing_value: Optional[float], attr_name: Optional[str]) -> list[StructuredData]:
|
|
67
|
+
struct = reader.read_msh_structured_grid(grid_stream, values_stream, missing_value, attr_name)
|
|
68
|
+
return [struct]
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
def CSV_wells_stream_to_unstruc(
|
|
72
|
+
collars_reader: GenericReaderFilesHelper,
|
|
73
|
+
surveys_reader: GenericReaderFilesHelper,
|
|
74
|
+
attrs_reader: GenericReaderFilesHelper,
|
|
75
|
+
is_lith_attr: bool,
|
|
76
|
+
number_nodes: int,
|
|
77
|
+
add_attrs_as_nodes: bool,
|
|
78
|
+
duplicate_attr_depths: bool
|
|
79
|
+
) -> list[UnstructuredData]:
|
|
80
|
+
borehole_set: BoreholeSet = read_wells(
|
|
81
|
+
collars_reader=collars_reader,
|
|
82
|
+
surveys_reader=surveys_reader,
|
|
83
|
+
attrs_reader=attrs_reader,
|
|
84
|
+
is_lith_attr=is_lith_attr,
|
|
85
|
+
number_nodes=number_nodes,
|
|
86
|
+
add_attrs_as_nodes=add_attrs_as_nodes,
|
|
87
|
+
duplicate_attr_depths=duplicate_attr_depths
|
|
88
|
+
)
|
|
89
|
+
|
|
90
|
+
list_unstruct: list[UnstructuredData] = [
|
|
91
|
+
borehole_set.collars.data,
|
|
92
|
+
borehole_set.combined_trajectory.data
|
|
93
|
+
]
|
|
94
|
+
return list_unstruct
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
def CSV_mesh_stream_to_unstruc(
|
|
98
|
+
vertex_reader: GenericReaderFilesHelper,
|
|
99
|
+
edges_reader: GenericReaderFilesHelper,
|
|
100
|
+
cells_attrs_reader: GenericReaderFilesHelper,
|
|
101
|
+
vertex_attrs_reader: GenericReaderFilesHelper
|
|
102
|
+
) -> list[UnstructuredData]:
|
|
103
|
+
reader_unstruc = ReaderUnstructuredHelper(vertex_reader, edges_reader, vertex_attrs_reader, cells_attrs_reader)
|
|
104
|
+
ud = read_2d_mesh_to_unstruct(reader_unstruc)
|
|
105
|
+
return [ud]
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
def CSV_volume_stream_to_unstruc(
|
|
109
|
+
coord_reader: GenericReaderFilesHelper,
|
|
110
|
+
attrs_reader: GenericReaderFilesHelper
|
|
111
|
+
) -> list[UnstructuredData]:
|
|
112
|
+
ud = read_volumetric_mesh_to_subsurface(
|
|
113
|
+
reader_helper_coord=coord_reader,
|
|
114
|
+
reader_helper_attr=attrs_reader
|
|
115
|
+
)
|
|
116
|
+
return [ud]
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
def CSV_volume_stream_to_struct(
|
|
120
|
+
coord_reader: GenericReaderFilesHelper,
|
|
121
|
+
attrs_reader: GenericReaderFilesHelper,
|
|
122
|
+
attr_name: str,
|
|
123
|
+
resolution: list[int]
|
|
124
|
+
) -> list[StructuredData]:
|
|
125
|
+
ud = read_volumetric_mesh_to_subsurface(
|
|
126
|
+
reader_helper_coord=coord_reader,
|
|
127
|
+
reader_helper_attr=attrs_reader
|
|
128
|
+
)
|
|
129
|
+
|
|
130
|
+
sd: StructuredData = interpolate_unstructured_data_to_structured_data(
|
|
131
|
+
ud=ud,
|
|
132
|
+
attr_name=attr_name,
|
|
133
|
+
resolution=resolution
|
|
134
|
+
)
|
|
135
|
+
|
|
136
|
+
return [sd]
|
|
@@ -1,78 +1,78 @@
|
|
|
1
|
-
from subsurface.core.geological_formats.boreholes.boreholes import MergeOptions
|
|
2
|
-
|
|
3
|
-
from subsurface.core.structs.base_structures.base_structures_enum import SpecialCellCase
|
|
4
|
-
|
|
5
|
-
from subsurface.core.structs import UnstructuredData, PointSet
|
|
6
|
-
|
|
7
|
-
from subsurface import optional_requirements
|
|
8
|
-
from subsurface.modules.reader.wells.read_borehole_interface import read_collar, read_survey, read_lith, read_attributes
|
|
9
|
-
|
|
10
|
-
from subsurface.core.geological_formats import BoreholeSet, Collars, Survey
|
|
11
|
-
|
|
12
|
-
from subsurface.core.reader_helpers.readers_data import GenericReaderFilesHelper
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
def read_wells(
|
|
16
|
-
collars_reader: GenericReaderFilesHelper,
|
|
17
|
-
surveys_reader: GenericReaderFilesHelper,
|
|
18
|
-
attrs_reader: GenericReaderFilesHelper,
|
|
19
|
-
is_lith_attr: bool,
|
|
20
|
-
number_nodes: int = 10,
|
|
21
|
-
add_attrs_as_nodes: bool = False,
|
|
22
|
-
duplicate_attr_depths: bool = False
|
|
23
|
-
) -> BoreholeSet:
|
|
24
|
-
# ! FIGUROUT IF WE NEED LITH
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
pd = optional_requirements.require_pandas()
|
|
28
|
-
try:
|
|
29
|
-
collar_df: pd.DataFrame = read_collar(collars_reader)
|
|
30
|
-
unstruc: UnstructuredData = UnstructuredData.from_array(
|
|
31
|
-
vertex=collar_df[["x", "y", "z"]].values,
|
|
32
|
-
cells=SpecialCellCase.POINTS
|
|
33
|
-
)
|
|
34
|
-
points = PointSet(data=unstruc)
|
|
35
|
-
collars: Collars = Collars(
|
|
36
|
-
ids=collar_df.index.to_list(),
|
|
37
|
-
collar_loc=points
|
|
38
|
-
)
|
|
39
|
-
except KeyError as e:
|
|
40
|
-
raise ValueError(f"Error while reading collars: {e}. Check if the columns are named x, y, z or use Columns Map.")
|
|
41
|
-
except Exception as e:
|
|
42
|
-
raise ValueError(f"Error while reading collars: {e}")
|
|
43
|
-
|
|
44
|
-
try:
|
|
45
|
-
survey_df: pd.DataFrame = read_survey(surveys_reader)
|
|
46
|
-
except Exception as e:
|
|
47
|
-
raise ValueError(f"Error while reading surveys: {e}")
|
|
48
|
-
|
|
49
|
-
try:
|
|
50
|
-
attrs: pd.DataFrame = read_attributes(attrs_reader, is_lith=is_lith_attr)
|
|
51
|
-
except Exception as e:
|
|
52
|
-
raise ValueError(f"Error while reading attributes: {e}")
|
|
53
|
-
|
|
54
|
-
try:
|
|
55
|
-
if add_attrs_as_nodes:
|
|
56
|
-
attr_df = attrs
|
|
57
|
-
else:
|
|
58
|
-
attr_df = None
|
|
59
|
-
|
|
60
|
-
survey: Survey = Survey.from_df(
|
|
61
|
-
survey_df=survey_df,
|
|
62
|
-
attr_df=attr_df,
|
|
63
|
-
number_nodes=number_nodes,
|
|
64
|
-
duplicate_attr_depths=duplicate_attr_depths
|
|
65
|
-
)
|
|
66
|
-
|
|
67
|
-
# Check if component lith is in columns or columns_map
|
|
68
|
-
survey.update_survey_with_lith(attrs)
|
|
69
|
-
except Exception as e:
|
|
70
|
-
raise ValueError(f"Error while creating survey: {e}")
|
|
71
|
-
|
|
72
|
-
borehole_set = BoreholeSet(
|
|
73
|
-
collars=collars,
|
|
74
|
-
survey=survey,
|
|
75
|
-
merge_option=MergeOptions.INTERSECT
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
return borehole_set
|
|
1
|
+
from subsurface.core.geological_formats.boreholes.boreholes import MergeOptions
|
|
2
|
+
|
|
3
|
+
from subsurface.core.structs.base_structures.base_structures_enum import SpecialCellCase
|
|
4
|
+
|
|
5
|
+
from subsurface.core.structs import UnstructuredData, PointSet
|
|
6
|
+
|
|
7
|
+
from subsurface import optional_requirements
|
|
8
|
+
from subsurface.modules.reader.wells.read_borehole_interface import read_collar, read_survey, read_lith, read_attributes
|
|
9
|
+
|
|
10
|
+
from subsurface.core.geological_formats import BoreholeSet, Collars, Survey
|
|
11
|
+
|
|
12
|
+
from subsurface.core.reader_helpers.readers_data import GenericReaderFilesHelper
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def read_wells(
|
|
16
|
+
collars_reader: GenericReaderFilesHelper,
|
|
17
|
+
surveys_reader: GenericReaderFilesHelper,
|
|
18
|
+
attrs_reader: GenericReaderFilesHelper,
|
|
19
|
+
is_lith_attr: bool,
|
|
20
|
+
number_nodes: int = 10,
|
|
21
|
+
add_attrs_as_nodes: bool = False,
|
|
22
|
+
duplicate_attr_depths: bool = False
|
|
23
|
+
) -> BoreholeSet:
|
|
24
|
+
# ! FIGUROUT IF WE NEED LITH
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
pd = optional_requirements.require_pandas()
|
|
28
|
+
try:
|
|
29
|
+
collar_df: pd.DataFrame = read_collar(collars_reader)
|
|
30
|
+
unstruc: UnstructuredData = UnstructuredData.from_array(
|
|
31
|
+
vertex=collar_df[["x", "y", "z"]].values,
|
|
32
|
+
cells=SpecialCellCase.POINTS
|
|
33
|
+
)
|
|
34
|
+
points = PointSet(data=unstruc)
|
|
35
|
+
collars: Collars = Collars(
|
|
36
|
+
ids=collar_df.index.to_list(),
|
|
37
|
+
collar_loc=points
|
|
38
|
+
)
|
|
39
|
+
except KeyError as e:
|
|
40
|
+
raise ValueError(f"Error while reading collars: {e}. Check if the columns are named x, y, z or use Columns Map.")
|
|
41
|
+
except Exception as e:
|
|
42
|
+
raise ValueError(f"Error while reading collars: {e}")
|
|
43
|
+
|
|
44
|
+
try:
|
|
45
|
+
survey_df: pd.DataFrame = read_survey(surveys_reader)
|
|
46
|
+
except Exception as e:
|
|
47
|
+
raise ValueError(f"Error while reading surveys: {e}")
|
|
48
|
+
|
|
49
|
+
try:
|
|
50
|
+
attrs: pd.DataFrame = read_attributes(attrs_reader, is_lith=is_lith_attr)
|
|
51
|
+
except Exception as e:
|
|
52
|
+
raise ValueError(f"Error while reading attributes: {e}")
|
|
53
|
+
|
|
54
|
+
try:
|
|
55
|
+
if add_attrs_as_nodes:
|
|
56
|
+
attr_df = attrs
|
|
57
|
+
else:
|
|
58
|
+
attr_df = None
|
|
59
|
+
|
|
60
|
+
survey: Survey = Survey.from_df(
|
|
61
|
+
survey_df=survey_df,
|
|
62
|
+
attr_df=attr_df,
|
|
63
|
+
number_nodes=number_nodes,
|
|
64
|
+
duplicate_attr_depths=duplicate_attr_depths
|
|
65
|
+
)
|
|
66
|
+
|
|
67
|
+
# Check if component lith is in columns or columns_map
|
|
68
|
+
survey.update_survey_with_lith(attrs)
|
|
69
|
+
except Exception as e:
|
|
70
|
+
raise ValueError(f"Error while creating survey: {e}")
|
|
71
|
+
|
|
72
|
+
borehole_set = BoreholeSet(
|
|
73
|
+
collars=collars,
|
|
74
|
+
survey=survey,
|
|
75
|
+
merge_option=MergeOptions.INTERSECT
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
return borehole_set
|