subsurface-terra 2025.1.0rc17__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/_version.py CHANGED
@@ -28,7 +28,7 @@ version_tuple: VERSION_TUPLE
28
28
  commit_id: COMMIT_ID
29
29
  __commit_id__: COMMIT_ID
30
30
 
31
- __version__ = version = '2025.1.0rc17'
32
- __version_tuple__ = version_tuple = (2025, 1, 0, 'rc17')
31
+ __version__ = version = '2025.1.0rc19'
32
+ __version_tuple__ = version_tuple = (2025, 1, 0, 'rc19')
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -278,15 +278,27 @@ class UnstructuredData:
278
278
  return file
279
279
 
280
280
  def _set_binary_header(self):
281
+ from subsurface.core.structs.base_structures._aux import safe_convert_to_float32
282
+
283
+ # Get the filtered dataframes (same as in _to_bytearray)
284
+ filtered_cell_attrs = safe_convert_to_float32(
285
+ self.attributes,
286
+ error_handling='drop'
287
+ )
288
+ filtered_vertex_attrs = safe_convert_to_float32(
289
+ self.points_attributes,
290
+ error_handling='drop'
291
+ )
292
+
281
293
  header = {
282
294
  "vertex_shape" : self.vertex.shape,
283
295
  "cell_shape" : self.cells.shape,
284
- "cell_attr_shape" : self.attributes.shape,
285
- "vertex_attr_shape": self.points_attributes.shape,
286
- "cell_attr_names" : self.attributes.columns.to_list(),
287
- "cell_attr_types" : self.attributes.dtypes.astype(str).to_list(),
288
- "vertex_attr_names": self.points_attributes.columns.to_list(),
289
- "vertex_attr_types": self.attributes.dtypes.astype(str).to_list(),
296
+ "cell_attr_shape" : filtered_cell_attrs.shape,
297
+ "vertex_attr_shape": filtered_vertex_attrs.shape,
298
+ "cell_attr_names" : filtered_cell_attrs.columns.to_list(),
299
+ "cell_attr_types" : filtered_cell_attrs.dtypes.astype(str).to_list(),
300
+ "vertex_attr_names": filtered_vertex_attrs.columns.to_list(),
301
+ "vertex_attr_types": filtered_vertex_attrs.dtypes.astype(str).to_list(),
290
302
  "xarray_attrs" : self.data.attrs
291
303
  }
292
304
  return header
@@ -35,7 +35,7 @@ def read_VTK_structured_grid(file_or_buffer: Union[str, BytesIO], active_scalars
35
35
  try:
36
36
  pyvista_struct: pv.ExplicitStructuredGrid = pv_cast_to_explicit_structured_grid(pyvista_obj)
37
37
  except Exception as e:
38
- raise f"The file is not a structured grid: {e}"
38
+ raise ValueError(f"The file is not a structured grid: {e}")
39
39
 
40
40
  if PLOT := False:
41
41
  pyvista_struct.set_active_scalars(active_scalars)
@@ -301,16 +301,20 @@ def __validate_rectilinear_to_explicit_conversion(rectl_grid, explicit_grid, *,
301
301
  if explicit_grid.n_cells != expected_cells:
302
302
  raise ValueError(f"Cell count mismatch: explicit {explicit_grid.n_cells} vs expected {expected_cells}")
303
303
 
304
- expected_points = nx * ny * nz
305
- if explicit_grid.n_points != expected_points:
306
- raise ValueError(f"Point count mismatch: explicit {explicit_grid.n_points} vs expected {expected_points}")
304
+ # Accept either nodes (M) or corners (N) for n_points, depending on PyVista/VTK version
305
+ M = nx * ny * nz
306
+ N = (2 * (nx - 1)) * (2 * (ny - 1)) * (2 * (nz - 1))
307
+ if explicit_grid.n_points not in (M, N):
308
+ raise ValueError(
309
+ f"Point count unexpected: explicit {explicit_grid.n_points}; expected either nodes {M} or corners {N}"
310
+ )
307
311
 
308
312
  # bounds
309
313
  if not np.allclose(explicit_grid.bounds, rectl_grid.bounds, rtol=rtol, atol=atol):
310
314
  raise ValueError(f"Bounds differ: explicit {explicit_grid.bounds} vs rect {rectl_grid.bounds}")
311
315
 
312
- # axis coordinates (order-independent)
313
- pts = explicit_grid.points # shape (M,3), M = nx*ny*nz (already deduped/sorted by unique)
316
+ # axis coordinates (order-independent, light memory use: 1D uniques per axis)
317
+ pts = explicit_grid.points # may be M×3 (unique nodes) or N×3 (corner lattice)
314
318
  x_exp = np.unique(pts[:, 0])
315
319
  y_exp = np.unique(pts[:, 1])
316
320
  z_exp = np.unique(pts[:, 2])
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: subsurface_terra
3
- Version: 2025.1.0rc17
3
+ Version: 2025.1.0rc19
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
@@ -45,6 +45,7 @@ Requires-Dist: pdf2image; extra == "opt"
45
45
  Requires-Dist: imagecodecs; extra == "opt"
46
46
  Requires-Dist: segyio; extra == "opt"
47
47
  Requires-Dist: segyio; extra == "opt"
48
+ Requires-Dist: segysak; extra == "opt"
48
49
  Requires-Dist: imageio; extra == "opt"
49
50
  Requires-Dist: scipy; extra == "opt"
50
51
  Requires-Dist: geopandas; extra == "opt"
@@ -85,6 +86,7 @@ Requires-Dist: pdf2image; extra == "all"
85
86
  Requires-Dist: imagecodecs; extra == "all"
86
87
  Requires-Dist: segyio; extra == "all"
87
88
  Requires-Dist: segyio; extra == "all"
89
+ Requires-Dist: segysak; extra == "all"
88
90
  Requires-Dist: imageio; extra == "all"
89
91
  Requires-Dist: scipy; extra == "all"
90
92
  Requires-Dist: geopandas; extra == "all"
@@ -1,5 +1,5 @@
1
1
  subsurface/__init__.py,sha256=7_KttQl8rZeJG2AIZUEA_oXRWZYkJ6DUqKjqlLgF9cA,899
2
- subsurface/_version.py,sha256=gsxkMYFwv9EtAE0vhlbi1rqKVeK7ATfhxTYuf25JQK8,722
2
+ subsurface/_version.py,sha256=Eu71ydzhRm4du5tKL1VhSCZmifO4qCBWUC1Wgfjx7ag,722
3
3
  subsurface/optional_requirements.py,sha256=SLaMSoiGTx8ea8rpHee4Zs4te0BXcxxDWC4SF0g0RuE,2767
4
4
  subsurface/api/__init__.py,sha256=Lfx7Dq0GzQsea19w8YO4v1ZSmgeLRgR6IvjvDDjjpDY,356
5
5
  subsurface/api/interfaces/__init__.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
@@ -27,7 +27,7 @@ subsurface/core/structs/base_structures/_liquid_earth_mesh.py,sha256=ZIGLdxbOyC0
27
27
  subsurface/core/structs/base_structures/_unstructured_data_constructor.py,sha256=nSsmRqyGyrU5DKb0YQKy6FwZm6GVBTPwwTLZJsXPcyk,2671
28
28
  subsurface/core/structs/base_structures/base_structures_enum.py,sha256=_B1rsaTnPw6mJhYea0ZIfKmaF3mfkojh-3N5hGG6o5w,90
29
29
  subsurface/core/structs/base_structures/structured_data.py,sha256=N6KcAeZJSfd4Wa0PID8aOcw9IIXrNRZ_DspBzF8JPTY,10310
30
- subsurface/core/structs/base_structures/unstructured_data.py,sha256=-o7XIq886MU_uJHCLFCFklQLNjyLeAx05-cAFMT5y9w,13274
30
+ subsurface/core/structs/base_structures/unstructured_data.py,sha256=8HzBq5gR_bw4xDa96Zwqhu4mmDx8seanNUWPfYISgCk,13727
31
31
  subsurface/core/structs/structured_elements/__init__.py,sha256=wQ8z6vioC98TNwnqMHlDMVFJ1yOKsmlVa6kHL1SOfZQ,43
32
32
  subsurface/core/structs/structured_elements/octree_mesh.py,sha256=3WIgKGPJ3xjjV06gGlLuW7W7POfsJi2z7p4egYD-Y7s,230
33
33
  subsurface/core/structs/structured_elements/structured_grid.py,sha256=S08sbGOu-r-rosHm6fwpqZgmkujxMMev7Z8WAwlsuak,1743
@@ -64,7 +64,7 @@ subsurface/modules/reader/topography/__init__.py,sha256=U41kQFNPpfYV6KJpMnkqgqLk
64
64
  subsurface/modules/reader/topography/topo_core.py,sha256=EzcRFJ_zBojVtZkZHbYaUpEIyFUiVaf6zeSWMuyAxxk,3442
65
65
  subsurface/modules/reader/volume/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
66
66
  subsurface/modules/reader/volume/read_grav3d.py,sha256=5-g65mOMYiOiLqGu3_foDZDGFUIiavkKFC7uZ99v4Dk,14493
67
- subsurface/modules/reader/volume/read_volume.py,sha256=fg928kOBWxGgWnrLdeOvHDRr54cM5nxb_65-lM1BVsk,13581
67
+ subsurface/modules/reader/volume/read_volume.py,sha256=pWZMCzJ6tDnJnVmeO8_ATRBWdXM3VG1J9qX3wN4g6NA,13789
68
68
  subsurface/modules/reader/volume/segy_reader.py,sha256=Yd1fguaKMrgv514Yc8tBm1NxDhWNtI1qOYWWTF_TgPU,3853
69
69
  subsurface/modules/reader/volume/seismic.py,sha256=Iy5zKpjVy7vV6lKyfh_MsUpex6yBMGbovu640NlKkMM,4777
70
70
  subsurface/modules/reader/volume/volume_utils.py,sha256=7Ih6JLrMRotQHO9g0bS43IgsefpiXwcx79EKUBDLhdE,1324
@@ -92,8 +92,8 @@ subsurface/modules/writer/to_rex/material_encoder.py,sha256=J5x1PCW2ljw4JZXLvefG
92
92
  subsurface/modules/writer/to_rex/mesh_encoder.py,sha256=dTGqHGbJKgtPgrrG2lrks5r8timfzluqj7JLMC-EBWQ,6291
93
93
  subsurface/modules/writer/to_rex/to_rex.py,sha256=dFCCWudTUzZebNrPxnM353_vaykE8PQobVtBAPQkb3E,3685
94
94
  subsurface/modules/writer/to_rex/utils.py,sha256=BmMT49WRvbbSuiW_muIvFm4ILR1vcVqh_J23leiMB44,364
95
- subsurface_terra-2025.1.0rc17.dist-info/licenses/LICENSE,sha256=QEY_TMj0mh5hY6jh6avflZOz0GmH1PgurVoF3FvwXaY,11403
96
- subsurface_terra-2025.1.0rc17.dist-info/METADATA,sha256=KdRIAeSl2985ykJvSweVD9Gn1mnwbSnMmiLzH8e_yeg,6900
97
- subsurface_terra-2025.1.0rc17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
98
- subsurface_terra-2025.1.0rc17.dist-info/top_level.txt,sha256=f32R_tUSf83CfkpB4vjv5m2XcD8TmDX9h7F4rnEXt5A,11
99
- subsurface_terra-2025.1.0rc17.dist-info/RECORD,,
95
+ subsurface_terra-2025.1.0rc19.dist-info/licenses/LICENSE,sha256=QEY_TMj0mh5hY6jh6avflZOz0GmH1PgurVoF3FvwXaY,11403
96
+ subsurface_terra-2025.1.0rc19.dist-info/METADATA,sha256=GS3ViagAJ5WQfn0XCWo8aiHTmUJ98m_AM4WpLQog6rE,6978
97
+ subsurface_terra-2025.1.0rc19.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
98
+ subsurface_terra-2025.1.0rc19.dist-info/top_level.txt,sha256=f32R_tUSf83CfkpB4vjv5m2XcD8TmDX9h7F4rnEXt5A,11
99
+ subsurface_terra-2025.1.0rc19.dist-info/RECORD,,