subsurface-terra 2025.1.0rc8__py3-none-any.whl → 2025.1.0rc10__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/_version.py +1 -1
- subsurface/modules/reader/mesh/mx_reader.py +2 -1
- subsurface/modules/reader/volume/read_volume.py +70 -1
- {subsurface_terra-2025.1.0rc8.dist-info → subsurface_terra-2025.1.0rc10.dist-info}/METADATA +1 -1
- {subsurface_terra-2025.1.0rc8.dist-info → subsurface_terra-2025.1.0rc10.dist-info}/RECORD +8 -8
- {subsurface_terra-2025.1.0rc8.dist-info → subsurface_terra-2025.1.0rc10.dist-info}/WHEEL +0 -0
- {subsurface_terra-2025.1.0rc8.dist-info → subsurface_terra-2025.1.0rc10.dist-info}/licenses/LICENSE +0 -0
- {subsurface_terra-2025.1.0rc8.dist-info → subsurface_terra-2025.1.0rc10.dist-info}/top_level.txt +0 -0
subsurface/_version.py
CHANGED
|
@@ -157,7 +157,7 @@ def _process_mesh(mesh_lines) -> Optional[GOCADMesh]:
|
|
|
157
157
|
continue
|
|
158
158
|
|
|
159
159
|
if in_tface:
|
|
160
|
-
if line.startswith('VRTX'):
|
|
160
|
+
if line.startswith('VRTX') or line.startswith('PVRTX'):
|
|
161
161
|
# Parse vertex line
|
|
162
162
|
parts = line.split()
|
|
163
163
|
if len(parts) >= 5:
|
|
@@ -167,6 +167,7 @@ def _process_mesh(mesh_lines) -> Optional[GOCADMesh]:
|
|
|
167
167
|
vertex_indices.append(vid)
|
|
168
168
|
vertex_list.append([x, y, z])
|
|
169
169
|
vid_to_index[vid] = len(vertex_list) - 1
|
|
170
|
+
# If PVRTX then there could be more columns with property values. For now, we are just parsing the vertex coordinates.
|
|
170
171
|
continue
|
|
171
172
|
elif line.startswith('ATOM'):
|
|
172
173
|
# Parse ATOM line
|
|
@@ -7,6 +7,7 @@ from subsurface.core.structs import StructuredData
|
|
|
7
7
|
from .... import optional_requirements
|
|
8
8
|
from ....core.structs import UnstructuredData
|
|
9
9
|
from subsurface.core.reader_helpers.readers_data import GenericReaderFilesHelper
|
|
10
|
+
import numpy as np
|
|
10
11
|
import pandas as pd
|
|
11
12
|
|
|
12
13
|
|
|
@@ -32,7 +33,7 @@ def read_VTK_structured_grid(file_or_buffer: Union[str, BytesIO], active_scalars
|
|
|
32
33
|
# If it's a file path, read directly
|
|
33
34
|
pyvista_obj = pv.read(file_or_buffer)
|
|
34
35
|
try:
|
|
35
|
-
pyvista_struct: pv.ExplicitStructuredGrid = pyvista_obj
|
|
36
|
+
pyvista_struct: pv.ExplicitStructuredGrid = pv_cast_to_explicit_structured_grid(pyvista_obj)
|
|
36
37
|
except Exception as e:
|
|
37
38
|
raise f"The file is not a structured grid: {e}"
|
|
38
39
|
|
|
@@ -99,3 +100,71 @@ def read_volumetric_mesh_attr_file(reader_helper: GenericReaderFilesHelper) -> p
|
|
|
99
100
|
df = pd.read_table(reader_helper.file_or_buffer, **reader_helper.pandas_reader_kwargs)
|
|
100
101
|
df.columns = df.columns.astype(str).str.strip()
|
|
101
102
|
return df
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
def pv_cast_to_explicit_structured_grid(pyvista_object):
|
|
106
|
+
|
|
107
|
+
pv = optional_requirements.require_pyvista()
|
|
108
|
+
|
|
109
|
+
match pyvista_object:
|
|
110
|
+
|
|
111
|
+
case pv.RectilinearGrid() as rectl_grid:
|
|
112
|
+
|
|
113
|
+
return __pv_convert_rectilinear_to_explicit(rectl_grid)
|
|
114
|
+
|
|
115
|
+
case _:
|
|
116
|
+
|
|
117
|
+
return pyvista_object.cast_to_explicit_structured_grid()
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
def __pv_convert_rectilinear_to_explicit(rectl_grid):
|
|
121
|
+
|
|
122
|
+
pv = optional_requirements.require_pyvista()
|
|
123
|
+
|
|
124
|
+
# Extract the coordinate arrays from the input RectilinearGrid.
|
|
125
|
+
x = np.asarray(rectl_grid.x)
|
|
126
|
+
y = np.asarray(rectl_grid.y)
|
|
127
|
+
z = np.asarray(rectl_grid.z)
|
|
128
|
+
|
|
129
|
+
# Helper function: "double" the coordinates to produce an expanded set
|
|
130
|
+
# that, when processed internally via np.unique, returns the original nodal values.
|
|
131
|
+
def doubled_coords(arr):
|
|
132
|
+
return np.repeat(arr, 2)[1:-1]
|
|
133
|
+
|
|
134
|
+
# Double the coordinate arrays.
|
|
135
|
+
xcorn = doubled_coords(x)
|
|
136
|
+
ycorn = doubled_coords(y)
|
|
137
|
+
zcorn = doubled_coords(z)
|
|
138
|
+
|
|
139
|
+
# Build a complete grid of corner points via meshgrid. Fortran ('F') order ensures
|
|
140
|
+
# the connectivity ordering aligns with VTK's expectations.
|
|
141
|
+
xx, yy, zz = np.meshgrid(xcorn, ycorn, zcorn, indexing='ij')
|
|
142
|
+
corners = np.column_stack((xx.ravel(order='F'),
|
|
143
|
+
yy.ravel(order='F'),
|
|
144
|
+
zz.ravel(order='F')))
|
|
145
|
+
|
|
146
|
+
# The dimensions to pass to the ExplicitStructuredGrid constructor should be
|
|
147
|
+
# the counts of unique coordinates in each direction.
|
|
148
|
+
dims = (len(np.unique(xcorn)),
|
|
149
|
+
len(np.unique(ycorn)),
|
|
150
|
+
len(np.unique(zcorn)))
|
|
151
|
+
|
|
152
|
+
# Create the ExplicitStructuredGrid.
|
|
153
|
+
explicit_grid = pv.ExplicitStructuredGrid(dims, corners)
|
|
154
|
+
explicit_grid.compute_connectivity()
|
|
155
|
+
|
|
156
|
+
# --- Copy associated data arrays ---
|
|
157
|
+
|
|
158
|
+
# Transfer all cell data arrays.
|
|
159
|
+
for name, array in rectl_grid.cell_data.items():
|
|
160
|
+
explicit_grid.cell_data[name] = array.copy()
|
|
161
|
+
|
|
162
|
+
# Transfer all point data arrays.
|
|
163
|
+
for name, array in rectl_grid.point_data.items():
|
|
164
|
+
explicit_grid.point_data[name] = array.copy()
|
|
165
|
+
|
|
166
|
+
# (Optional) Transfer field data as well.
|
|
167
|
+
for name, array in rectl_grid.field_data.items():
|
|
168
|
+
explicit_grid.field_data[name] = array.copy()
|
|
169
|
+
|
|
170
|
+
return explicit_grid
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: subsurface_terra
|
|
3
|
-
Version: 2025.1.
|
|
3
|
+
Version: 2025.1.0rc10
|
|
4
4
|
Summary: Subsurface data types and utilities. This version is the one used by Terranigma Solutions. Please feel free to take anything in this repository for the original one.
|
|
5
5
|
Home-page: https://softwareunderground.github.io/subsurface
|
|
6
6
|
Author: Software Underground
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
subsurface/__init__.py,sha256=0D2rCUem3fiHsXFXXSmwheLiPS4cXxEdfWdFBj0b-cY,930
|
|
2
|
-
subsurface/_version.py,sha256=
|
|
2
|
+
subsurface/_version.py,sha256=FcQPFS21SJ4lyiZc0tXWa590ajfkakU3g4UuBjnhZoI,542
|
|
3
3
|
subsurface/optional_requirements.py,sha256=Wg36RqxzPiLtN-3qSg5K9QVEeXCB0-EjSzHERAoO8EE,2883
|
|
4
4
|
subsurface/api/__init__.py,sha256=UiOBKQcZJGMeh_5ZNhXqT2iEdiIk721djLX30aFxEa4,341
|
|
5
5
|
subsurface/api/interfaces/__init__.py,sha256=rqUtJyMLicobcyhmr74TepjmUQAEmlazKT3vjV_n3aA,6
|
|
@@ -49,7 +49,7 @@ subsurface/modules/reader/mesh/_trimesh_reader.py,sha256=-cmm-BYIUC9x6tqABNgKzNM
|
|
|
49
49
|
subsurface/modules/reader/mesh/csv_mesh_reader.py,sha256=0iXYg-JOLUg7yH6Rw6qCoxXvKh0hOUTwjYxbhSlGfGM,1969
|
|
50
50
|
subsurface/modules/reader/mesh/dxf_reader.py,sha256=JDhzFRE46sdwMGBB8enHNluH07ohqt6LhgLHiSQRL-I,6525
|
|
51
51
|
subsurface/modules/reader/mesh/glb_reader.py,sha256=dierR9AYM5Q2szLuemfLlM_JcPRNtDrD5fpF8zNjBS8,1118
|
|
52
|
-
subsurface/modules/reader/mesh/mx_reader.py,sha256=
|
|
52
|
+
subsurface/modules/reader/mesh/mx_reader.py,sha256=YQqvOJ4FuPrlz_3bHIdqT-9YKkirF_Vbjnv6cVQnwAw,8587
|
|
53
53
|
subsurface/modules/reader/mesh/obj_reader.py,sha256=LXf-N-So5xWhnZ6uHJPjcCfQM71a_mqJa3hQEikOGzU,2207
|
|
54
54
|
subsurface/modules/reader/mesh/omf_mesh_reader.py,sha256=0gewosxlLVTQQoUyvYB91AOZ_SByQqxw53coSwCKeMI,1436
|
|
55
55
|
subsurface/modules/reader/mesh/surface_reader.py,sha256=EcRjr3sAJbwZpqm7WHHe1bnMZyGO5MSgF6qm5bSBLtQ,2420
|
|
@@ -60,7 +60,7 @@ subsurface/modules/reader/profiles/profiles_core.py,sha256=kqlt79hjdWWQNBjWqLGlu
|
|
|
60
60
|
subsurface/modules/reader/topography/__init__.py,sha256=zkaTX5JxsNfjF-dFeEbHfUB58vhPMjm6Iiqx9HgJOrY,14
|
|
61
61
|
subsurface/modules/reader/topography/topo_core.py,sha256=6rkDp9XrUSif8ZuraDrUK2I8-yqEp8CRm4r4l2lQuw0,3542
|
|
62
62
|
subsurface/modules/reader/volume/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
63
|
-
subsurface/modules/reader/volume/read_volume.py,sha256=
|
|
63
|
+
subsurface/modules/reader/volume/read_volume.py,sha256=nn0C047jsty_kusZZ-nfZ2bWbyfkaakLsDy_ADxb5sw,6368
|
|
64
64
|
subsurface/modules/reader/volume/segy_reader.py,sha256=oBS1FwwzFTMBmAR3odJMvW-as_0YMudPcFmndpcApW4,3958
|
|
65
65
|
subsurface/modules/reader/volume/seismic.py,sha256=dRA7YKw9fkrkAYS7Bnfm7GfCPdfxVsDyfM7frQK56V4,4950
|
|
66
66
|
subsurface/modules/reader/volume/volume_utils.py,sha256=7ToIdVwq04lMyYGJE9PzYVQt9xl9mjbXXrzvMfM6wGw,1367
|
|
@@ -86,8 +86,8 @@ subsurface/modules/writer/to_rex/material_encoder.py,sha256=zGlqF9X_Civ9VvtGwo-I
|
|
|
86
86
|
subsurface/modules/writer/to_rex/mesh_encoder.py,sha256=6TBtJhYJEAMEBHxQkbweXrJO1jIUx1ClM8l5ajVCrLc,6443
|
|
87
87
|
subsurface/modules/writer/to_rex/to_rex.py,sha256=njsm2d3e69pRVfF_TOC_hexvXPmgNTZdJvhbnXcvyIo,3800
|
|
88
88
|
subsurface/modules/writer/to_rex/utils.py,sha256=HEpJ95LjHOK24ePpmLpPP5uFyv6i_kN3AWh031q-1Uc,379
|
|
89
|
-
subsurface_terra-2025.1.
|
|
90
|
-
subsurface_terra-2025.1.
|
|
91
|
-
subsurface_terra-2025.1.
|
|
92
|
-
subsurface_terra-2025.1.
|
|
93
|
-
subsurface_terra-2025.1.
|
|
89
|
+
subsurface_terra-2025.1.0rc10.dist-info/licenses/LICENSE,sha256=GSXh9K5TZauM89BeGbYg07oST_HMhOTiZoEGaUeKBtA,11606
|
|
90
|
+
subsurface_terra-2025.1.0rc10.dist-info/METADATA,sha256=jBJ-O1dvs0h0JLz8AC8pa_DvztAmPpJk5f_CivFG0n4,7094
|
|
91
|
+
subsurface_terra-2025.1.0rc10.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
|
|
92
|
+
subsurface_terra-2025.1.0rc10.dist-info/top_level.txt,sha256=f32R_tUSf83CfkpB4vjv5m2XcD8TmDX9h7F4rnEXt5A,11
|
|
93
|
+
subsurface_terra-2025.1.0rc10.dist-info/RECORD,,
|
|
File without changes
|
{subsurface_terra-2025.1.0rc8.dist-info → subsurface_terra-2025.1.0rc10.dist-info}/licenses/LICENSE
RENAMED
|
File without changes
|
{subsurface_terra-2025.1.0rc8.dist-info → subsurface_terra-2025.1.0rc10.dist-info}/top_level.txt
RENAMED
|
File without changes
|