segyio 2.0.0a1__cp312-cp312-win_amd64.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.
segyio/tracefield.py ADDED
@@ -0,0 +1,204 @@
1
+ from . import Enum
2
+
3
+ class TraceField(Enum):
4
+ """Trace header field enumerator
5
+
6
+ Warning
7
+ -------
8
+ This class is outdated as per SEG-Y rev 2 standard and works only for files
9
+ with default layouts.
10
+
11
+ See :meth:`~segyio.SegyFile.tracefield` for file-dependent fields.
12
+
13
+ See also
14
+ -------
15
+ segyio.su : Seismic unix aliases for header fields
16
+ """
17
+
18
+ TRACE_SEQUENCE_LINE = 1
19
+ TRACE_SEQUENCE_FILE = 5
20
+ FieldRecord = 9
21
+ TraceNumber = 13
22
+ EnergySourcePoint = 17
23
+ CDP = 21
24
+ CDP_TRACE = 25
25
+ TraceIdentificationCode = 29
26
+ NSummedTraces = 31
27
+ NStackedTraces = 33
28
+ DataUse = 35
29
+ offset = 37
30
+ ReceiverGroupElevation = 41
31
+ SourceSurfaceElevation = 45
32
+ SourceDepth = 49
33
+ ReceiverDatumElevation = 53
34
+ SourceDatumElevation = 57
35
+ SourceWaterDepth = 61
36
+ GroupWaterDepth = 65
37
+ ElevationScalar = 69
38
+ SourceGroupScalar = 71
39
+ SourceX = 73
40
+ SourceY = 77
41
+ GroupX = 81
42
+ GroupY = 85
43
+ CoordinateUnits = 89
44
+ WeatheringVelocity = 91
45
+ SubWeatheringVelocity = 93
46
+ SourceUpholeTime = 95
47
+ GroupUpholeTime = 97
48
+ SourceStaticCorrection = 99
49
+ GroupStaticCorrection = 101
50
+ TotalStaticApplied = 103
51
+ LagTimeA = 105
52
+ LagTimeB = 107
53
+ DelayRecordingTime = 109
54
+ MuteTimeStart = 111
55
+ MuteTimeEND = 113
56
+ TRACE_SAMPLE_COUNT = 115
57
+ TRACE_SAMPLE_INTERVAL = 117
58
+ GainType = 119
59
+ InstrumentGainConstant = 121
60
+ InstrumentInitialGain = 123
61
+ Correlated = 125
62
+ SweepFrequencyStart = 127
63
+ SweepFrequencyEnd = 129
64
+ SweepLength = 131
65
+ SweepType = 133
66
+ SweepTraceTaperLengthStart = 135
67
+ SweepTraceTaperLengthEnd = 137
68
+ TaperType = 139
69
+ AliasFilterFrequency = 141
70
+ AliasFilterSlope = 143
71
+ NotchFilterFrequency = 145
72
+ NotchFilterSlope = 147
73
+ LowCutFrequency = 149
74
+ HighCutFrequency = 151
75
+ LowCutSlope = 153
76
+ HighCutSlope = 155
77
+ YearDataRecorded = 157
78
+ DayOfYear = 159
79
+ HourOfDay = 161
80
+ MinuteOfHour = 163
81
+ SecondOfMinute = 165
82
+ TimeBaseCode = 167
83
+ TraceWeightingFactor = 169
84
+ GeophoneGroupNumberRoll1 = 171
85
+ GeophoneGroupNumberFirstTraceOrigField = 173
86
+ GeophoneGroupNumberLastTraceOrigField = 175
87
+ GapSize = 177
88
+ OverTravel = 179
89
+ CDP_X = 181
90
+ CDP_Y = 185
91
+ INLINE_3D = 189
92
+ CROSSLINE_3D = 193
93
+ ShotPoint = 197
94
+ ShotPointScalar = 201
95
+ TraceValueMeasurementUnit = 203
96
+ TransductionConstantMantissa = 205
97
+ TransductionConstantPower = 209
98
+ TransductionUnit = 211
99
+ TraceIdentifier = 213
100
+ ScalarTraceHeader = 215
101
+ SourceType = 217
102
+ SourceEnergyDirectionVert = 219
103
+ SourceEnergyDirectionXline = 221
104
+ SourceEnergyDirectionIline = 223
105
+ SourceMeasurementMantissa = 225
106
+ SourceMeasurementExponent = 229
107
+ SourceMeasurementUnit = 231
108
+ UnassignedInt1 = 233
109
+ UnassignedInt2 = 237
110
+
111
+ keys = {
112
+ 'TRACE_SEQUENCE_LINE' : 1,
113
+ 'TRACE_SEQUENCE_FILE' : 5,
114
+ 'FieldRecord' : 9,
115
+ 'TraceNumber' : 13,
116
+ 'EnergySourcePoint' : 17,
117
+ 'CDP' : 21,
118
+ 'CDP_TRACE' : 25,
119
+ 'TraceIdentificationCode' : 29,
120
+ 'NSummedTraces' : 31,
121
+ 'NStackedTraces' : 33,
122
+ 'DataUse' : 35,
123
+ 'offset' : 37,
124
+ 'ReceiverGroupElevation' : 41,
125
+ 'SourceSurfaceElevation' : 45,
126
+ 'SourceDepth' : 49,
127
+ 'ReceiverDatumElevation' : 53,
128
+ 'SourceDatumElevation' : 57,
129
+ 'SourceWaterDepth' : 61,
130
+ 'GroupWaterDepth' : 65,
131
+ 'ElevationScalar' : 69,
132
+ 'SourceGroupScalar' : 71,
133
+ 'SourceX' : 73,
134
+ 'SourceY' : 77,
135
+ 'GroupX' : 81,
136
+ 'GroupY' : 85,
137
+ 'CoordinateUnits' : 89,
138
+ 'WeatheringVelocity' : 91,
139
+ 'SubWeatheringVelocity' : 93,
140
+ 'SourceUpholeTime' : 95,
141
+ 'GroupUpholeTime' : 97,
142
+ 'SourceStaticCorrection' : 99,
143
+ 'GroupStaticCorrection' : 101,
144
+ 'TotalStaticApplied' : 103,
145
+ 'LagTimeA' : 105,
146
+ 'LagTimeB' : 107,
147
+ 'DelayRecordingTime' : 109,
148
+ 'MuteTimeStart' : 111,
149
+ 'MuteTimeEND' : 113,
150
+ 'TRACE_SAMPLE_COUNT' : 115,
151
+ 'TRACE_SAMPLE_INTERVAL' : 117,
152
+ 'GainType' : 119,
153
+ 'InstrumentGainConstant' : 121,
154
+ 'InstrumentInitialGain' : 123,
155
+ 'Correlated' : 125,
156
+ 'SweepFrequencyStart' : 127,
157
+ 'SweepFrequencyEnd' : 129,
158
+ 'SweepLength' : 131,
159
+ 'SweepType' : 133,
160
+ 'SweepTraceTaperLengthStart' : 135,
161
+ 'SweepTraceTaperLengthEnd' : 137,
162
+ 'TaperType' : 139,
163
+ 'AliasFilterFrequency' : 141,
164
+ 'AliasFilterSlope' : 143,
165
+ 'NotchFilterFrequency' : 145,
166
+ 'NotchFilterSlope' : 147,
167
+ 'LowCutFrequency' : 149,
168
+ 'HighCutFrequency' : 151,
169
+ 'LowCutSlope' : 153,
170
+ 'HighCutSlope' : 155,
171
+ 'YearDataRecorded' : 157,
172
+ 'DayOfYear' : 159,
173
+ 'HourOfDay' : 161,
174
+ 'MinuteOfHour' : 163,
175
+ 'SecondOfMinute' : 165,
176
+ 'TimeBaseCode' : 167,
177
+ 'TraceWeightingFactor' : 169,
178
+ 'GeophoneGroupNumberRoll1' : 171,
179
+ 'GeophoneGroupNumberFirstTraceOrigField': 173,
180
+ 'GeophoneGroupNumberLastTraceOrigField' : 175,
181
+ 'GapSize' : 177,
182
+ 'OverTravel' : 179,
183
+ 'CDP_X' : 181,
184
+ 'CDP_Y' : 185,
185
+ 'INLINE_3D' : 189,
186
+ 'CROSSLINE_3D' : 193,
187
+ 'ShotPoint' : 197,
188
+ 'ShotPointScalar' : 201,
189
+ 'TraceValueMeasurementUnit' : 203,
190
+ 'TransductionConstantMantissa' : 205,
191
+ 'TransductionConstantPower' : 209,
192
+ 'TransductionUnit' : 211,
193
+ 'TraceIdentifier' : 213,
194
+ 'ScalarTraceHeader' : 215,
195
+ 'SourceType' : 217,
196
+ 'SourceEnergyDirectionVert' : 219,
197
+ 'SourceEnergyDirectionXline' : 221,
198
+ 'SourceEnergyDirectionIline' : 223,
199
+ 'SourceMeasurementMantissa' : 225,
200
+ 'SourceMeasurementExponent' : 229,
201
+ 'SourceMeasurementUnit' : 231,
202
+ 'UnassignedInt1' : 233,
203
+ 'UnassignedInt2' : 237,
204
+ }
@@ -0,0 +1,6 @@
1
+ from . import Enum
2
+
3
+ class TraceSortingFormat(Enum):
4
+ UNKNOWN_SORTING = 0
5
+ CROSSLINE_SORTING = 1
6
+ INLINE_SORTING = 2
segyio/utils.py ADDED
@@ -0,0 +1,199 @@
1
+ import warnings
2
+ import numpy as np
3
+ import xml.etree.ElementTree as ET
4
+
5
+ def castarray(x, dtype):
6
+ try:
7
+ x.dtype
8
+ except AttributeError:
9
+ msg = 'Implicit conversion from {} to {} (performance)'
10
+ warnings.warn(msg.format(type(x), np.ndarray), RuntimeWarning)
11
+
12
+ try:
13
+ x = np.require(x, dtype = dtype, requirements = 'CAW')
14
+ except TypeError:
15
+ x = np.fromiter(x, dtype = dtype)
16
+
17
+ if not x.flags['C_CONTIGUOUS']:
18
+ msg = 'Implicit conversion to contiguous array'
19
+ warnings.warn(msg, RuntimeWarning)
20
+
21
+ if x.dtype != dtype:
22
+ # TODO: message depending on narrowing/float-conversion
23
+ msg = 'Implicit conversion from {} to {} (narrowing)'
24
+ warnings.warn(msg.format(x.dtype, dtype), RuntimeWarning)
25
+
26
+ # Ensure the data is C-order contiguous, writable, and aligned, with
27
+ # the appropriate dtype. it won't copy unless it has to, so it's
28
+ # reasonably fast.
29
+ return np.require(x, dtype = dtype, requirements = 'CAW')
30
+
31
+ def to_c_endianness(endian):
32
+ endians = {
33
+ None: -1,
34
+ 'little': 1,
35
+ 'lsb': 1,
36
+ 'big': 0,
37
+ 'msb': 0,
38
+ }
39
+
40
+ if endian not in endians:
41
+ problem = 'unknown endianness {}, expected one of: '
42
+ opts = ' '.join(endians.keys())
43
+ raise ValueError(problem.format(endian) + opts)
44
+
45
+ return endians[endian]
46
+
47
+ def to_c_encoding(encoding):
48
+ encodings = {
49
+ None: -1,
50
+ 'ebcdic': 0,
51
+ 'ascii': 1,
52
+ }
53
+
54
+ if encoding not in encodings:
55
+ problem = 'unknown encoding {}, expected one of: '
56
+ opts = ' '.join(encodings.keys())
57
+ raise ValueError(problem.format(encoding) + opts)
58
+
59
+ return encodings[encoding]
60
+
61
+ class FileDatasourceDescriptor():
62
+ def __init__(self, filename, mode):
63
+ self.filename = filename
64
+ self.mode = mode
65
+
66
+ def __repr__(self):
67
+ return "'{}', '{}'".format(self.filename, self.mode)
68
+
69
+ def __str__(self):
70
+ return "{}".format(self.filename)
71
+
72
+ def readonly(self):
73
+ return self.mode == 'rb' or self.mode == 'r'
74
+
75
+ def make_segyfile_descriptor(self):
76
+ from . import _segyio
77
+ fd = _segyio.segyfd(
78
+ filename=str(self.filename),
79
+ mode=self.mode
80
+ )
81
+ return fd
82
+
83
+
84
+ class StreamDatasourceDescriptor():
85
+ def __init__(self, stream, minimize_requests_number):
86
+ if stream is None:
87
+ raise ValueError("stream object is required")
88
+ self.stream = stream
89
+ self.minimize_requests_number = minimize_requests_number
90
+
91
+ def __repr__(self):
92
+ return "'{}'".format(self.stream)
93
+
94
+ def __str__(self):
95
+ return str(self.stream)
96
+
97
+ def readonly(self):
98
+ return not self.stream.writable()
99
+
100
+ def make_segyfile_descriptor(self):
101
+ from . import _segyio
102
+ fd = _segyio.segyfd(
103
+ stream=self.stream,
104
+ minimize_requests_number=self.minimize_requests_number,
105
+ )
106
+ return fd
107
+
108
+
109
+ class MemoryBufferDatasourceDescriptor():
110
+ def __init__(self, buffer):
111
+ if buffer is None:
112
+ raise ValueError("buffer object is required")
113
+ self.buffer = buffer
114
+
115
+ def __repr__(self):
116
+ return "'memory buffer'"
117
+
118
+ def __str__(self):
119
+ return "memory buffer"
120
+
121
+ def readonly(self):
122
+ return False
123
+
124
+ def make_segyfile_descriptor(self):
125
+ from . import _segyio
126
+ fd = _segyio.segyfd(
127
+ memory_buffer=self.buffer,
128
+ )
129
+ return fd
130
+
131
+
132
+ class TraceHeaderLayoutEntry:
133
+ def __init__(self, name, byte, type, requires_nonzero_value):
134
+ self.name = name
135
+ self.byte = int(byte)
136
+ self.type = type
137
+ self.requires_nonzero_value = bool(int(requires_nonzero_value))
138
+
139
+ def __repr__(self):
140
+ msg = "TraceHeaderLayoutEntry(name='{}', byte={}, type='{}', requires_nonzero_value={})"
141
+ return msg.format(self.name, self.byte, self.type, self.requires_nonzero_value)
142
+
143
+
144
+ class TraceHeaderLayout:
145
+ def __init__(self, entries):
146
+ self.entries = list(entries)
147
+ self._by_byte = {entry.byte: entry for entry in self.entries}
148
+ self._by_name = {entry.name: entry for entry in self.entries}
149
+
150
+ def entry_by_byte(self, byte):
151
+ return self._by_byte.get(byte)
152
+
153
+ def entry_by_name(self, name):
154
+ return self._by_name.get(name)
155
+
156
+ def __iter__(self):
157
+ return iter(self.entries)
158
+
159
+ def __len__(self):
160
+ return len(self.entries)
161
+
162
+
163
+ def parse_trace_headers_layout(xml):
164
+ """
165
+ Parse an XML string into a dict of header name: TraceHeaderLayoutEntry.
166
+ """
167
+ try:
168
+ xml = xml.strip()
169
+ root = ET.fromstring(xml)
170
+ except ET.ParseError as e:
171
+ raise ValueError("Invalid XML: {}".format(e))
172
+
173
+ if root.tag != 'segy-layout':
174
+ msg = "Root must be 'segy-layout', found '{}'"
175
+ raise ValueError(msg.format(root.tag))
176
+
177
+ headers = [root]
178
+ headers.extend([child for child in root if child.tag == 'extension'])
179
+
180
+ layout = {}
181
+
182
+ for header in headers:
183
+ if header.tag == 'segy-layout':
184
+ name = 'SEG00000'
185
+ else:
186
+ name = header.get('name')
187
+ if not name:
188
+ raise ValueError("Extension header is missing name attribute")
189
+ entries = [
190
+ TraceHeaderLayoutEntry(
191
+ child.get('name'),
192
+ child.get('byte'),
193
+ child.get('type'),
194
+ child.get('if-non-zero', '0')
195
+ ) for child in header if child.tag == 'entry'
196
+ ]
197
+ layout[name] = entries
198
+
199
+ return layout
@@ -0,0 +1,67 @@
1
+ Metadata-Version: 2.4
2
+ Name: segyio
3
+ Version: 2.0.0a1
4
+ Summary: Simple & fast IO for SEG-Y files
5
+ Author: Equinor ASA
6
+ License-Expression: LGPL-3.0-or-later
7
+ Classifier: Development Status :: 5 - Production/Stable
8
+ Classifier: Environment :: Other Environment
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: Natural Language :: English
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Topic :: Scientific/Engineering
19
+ Classifier: Topic :: Scientific/Engineering :: Physics
20
+ Classifier: Topic :: Software Development :: Libraries
21
+ Classifier: Topic :: Utilities
22
+ Project-URL: homepage, https://github.com/equinor/segyio
23
+ Requires-Python: >=3.10
24
+ Requires-Dist: numpy>=1.10
25
+ Description-Content-Type: text/markdown
26
+
27
+ =======
28
+ SEGY IO
29
+ =======
30
+
31
+ https://segyio.readthedocs.io
32
+
33
+ Introduction
34
+ ------------
35
+
36
+ Segyio is a small LGPL licensed C library for easy interaction with SEG Y
37
+ formatted seismic data, with language bindings for Python and Matlab. Segyio is
38
+ an attempt to create an easy-to-use, embeddable, community-oriented library for
39
+ seismic applications. Features are added as they are needed; suggestions and
40
+ contributions of all kinds are very welcome.
41
+
42
+ Feature summary
43
+ ---------------
44
+ * A low-level C interface with few assumptions; easy to bind to other
45
+ languages.
46
+ * Read and write binary and textual headers.
47
+ * Read and write traces, trace headers.
48
+ * Easy to use and native-feeling python interface with numpy integration.
49
+
50
+ Project goals
51
+ -------------
52
+
53
+ Segyio does necessarily attempt to be the end-all of SEG-Y interactions;
54
+ rather, we aim to lower the barrier to interacting with SEG-Y files for
55
+ embedding, new applications or free-standing programs.
56
+
57
+ Additionally, the aim is not to support the full standard or all exotic (but
58
+ correctly) formatted files out there. Some assumptions are made, such as:
59
+
60
+ * All traces in a file are assumed to be of the same sample size.
61
+ * It is assumed all lines have the same number of traces.
62
+
63
+ The writing functionality in Segyio is largely meant to *modify* or adapt
64
+ files. A file created from scratch is not necessarily a to-spec SEG-Y file, as
65
+ we only necessarily write the header fields segyio needs to make sense of the
66
+ geometry. It is still highly recommended that SEG-Y files are maintained and
67
+ written according to specification, but segyio does not mandate this.
@@ -0,0 +1,25 @@
1
+ segyio/__init__.py,sha256=EvX66aHHQPJLqAMdvM68-0rukLfwUTlSD2vNMpHwdrk,3736
2
+ segyio/_segyio.cp310-win_amd64.pyd,sha256=zl6_zLiu2SZhAiZHWrLrdOWWEnGcu0Web62IbzGd8Kk,143872
3
+ segyio/_segyio.cp311-win_amd64.pyd,sha256=AWZt4LCYZOdKITeVV_JKXve5iXkixnGSdATAzcpyArs,143872
4
+ segyio/_segyio.cp312-win_amd64.pyd,sha256=rdFXvPvli2xSVZdTa_GVg-GfFDdwvppzkpRY6gCTaBc,144384
5
+ segyio/binfield.py,sha256=MsfRDzRprPKg8TJz4Kd9MWRe90Y51Urb18z7zLoUWSE,4948
6
+ segyio/create.py,sha256=0S_b9hWY7uRRADqxUzwU2b2ihrY5SsKmWP72Rm6EOYg,10366
7
+ segyio/depth.py,sha256=XrlzBmX5aX7zkSAP-PUDn0Xh-quGEAPmxjZfuQeBdBM,5684
8
+ segyio/field.py,sha256=hVZQ0yIlXcurO6kJVb4tIdKGRlsnKIHqf2lkhvCiCm0,23487
9
+ segyio/gather.py,sha256=rKutfM6SvlNVDceH2ccBbW2-oh2MAWeQnMeuhITVQM4,13543
10
+ segyio/line.py,sha256=SlsVTSHXcYY7WVp6-5BJRA6kjt5K1PC18w6TMqIIpaY,17329
11
+ segyio/open.py,sha256=h64ivYFOuYMvJFGt6sVldm76dH0U_qSMhef7wugt8oY,9637
12
+ segyio/segy.py,sha256=tCNH7VNYK3rA6foRKKWMVFCIr31LzWKEhI1j6Tn7ro4,33657
13
+ segyio/segyio.cpp,sha256=kAUcTIWpFAk7HjZgpYFzNIRL996QrjNeyBC99EOfiME,110691
14
+ segyio/segysampleformat.py,sha256=270R67qgsU34z1YXVqYIkOIVsOimItwiAHviHK8WHfw,529
15
+ segyio/su/__init__.py,sha256=4xDXkp_BYI4-arr9i7Q0jPqpiTzcwQRrakXNyG8jR24,46
16
+ segyio/su/file.py,sha256=EMx9jPX3KmHYpctmlNqxEYt0aGUj2GV-B0cEq757B-Y,3105
17
+ segyio/su/words.py,sha256=FXkpkzQPQki0TjMdiZjsYPCK4ORABVlAI7wqfG-U5mQ,5165
18
+ segyio/tools.py,sha256=i2Wp3Vj3JZEk3cr7EfHgNgy4x6f63VPFAASbnr86grg,21883
19
+ segyio/trace.py,sha256=SaQYpARZFC71HDu0agjw9Uq6Oh17TxAXQ1s4bgaxGOk,48875
20
+ segyio/tracefield.py,sha256=oLEpKf4N_MncNghidFEVSYjNQZpeLvPF4q79kqyPWfQ,7684
21
+ segyio/tracesortingformat.py,sha256=3pcdt2iyhtHxr-IaFC348PN8BeLfoyEuLUm3q9owUXc,131
22
+ segyio/utils.py,sha256=VCbczqJOxu6ZRfSh6tj21uxRhQDb2wBOavkKOleYY2Q,5840
23
+ segyio-2.0.0a1.dist-info/METADATA,sha256=_VX692IjDZERZLcWV8y8OVLREnXPb5wlas6mVX3mYsU,2626
24
+ segyio-2.0.0a1.dist-info/WHEEL,sha256=chqeLhPBtPdrOoreR34YMcofSk3yWDQhkrsDJ2n48LU,106
25
+ segyio-2.0.0a1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: scikit-build-core 0.11.6
3
+ Root-Is-Purelib: false
4
+ Tag: cp312-cp312-win_amd64
5
+