subsurface-terra 2025.1.0rc14__py3-none-any.whl → 2025.1.0rc16__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 -0
- subsurface/core/geological_formats/boreholes/_survey_to_unstruct.py +163 -0
- subsurface/core/geological_formats/boreholes/boreholes.py +140 -116
- subsurface/core/geological_formats/boreholes/collars.py +26 -26
- subsurface/core/geological_formats/boreholes/survey.py +86 -380
- 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/_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 +319 -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 +478 -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.0rc14.dist-info → subsurface_terra-2025.1.0rc16.dist-info}/METADATA +194 -194
- subsurface_terra-2025.1.0rc16.dist-info/RECORD +98 -0
- {subsurface_terra-2025.1.0rc14.dist-info → subsurface_terra-2025.1.0rc16.dist-info}/WHEEL +1 -1
- {subsurface_terra-2025.1.0rc14.dist-info → subsurface_terra-2025.1.0rc16.dist-info}/licenses/LICENSE +203 -203
- subsurface_terra-2025.1.0rc14.dist-info/RECORD +0 -96
- {subsurface_terra-2025.1.0rc14.dist-info → subsurface_terra-2025.1.0rc16.dist-info}/top_level.txt +0 -0
|
@@ -1,70 +1,70 @@
|
|
|
1
|
-
from typing import Union, Dict, Literal, List
|
|
2
|
-
|
|
3
|
-
import numpy as np
|
|
4
|
-
import pandas as pd
|
|
5
|
-
import xarray as xr
|
|
6
|
-
|
|
7
|
-
from subsurface.core.structs.base_structures.base_structures_enum import SpecialCellCase
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def vertex_and_cells_arrays_to_data_array(cells: Union[np.ndarray, Literal["lines", "points"], SpecialCellCase],
|
|
11
|
-
vertex: np.ndarray):
|
|
12
|
-
n_vertex = vertex.shape[0]
|
|
13
|
-
if type(cells) is not np.ndarray:
|
|
14
|
-
cells: np.ndarray = _create_default_cells_arg(
|
|
15
|
-
cells=cells,
|
|
16
|
-
n_vertex=n_vertex
|
|
17
|
-
)
|
|
18
|
-
n_cells = cells.shape[0]
|
|
19
|
-
|
|
20
|
-
vertex_data_array = xr.DataArray(
|
|
21
|
-
data=vertex,
|
|
22
|
-
dims=['points', 'XYZ'],
|
|
23
|
-
coords={'XYZ': ['X', 'Y', 'Z']}
|
|
24
|
-
)
|
|
25
|
-
cells_data_array = xr.DataArray(cells, dims=['cell', 'nodes'])
|
|
26
|
-
return cells_data_array, n_cells, n_vertex, vertex_data_array
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
def raw_attributes_to_dict_data_arrays(
|
|
30
|
-
default_attributes_name: str, n_items: int, dims: List[str],
|
|
31
|
-
raw_attributes: Union[None, pd.DataFrame, Dict[str, xr.DataArray]]) \
|
|
32
|
-
-> Dict[str, xr.DataArray]:
|
|
33
|
-
|
|
34
|
-
if raw_attributes is None or type(raw_attributes) is pd.DataFrame:
|
|
35
|
-
points_attributes_xarray_dict = {
|
|
36
|
-
default_attributes_name: _data_array_attributes_from_raw_data(
|
|
37
|
-
raw_data=raw_attributes,
|
|
38
|
-
dims=dims,
|
|
39
|
-
n_rows=n_items
|
|
40
|
-
)
|
|
41
|
-
}
|
|
42
|
-
else:
|
|
43
|
-
points_attributes_xarray_dict = raw_attributes
|
|
44
|
-
return points_attributes_xarray_dict
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
def _create_default_cells_arg(cells: Union[Literal["points", "lines"], SpecialCellCase],
|
|
48
|
-
n_vertex: int) -> np.ndarray:
|
|
49
|
-
if cells is None or cells == 'points' or cells == SpecialCellCase.POINTS:
|
|
50
|
-
cells_array = np.arange(0, n_vertex).reshape(-1, 1)
|
|
51
|
-
elif cells == 'lines' or cells == SpecialCellCase.LINES:
|
|
52
|
-
a = np.arange(0, n_vertex - 1, dtype=np.int_)
|
|
53
|
-
b = np.arange(1, n_vertex, dtype=np.int_)
|
|
54
|
-
cells_array = np.vstack([a, b]).T
|
|
55
|
-
else:
|
|
56
|
-
raise ValueError("cells must be either None (will default to 'points'),"
|
|
57
|
-
"'points', 'lines' or a 2D ndarray.")
|
|
58
|
-
return cells_array
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
def _data_array_attributes_from_raw_data(raw_data: Union[None, pd.DataFrame],
|
|
62
|
-
dims: List[str], n_rows: int) -> xr.DataArray:
|
|
63
|
-
if raw_data is None:
|
|
64
|
-
raw_data = pd.DataFrame(np.zeros((n_rows, 0)))
|
|
65
|
-
|
|
66
|
-
if type(raw_data) is pd.DataFrame:
|
|
67
|
-
data_array = xr.DataArray(raw_data, dims=dims)
|
|
68
|
-
else:
|
|
69
|
-
raise ValueError("cells_attributes must be either pd.DataFrame or " "None/default.")
|
|
70
|
-
return data_array
|
|
1
|
+
from typing import Union, Dict, Literal, List
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
import pandas as pd
|
|
5
|
+
import xarray as xr
|
|
6
|
+
|
|
7
|
+
from subsurface.core.structs.base_structures.base_structures_enum import SpecialCellCase
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def vertex_and_cells_arrays_to_data_array(cells: Union[np.ndarray, Literal["lines", "points"], SpecialCellCase],
|
|
11
|
+
vertex: np.ndarray):
|
|
12
|
+
n_vertex = vertex.shape[0]
|
|
13
|
+
if type(cells) is not np.ndarray:
|
|
14
|
+
cells: np.ndarray = _create_default_cells_arg(
|
|
15
|
+
cells=cells,
|
|
16
|
+
n_vertex=n_vertex
|
|
17
|
+
)
|
|
18
|
+
n_cells = cells.shape[0]
|
|
19
|
+
|
|
20
|
+
vertex_data_array = xr.DataArray(
|
|
21
|
+
data=vertex,
|
|
22
|
+
dims=['points', 'XYZ'],
|
|
23
|
+
coords={'XYZ': ['X', 'Y', 'Z']}
|
|
24
|
+
)
|
|
25
|
+
cells_data_array = xr.DataArray(cells, dims=['cell', 'nodes'])
|
|
26
|
+
return cells_data_array, n_cells, n_vertex, vertex_data_array
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def raw_attributes_to_dict_data_arrays(
|
|
30
|
+
default_attributes_name: str, n_items: int, dims: List[str],
|
|
31
|
+
raw_attributes: Union[None, pd.DataFrame, Dict[str, xr.DataArray]]) \
|
|
32
|
+
-> Dict[str, xr.DataArray]:
|
|
33
|
+
|
|
34
|
+
if raw_attributes is None or type(raw_attributes) is pd.DataFrame:
|
|
35
|
+
points_attributes_xarray_dict = {
|
|
36
|
+
default_attributes_name: _data_array_attributes_from_raw_data(
|
|
37
|
+
raw_data=raw_attributes,
|
|
38
|
+
dims=dims,
|
|
39
|
+
n_rows=n_items
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
else:
|
|
43
|
+
points_attributes_xarray_dict = raw_attributes
|
|
44
|
+
return points_attributes_xarray_dict
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
def _create_default_cells_arg(cells: Union[Literal["points", "lines"], SpecialCellCase],
|
|
48
|
+
n_vertex: int) -> np.ndarray:
|
|
49
|
+
if cells is None or cells == 'points' or cells == SpecialCellCase.POINTS:
|
|
50
|
+
cells_array = np.arange(0, n_vertex).reshape(-1, 1)
|
|
51
|
+
elif cells == 'lines' or cells == SpecialCellCase.LINES:
|
|
52
|
+
a = np.arange(0, n_vertex - 1, dtype=np.int_)
|
|
53
|
+
b = np.arange(1, n_vertex, dtype=np.int_)
|
|
54
|
+
cells_array = np.vstack([a, b]).T
|
|
55
|
+
else:
|
|
56
|
+
raise ValueError("cells must be either None (will default to 'points'),"
|
|
57
|
+
"'points', 'lines' or a 2D ndarray.")
|
|
58
|
+
return cells_array
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def _data_array_attributes_from_raw_data(raw_data: Union[None, pd.DataFrame],
|
|
62
|
+
dims: List[str], n_rows: int) -> xr.DataArray:
|
|
63
|
+
if raw_data is None:
|
|
64
|
+
raw_data = pd.DataFrame(np.zeros((n_rows, 0)))
|
|
65
|
+
|
|
66
|
+
if type(raw_data) is pd.DataFrame:
|
|
67
|
+
data_array = xr.DataArray(raw_data, dims=dims)
|
|
68
|
+
else:
|
|
69
|
+
raise ValueError("cells_attributes must be either pd.DataFrame or " "None/default.")
|
|
70
|
+
return data_array
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import enum
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
class SpecialCellCase(enum.Enum):
|
|
5
|
-
POINTS = "points"
|
|
6
|
-
LINES = "lines"
|
|
1
|
+
import enum
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
class SpecialCellCase(enum.Enum):
|
|
5
|
+
POINTS = "points"
|
|
6
|
+
LINES = "lines"
|