segyio 1.9.13__cp313-cp313-macosx_10_13_x86_64.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.

Potentially problematic release.


This version of segyio might be problematic. Click here for more details.

@@ -0,0 +1,19 @@
1
+ from . import Enum
2
+
3
+ class SegySampleFormat(Enum):
4
+ IBM_FLOAT_4_BYTE = 1
5
+ SIGNED_INTEGER_4_BYTE = 2
6
+ SIGNED_SHORT_2_BYTE = 3
7
+ FIXED_POINT_WITH_GAIN_4_BYTE = 4
8
+ IEEE_FLOAT_4_BYTE = 5
9
+ IEEE_FLOAT_8_BYTE = 6
10
+ SIGNED_CHAR_3_BYTE = 7
11
+ SIGNED_CHAR_1_BYTE = 8
12
+ SIGNED_INTEGER_8_BYTE = 9
13
+ UNSIGNED_INTEGER_4_BYTE = 10
14
+ UNSIGNED_SHORT_2_BYTE = 11
15
+ UNSIGNED_INTEGER_8_BYTE = 12
16
+ UNSIGNED_INTEGER_3_BYTE = 15
17
+ UNSIGNED_CHAR_1_BYTE = 16
18
+ NOT_IN_USE_1 = 19
19
+ NOT_IN_USE_2 = 20
segyio/su/__init__.py ADDED
@@ -0,0 +1,2 @@
1
+ from .words import *
2
+ from .file import open
segyio/su/file.py ADDED
@@ -0,0 +1,118 @@
1
+ from ..open import infer_geometry
2
+ from ..segy import SegyFile
3
+ from . import words
4
+
5
+ import numpy
6
+
7
+ class sufile(SegyFile):
8
+ def __init__(self, *args, **kwargs):
9
+ super(sufile, self).__init__(*args, **kwargs)
10
+
11
+ @property
12
+ def text(self):
13
+ raise NotImplementedError
14
+
15
+ @property
16
+ def bin(self):
17
+ raise NotImplementedError
18
+
19
+ @bin.setter
20
+ def bin(self, _):
21
+ raise NotImplementedError
22
+
23
+ def open(filename, mode = 'r', iline = 189,
24
+ xline = 193,
25
+ strict = True,
26
+ ignore_geometry = False,
27
+ endian = 'big' ):
28
+ """Open a seismic unix file.
29
+
30
+ Behaves identically to open(), except it expects the seismic unix format,
31
+ not SEG-Y.
32
+
33
+ Parameters
34
+ ----------
35
+ filename : str
36
+ Path to file to open
37
+
38
+ mode : {'r', 'r+'}
39
+ File access mode, read-only ('r', default) or read-write ('r+')
40
+
41
+ iline : int or segyio.TraceField
42
+ Inline number field in the trace headers. Defaults to 189 as per the
43
+ SEG-Y rev1 specification
44
+
45
+ xline : int or segyio.TraceField
46
+ Crossline number field in the trace headers. Defaults to 193 as per the
47
+ SEG-Y rev1 specification
48
+
49
+ strict : bool, optional
50
+ Abort if a geometry cannot be inferred. Defaults to True.
51
+
52
+ ignore_geometry : bool, optional
53
+ Opt out on building geometry information, useful for e.g. shot
54
+ organised files. Defaults to False.
55
+
56
+ endian : {'big', 'msb', 'little', 'lsb'}
57
+ File endianness, big/msb (default) or little/lsb
58
+
59
+ Returns
60
+ -------
61
+ file : segyio.su.file
62
+ An open seismic unix file handle
63
+
64
+ Raises
65
+ ------
66
+ ValueError
67
+ If the mode string contains 'w', as it would truncate the file
68
+
69
+ See also
70
+ --------
71
+ segyio.open : SEG-Y open
72
+
73
+ Notes
74
+ -----
75
+ .. versionadded:: 1.8
76
+ """
77
+
78
+ if 'w' in mode:
79
+ problem = 'w in mode would truncate the file'
80
+ solution = 'use r+ to open in read-write'
81
+ raise ValueError(', '.join((problem, solution)))
82
+
83
+ endians = {
84
+ 'little': 256, # (1 << 8)
85
+ 'lsb': 256,
86
+ 'big': 0,
87
+ 'msb': 0,
88
+ }
89
+
90
+ if endian not in endians:
91
+ problem = 'unknown endianness, must be one of: '
92
+ candidates = ' '.join(endians.keys())
93
+ raise ValueError(problem + candidates)
94
+
95
+ from .. import _segyio
96
+ fd = _segyio.segyiofd(str(filename), mode, endians[endian])
97
+ fd.suopen()
98
+ metrics = fd.metrics()
99
+
100
+ f = sufile(
101
+ fd,
102
+ filename = str(filename),
103
+ mode = mode,
104
+ iline = iline,
105
+ xline = xline,
106
+ )
107
+
108
+ h0 = f.header[0]
109
+
110
+ dt = h0[words.dt] / 1000.0
111
+ t0 = h0[words.delrt]
112
+ samples = metrics['samplecount']
113
+ f._samples = (numpy.arange(samples) * dt) + t0
114
+
115
+ if ignore_geometry:
116
+ return f
117
+
118
+ return infer_geometry(f, metrics, iline, xline, strict)
segyio/su/words.py ADDED
@@ -0,0 +1,284 @@
1
+ """Seismic Unix aliases
2
+
3
+ Seismic Unix style aliases for binary and trace header fields.
4
+
5
+ Notes
6
+ -----
7
+
8
+ .. versionadded: 1.1
9
+
10
+ Seismic Unix does not have names for all possible fields, as it came
11
+ around during an early revision of SEG-Y, and names for these fields
12
+ are created by segyio in their absence. If Seismic Unix starts
13
+ providing names for these fields, they will be added to these alies,
14
+ and in conflicts take presedence after some time. If there are no
15
+ conflicts, segyio names are considered for deprecation on a
16
+ case-by-case basis, but will most likely be supported along with the
17
+ Seismic Unix name.
18
+ """
19
+
20
+ from ..tracefield import TraceField as tf
21
+ from ..binfield import BinField as bf
22
+
23
+ # the wonky #: before every line is so that sphinx' autodoc picks it up, and includes the constants in the documentation
24
+
25
+ #:
26
+ tracl = tf.TRACE_SEQUENCE_LINE
27
+ #:
28
+ tracr = tf.TRACE_SEQUENCE_FILE
29
+ #:
30
+ fldr = tf.FieldRecord
31
+ #:
32
+ tracf = tf.TraceNumber
33
+ #:
34
+ ep = tf.EnergySourcePoint
35
+ #:
36
+ cdp = tf.CDP
37
+ #:
38
+ cdpt = tf.CDP_TRACE
39
+ #:
40
+ trid = tf.TraceIdentificationCode
41
+ #:
42
+ nvs = tf.NSummedTraces
43
+ #:
44
+ nhs = tf.NStackedTraces
45
+ #:
46
+ duse = tf.DataUse
47
+ #:
48
+ offset = tf.offset
49
+ #:
50
+ gelev = tf.ReceiverGroupElevation
51
+ #:
52
+ selev = tf.SourceSurfaceElevation
53
+ #:
54
+ sdepth = tf.SourceDepth
55
+ #:
56
+ gdel = tf.ReceiverDatumElevation
57
+ #:
58
+ sdel = tf.SourceDatumElevation
59
+ #:
60
+ swdep = tf.SourceWaterDepth
61
+ #:
62
+ gwdep = tf.GroupWaterDepth
63
+ #:
64
+ scalel = tf.ElevationScalar
65
+ #:
66
+ scalco = tf.SourceGroupScalar
67
+ #:
68
+ sx = tf.SourceX
69
+ #:
70
+ sy = tf.SourceY
71
+ #:
72
+ gx = tf.GroupX
73
+ #:
74
+ gy = tf.GroupY
75
+ #:
76
+ counit = tf.CoordinateUnits
77
+ #:
78
+ wevel = tf.WeatheringVelocity
79
+ #:
80
+ swevel = tf.SubWeatheringVelocity
81
+ #:
82
+ sut = tf.SourceUpholeTime
83
+ #:
84
+ gut = tf.GroupUpholeTime
85
+ #:
86
+ sstat = tf.SourceStaticCorrection
87
+ #:
88
+ gstat = tf.GroupStaticCorrection
89
+ #:
90
+ tstat = tf.TotalStaticApplied
91
+ #:
92
+ laga = tf.LagTimeA
93
+ #:
94
+ lagb = tf.LagTimeB
95
+ #:
96
+ delrt = tf.DelayRecordingTime
97
+ #:
98
+ muts = tf.MuteTimeStart
99
+ #:
100
+ mute = tf.MuteTimeEND
101
+ #:
102
+ ns = tf.TRACE_SAMPLE_COUNT
103
+ #:
104
+ dt = tf.TRACE_SAMPLE_INTERVAL
105
+ #:
106
+ gain = tf.GainType
107
+ #:
108
+ igc = tf.InstrumentGainConstant
109
+ #:
110
+ igi = tf.InstrumentInitialGain
111
+ #:
112
+ corr = tf.Correlated
113
+ #:
114
+ sfs = tf.SweepFrequencyStart
115
+ #:
116
+ sfe = tf.SweepFrequencyEnd
117
+ #:
118
+ slen = tf.SweepLength
119
+ #:
120
+ styp = tf.SweepType
121
+ #:
122
+ stat = tf.SweepTraceTaperLengthStart
123
+ #:
124
+ stae = tf.SweepTraceTaperLengthEnd
125
+ #:
126
+ tatyp = tf.TaperType
127
+ #:
128
+ afilf = tf.AliasFilterFrequency
129
+ #:
130
+ afils = tf.AliasFilterSlope
131
+ #:
132
+ nofilf = tf.NotchFilterFrequency
133
+ #:
134
+ nofils = tf.NotchFilterSlope
135
+ #:
136
+ lcf = tf.LowCutFrequency
137
+ #:
138
+ hcf = tf.HighCutFrequency
139
+ #:
140
+ lcs = tf.LowCutSlope
141
+ #:
142
+ hcs = tf.HighCutSlope
143
+ #:
144
+ year = tf.YearDataRecorded
145
+ #:
146
+ day = tf.DayOfYear
147
+ #:
148
+ hour = tf.HourOfDay
149
+ #:
150
+ minute = tf.MinuteOfHour
151
+ #:
152
+ sec = tf.SecondOfMinute
153
+ #:
154
+ timbas = tf.TimeBaseCode
155
+ #:
156
+ trwf = tf.TraceWeightingFactor
157
+ #:
158
+ grnors = tf.GeophoneGroupNumberRoll1
159
+ #:
160
+ grnofr = tf.GeophoneGroupNumberFirstTraceOrigField
161
+ #:
162
+ grnlof = tf.GeophoneGroupNumberLastTraceOrigField
163
+ #:
164
+ gaps = tf.GapSize
165
+ #:
166
+ otrav = tf.OverTravel
167
+ #:
168
+ cdpx = tf.CDP_X
169
+ #:
170
+ cdpy = tf.CDP_Y
171
+ #:
172
+ iline = tf.INLINE_3D
173
+ #:
174
+ xline = tf.CROSSLINE_3D
175
+ #:
176
+ sp = tf.ShotPoint
177
+ #:
178
+ scalsp = tf.ShotPointScalar
179
+ #:
180
+ trunit = tf.TraceValueMeasurementUnit
181
+ #:
182
+ tdcm = tf.TransductionConstantMantissa
183
+ #:
184
+ tdcp = tf.TransductionConstantPower
185
+ #:
186
+ tdunit = tf.TransductionUnit
187
+ #:
188
+ triden = tf.TraceIdentifier
189
+ #:
190
+ sctrh = tf.ScalarTraceHeader
191
+ #:
192
+ stype = tf.SourceType
193
+ #:
194
+ sedm = tf.SourceEnergyDirectionMantissa
195
+ #:
196
+ sede = tf.SourceEnergyDirectionExponent
197
+ #:
198
+ smm = tf.SourceMeasurementMantissa
199
+ #:
200
+ sme = tf.SourceMeasurementExponent
201
+ #:
202
+ smunit = tf.SourceMeasurementUnit
203
+ #:
204
+ uint1 = tf.UnassignedInt1
205
+ #:
206
+ uint2 = tf.UnassignedInt2
207
+
208
+ # binary
209
+ #:
210
+ jobid = bf.JobID
211
+ #:
212
+ lino = bf.LineNumber
213
+ #:
214
+ reno = bf.ReelNumber
215
+ #:
216
+ ntrpr = bf.Traces
217
+ #:
218
+ nart = bf.AuxTraces
219
+ #:
220
+ hdt = bf.Interval
221
+ #:
222
+ dto = bf.IntervalOriginal
223
+ #:
224
+ hns = bf.Samples
225
+ #:
226
+ nso = bf.SamplesOriginal
227
+ #:
228
+ format = bf.Format
229
+ #:
230
+ fold = bf.EnsembleFold
231
+ #:
232
+ tsort = bf.SortingCode
233
+ #:
234
+ vscode = bf.VerticalSum
235
+ #:
236
+ hsfs = bf.SweepFrequencyStart
237
+ #:
238
+ hsfe = bf.SweepFrequencyEnd
239
+ #:
240
+ hslen = bf.SweepLength
241
+ #:
242
+ hstyp = bf.Sweep
243
+ #:
244
+ schn = bf.SweepChannel
245
+ #:
246
+ hstas = bf.SweepTaperStart
247
+ #:
248
+ hstae = bf.SweepTaperEnd
249
+ #:
250
+ htatyp = bf.Taper
251
+ #:
252
+ hcorr = bf.CorrelatedTraces
253
+ #:
254
+ bgrcv = bf.BinaryGainRecovery
255
+ #:
256
+ rcvm = bf.AmplitudeRecovery
257
+ #:
258
+ mfeet = bf.MeasurementSystem
259
+ #:
260
+ polyt = bf.ImpulseSignalPolarity
261
+ #:
262
+ vpol = bf.VibratoryPolarity
263
+ #:
264
+ unas1 = bf.Unassigned1
265
+ #:
266
+ extntrpr = bf.ExtTraces
267
+ #:
268
+ extnart = bf.ExtAuxTraces
269
+ #:
270
+ exthns = bf.ExtSamples
271
+ #:
272
+ extnso = bf.ExtSamplesOriginal
273
+ #:
274
+ extfold = bf.ExtEnsembleFold
275
+ #:
276
+ rev = bf.SEGYRevision
277
+ #:
278
+ revmin = bf.SEGYRevisionMinor
279
+ #:
280
+ trflag = bf.TraceFlag
281
+ #:
282
+ exth = bf.ExtendedHeaders
283
+ #:
284
+ unas2 = bf.Unassigned2