subsurface-terra 2026.1.1rc1__py3-none-any.whl → 2026.1.2rc1__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 = '2026.1.1rc1'
32
- __version_tuple__ = version_tuple = (2026, 1, 1, 'rc1')
31
+ __version__ = version = '2026.1.2rc1'
32
+ __version_tuple__ = version_tuple = (2026, 1, 2, 'rc1')
33
33
 
34
34
  __commit_id__ = commit_id = None
@@ -47,7 +47,10 @@ def data_frame_to_unstructured_data(survey_df: 'pd.DataFrame', number_nodes: int
47
47
 
48
48
  this_well_vertex = np.vstack([pos.easting, pos.northing, pos.depth]).T
49
49
  cum_vertex = np.vstack([cum_vertex, this_well_vertex])
50
- measured_depths = _calculate_distances(array_of_vertices=this_well_vertex)
50
+ measured_depths = _calculate_distances(
51
+ array_of_vertices=this_well_vertex,
52
+ start_md = depths[0]
53
+ )
51
54
 
52
55
  n_vertex_shift_0 = np.arange(0, len(pos.depth) - 1, dtype=np.int_)
53
56
  n_vertex_shift_1 = np.arange(1, len(pos.depth), dtype=np.int_)
@@ -152,12 +155,12 @@ def _grab_depths_from_attr(
152
155
  return attr_depths
153
156
 
154
157
 
155
- def _calculate_distances(array_of_vertices: np.ndarray) -> np.ndarray:
158
+ def _calculate_distances(array_of_vertices: np.ndarray, start_md: float = 0) -> np.ndarray:
156
159
  # Calculate the differences between consecutive points
157
160
  differences = np.diff(array_of_vertices, axis=0)
158
161
 
159
162
  # Calculate the Euclidean distance for each pair of consecutive points
160
163
  distances = np.linalg.norm(differences, axis=1)
161
- # Insert a 0 at the beginning to represent the starting point at the surface
162
- measured_depths = np.insert(np.cumsum(distances), 0, 0)
164
+ # Start from start_md instead of 0
165
+ measured_depths = np.insert(np.cumsum(distances) + start_md, 0, start_md)
163
166
  return measured_depths
@@ -11,7 +11,7 @@ from ....core.reader_helpers.reader_unstruct import ReaderUnstructuredHelper
11
11
  from ..mesh.surfaces_api import read_2d_mesh_to_unstruct
12
12
 
13
13
 
14
- def read_structured_topography(path, crop_to_extent: Optional[Sequence]=None) -> StructuredData:
14
+ def read_structured_topography(path, crop_to_extent: Optional[Sequence] = None) -> StructuredData:
15
15
  rasterio = require_rasterio()
16
16
 
17
17
  extension = get_extension(path)
@@ -31,8 +31,34 @@ def read_structured_topography_to_unstructured(path) -> UnstructuredData:
31
31
  return topography_to_unstructured_data(structured_data)
32
32
 
33
33
 
34
- def rasterio_dataset_to_structured_data(dataset, crop_to_extent: Optional[Sequence]=None):
35
- if crop_to_extent is not None:
34
+ def rasterio_dataset_to_structured_data(dataset, crop_to_extent: Optional[Sequence] = None):
35
+ rasterio = require_rasterio()
36
+
37
+ if crop_to_extent is not None:
38
+ window = _get_raster_window(crop_to_extent, dataset)
39
+ else:
40
+ window = None
41
+
42
+ data = dataset.read(1, window=window)
43
+ data = np.fliplr(data.T)
44
+ shape = data.shape
45
+
46
+ # Use window bounds if cropping, otherwise use full dataset bounds
47
+ if window is not None:
48
+ left, bottom, right, top = rasterio.windows.bounds(window, dataset.transform)
49
+ else:
50
+ left, bottom, right, top = dataset.bounds.left, dataset.bounds.bottom, dataset.bounds.right, dataset.bounds.top
51
+
52
+ coords = {
53
+ 'x': np.linspace(left, right, shape[0]),
54
+ 'y': np.linspace(bottom, top, shape[1])
55
+ }
56
+ structured_data = StructuredData.from_numpy(data, data_array_name='topography', coords=coords)
57
+ return structured_data
58
+
59
+
60
+ def rasterio_dataset_to_structured_data_(dataset, crop_to_extent: Optional[Sequence] = None):
61
+ if crop_to_extent is not None:
36
62
  window = _get_raster_window(crop_to_extent, dataset)
37
63
  else:
38
64
  window = None
@@ -40,30 +66,30 @@ def rasterio_dataset_to_structured_data(dataset, crop_to_extent: Optional[Sequen
40
66
  data = dataset.read(1, window=window)
41
67
  data = np.fliplr(data.T)
42
68
  shape = data.shape
43
-
69
+
44
70
  # TODO: ===================
45
71
  # TODO: Add the option to crop
46
72
  # TODO: Resample
47
-
73
+
48
74
  coords = {
49
- 'x': np.linspace(
50
- dataset.bounds.left,
51
- dataset.bounds.right,
52
- shape[0]
53
- ),
54
- 'y': np.linspace(
55
- dataset.bounds.bottom,
56
- dataset.bounds.top,
57
- shape[1]
58
- )
75
+ 'x': np.linspace(
76
+ dataset.bounds.left,
77
+ dataset.bounds.right,
78
+ shape[0]
79
+ ),
80
+ 'y': np.linspace(
81
+ dataset.bounds.bottom,
82
+ dataset.bounds.top,
83
+ shape[1]
84
+ )
59
85
  }
60
86
  structured_data = StructuredData.from_numpy(data, data_array_name='topography', coords=coords)
61
87
  return structured_data
62
88
 
63
89
 
64
- def read_unstructured_topography(path, additional_reader_kwargs: Optional[dict]=None) -> UnstructuredData:
90
+ def read_unstructured_topography(path, additional_reader_kwargs: Optional[dict] = None) -> UnstructuredData:
65
91
  """For example, a dxf file"""
66
-
92
+
67
93
  additional_reader_kwargs = additional_reader_kwargs or {}
68
94
  helper = GenericReaderFilesHelper(
69
95
  file_or_buffer=path,
@@ -21,7 +21,12 @@ def check_format_and_read_to_df(reader_helper: GenericReaderFilesHelper) -> pd.D
21
21
  )
22
22
  case (bytes() | io.BytesIO() | io.StringIO() | io.TextIOWrapper()), _:
23
23
  reader = _get_reader(reader_helper.format)
24
- d = reader(reader_helper.file_or_buffer, **reader_helper.pandas_reader_kwargs)
24
+ d = reader(
25
+ filepath_or_buffer=reader_helper.file_or_buffer,
26
+ sep=reader_helper.separator,
27
+ engine='python',
28
+ **reader_helper.pandas_reader_kwargs
29
+ )
25
30
  case dict(), _:
26
31
  reader = _get_reader('dict')
27
32
  d = reader(reader_helper.file_or_buffer)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: subsurface_terra
3
- Version: 2026.1.1rc1
3
+ Version: 2026.1.2rc1
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=7_KttQl8rZeJG2AIZUEA_oXRWZYkJ6DUqKjqlLgF9cA,899
2
- subsurface/_version.py,sha256=x_XUkgur2S5FBHy9HGt2HBG6flOou1FypU142m3se8w,720
2
+ subsurface/_version.py,sha256=tE78uKXzXCH9s4NPbDhW9zz9Qd46coDQ2Jr5voEKWms,720
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
@@ -12,7 +12,7 @@ subsurface/core/geological_formats/fault.py,sha256=Rsy8uvtOQCd9qxI6pfNDNE9DE3XTY
12
12
  subsurface/core/geological_formats/boreholes/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
13
13
  subsurface/core/geological_formats/boreholes/_combine_trajectories.py,sha256=2CC_zp_ZpWw7RM7vSbFRWWpTYchs0h6Qagm-HumqJyw,5129
14
14
  subsurface/core/geological_formats/boreholes/_map_attrs_to_survey.py,sha256=BC143dgj6DzBmAerqDzo6pfqU1gUh3cQe6_LrZDnaSY,9230
15
- subsurface/core/geological_formats/boreholes/_survey_to_unstruct.py,sha256=toQvj1rgkucYyvjSlh0zsbP3fcJAXLCYLIbZh-boSsU,6430
15
+ subsurface/core/geological_formats/boreholes/_survey_to_unstruct.py,sha256=aSzUmGa1qRU8tef5BaUiicf4gINvPYs9dpu0aUw_nrE,6483
16
16
  subsurface/core/geological_formats/boreholes/boreholes.py,sha256=wFeyT_G4N8bh6eYGQshOic_2bs8OGIv32Kr7SrSI5r4,6405
17
17
  subsurface/core/geological_formats/boreholes/collars.py,sha256=JdcrIy1JN7QS6gL1SzzqUwelanIX8geAH4r57HdhdGA,724
18
18
  subsurface/core/geological_formats/boreholes/survey.py,sha256=ajb0Y9nylmIiK9J3MyGF8kDp5MO5MdH-Z62-ubbOrbM,3500
@@ -61,7 +61,7 @@ subsurface/modules/reader/petrel/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRk
61
61
  subsurface/modules/reader/profiles/__init__.py,sha256=ajz1GSNU9xYVrFEDSz6Xwg7amWQ_yvW75tQa1ZvRIWc,3
62
62
  subsurface/modules/reader/profiles/profiles_core.py,sha256=tBvNgdvrpUWRIJv4aW3YYcnX7tJAup10fIOSCRB3zto,6371
63
63
  subsurface/modules/reader/topography/__init__.py,sha256=U41kQFNPpfYV6KJpMnkqgqLkozqXiG4tgV6rj8IW1BU,7
64
- subsurface/modules/reader/topography/topo_core.py,sha256=EzcRFJ_zBojVtZkZHbYaUpEIyFUiVaf6zeSWMuyAxxk,3442
64
+ subsurface/modules/reader/topography/topo_core.py,sha256=qwNamnsY5_Uy7z51BtgOt7Yz7_7Qfe_UZrcwDlvaq1U,4397
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
67
  subsurface/modules/reader/volume/read_volume.py,sha256=W1meuMPbkW8S3Nh7KN2DnNWNFoHHgOp0kv7GQkL7oM8,4386
@@ -69,7 +69,7 @@ subsurface/modules/reader/volume/segy_reader.py,sha256=Yd1fguaKMrgv514Yc8tBm1NxD
69
69
  subsurface/modules/reader/volume/seismic.py,sha256=Iy5zKpjVy7vV6lKyfh_MsUpex6yBMGbovu640NlKkMM,4777
70
70
  subsurface/modules/reader/volume/volume_utils.py,sha256=7Ih6JLrMRotQHO9g0bS43IgsefpiXwcx79EKUBDLhdE,1324
71
71
  subsurface/modules/reader/wells/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
72
- subsurface/modules/reader/wells/_read_to_df.py,sha256=bAfh-K372qXwRDEBYIyS4Vy1qOg1OYaOXjGDQoa0fx0,2270
72
+ subsurface/modules/reader/wells/_read_to_df.py,sha256=uYv2iHH_C9MgTGTqS5igKpOVGAgg6MJhVVzwNbwIWZE,2413
73
73
  subsurface/modules/reader/wells/read_borehole_interface.py,sha256=9b9evxY7HScOF51Iaa7Om3ImQypaSBuoCx8uV53oQeI,5751
74
74
  subsurface/modules/reader/wells/wells_utils.py,sha256=46o3mm9hpreaeo4P7izx7tLC6wGyynRMUU1JMnK9930,2138
75
75
  subsurface/modules/reader/wells/DEP/__init__.py,sha256=IV0_m6AY2NM-IVImhBZnLmIaQIzunt7wg79sqPrxV2I,1844
@@ -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-2026.1.1rc1.dist-info/licenses/LICENSE,sha256=QEY_TMj0mh5hY6jh6avflZOz0GmH1PgurVoF3FvwXaY,11403
96
- subsurface_terra-2026.1.1rc1.dist-info/METADATA,sha256=BGDU1h_Urn7IMMscBrp8tpM7mSobDMcDsxWEd58_Jxg,6977
97
- subsurface_terra-2026.1.1rc1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
98
- subsurface_terra-2026.1.1rc1.dist-info/top_level.txt,sha256=f32R_tUSf83CfkpB4vjv5m2XcD8TmDX9h7F4rnEXt5A,11
99
- subsurface_terra-2026.1.1rc1.dist-info/RECORD,,
95
+ subsurface_terra-2026.1.2rc1.dist-info/licenses/LICENSE,sha256=QEY_TMj0mh5hY6jh6avflZOz0GmH1PgurVoF3FvwXaY,11403
96
+ subsurface_terra-2026.1.2rc1.dist-info/METADATA,sha256=idGw-WWnxpPtY4_q2ur3ZMvNyHy-PuMVv0j0oXilJko,6977
97
+ subsurface_terra-2026.1.2rc1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
98
+ subsurface_terra-2026.1.2rc1.dist-info/top_level.txt,sha256=f32R_tUSf83CfkpB4vjv5m2XcD8TmDX9h7F4rnEXt5A,11
99
+ subsurface_terra-2026.1.2rc1.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (80.9.0)
2
+ Generator: setuptools (80.10.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5