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.
@@ -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,120 @@
1
+ from ..open import infer_geometry
2
+ from ..segy import SegyFile
3
+ from . import words
4
+ from ..utils import FileDatasourceDescriptor, to_c_endianness
5
+
6
+ import numpy
7
+
8
+ class sufile(SegyFile):
9
+ def __init__(self, *args, **kwargs):
10
+ super(sufile, self).__init__(*args, **kwargs)
11
+
12
+ @property
13
+ def text(self):
14
+ raise NotImplementedError
15
+
16
+ @property
17
+ def bin(self):
18
+ raise NotImplementedError
19
+
20
+ @bin.setter
21
+ def bin(self, _):
22
+ raise NotImplementedError
23
+
24
+ def open(filename, mode = 'r', iline = 189,
25
+ xline = 193,
26
+ strict = True,
27
+ ignore_geometry = False,
28
+ endian = 'big' ):
29
+ """Open a seismic unix file.
30
+
31
+ Behaves identically to open(), except it expects the seismic unix format,
32
+ not SEG-Y.
33
+
34
+ Parameters
35
+ ----------
36
+ filename : str
37
+ Path to file to open
38
+
39
+ mode : {'r', 'r+'}
40
+ File access mode, read-only ('r', default) or read-write ('r+')
41
+
42
+ iline : int or segyio.TraceField
43
+ Inline number field in the trace headers. Defaults to 189 as per the
44
+ SEG-Y rev1 specification
45
+
46
+ xline : int or segyio.TraceField
47
+ Crossline number field in the trace headers. Defaults to 193 as per the
48
+ SEG-Y rev1 specification
49
+
50
+ strict : bool, optional
51
+ Abort if a geometry cannot be inferred. Defaults to True.
52
+
53
+ ignore_geometry : bool, optional
54
+ Opt out on building geometry information, useful for e.g. shot
55
+ organised files. Defaults to False.
56
+
57
+ endian : {'big', 'msb', 'little', 'lsb'}
58
+ File endianness, big/msb (default) or little/lsb
59
+
60
+ Returns
61
+ -------
62
+ file : segyio.su.file
63
+ An open seismic unix file handle
64
+
65
+ Raises
66
+ ------
67
+ ValueError
68
+ If the mode string contains 'w', as it would truncate the file
69
+
70
+ See also
71
+ --------
72
+ segyio.open : SEG-Y open
73
+
74
+ Notes
75
+ -----
76
+ .. versionadded:: 1.8
77
+ """
78
+
79
+ if 'w' in mode:
80
+ problem = 'w in mode would truncate the file'
81
+ solution = 'use r+ to open in read-write'
82
+ raise ValueError(', '.join((problem, solution)))
83
+
84
+ return _open(
85
+ FileDatasourceDescriptor(filename, mode),
86
+ iline, xline, strict, ignore_geometry, endian
87
+ )
88
+
89
+
90
+ def _open(datasource_descriptor,
91
+ iline=189,
92
+ xline=193,
93
+ strict=True,
94
+ ignore_geometry=False,
95
+ endian='big'):
96
+
97
+ fd = datasource_descriptor.make_segyfile_descriptor()
98
+ fd.suopen(
99
+ endianness=to_c_endianness(endian),
100
+ iline=int(iline),
101
+ xline=int(xline)
102
+ )
103
+ metrics = fd.metrics()
104
+
105
+ f = sufile(
106
+ fd,
107
+ datasource_descriptor,
108
+ )
109
+
110
+ h0 = f.header[0]
111
+
112
+ dt = h0[words.dt] / 1000.0
113
+ t0 = h0[words.delrt]
114
+ samples = metrics['samplecount']
115
+ f._samples = (numpy.arange(samples) * dt) + t0
116
+
117
+ if ignore_geometry:
118
+ return f
119
+
120
+ return infer_geometry(f, metrics, strict)
segyio/su/words.py ADDED
@@ -0,0 +1,286 @@
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
+ sedv = tf.SourceEnergyDirectionVert
195
+ #:
196
+ sedxl = tf.SourceEnergyDirectionXline
197
+ #:
198
+ sedil = tf.SourceEnergyDirectionIline
199
+ #:
200
+ smm = tf.SourceMeasurementMantissa
201
+ #:
202
+ sme = tf.SourceMeasurementExponent
203
+ #:
204
+ smunit = tf.SourceMeasurementUnit
205
+ #:
206
+ uint1 = tf.UnassignedInt1
207
+ #:
208
+ uint2 = tf.UnassignedInt2
209
+
210
+ # binary
211
+ #:
212
+ jobid = bf.JobID
213
+ #:
214
+ lino = bf.LineNumber
215
+ #:
216
+ reno = bf.ReelNumber
217
+ #:
218
+ ntrpr = bf.EnsembleTraces
219
+ #:
220
+ nart = bf.AuxEnsembleTraces
221
+ #:
222
+ hdt = bf.Interval
223
+ #:
224
+ dto = bf.IntervalOriginal
225
+ #:
226
+ hns = bf.Samples
227
+ #:
228
+ nso = bf.SamplesOriginal
229
+ #:
230
+ format = bf.Format
231
+ #:
232
+ fold = bf.EnsembleFold
233
+ #:
234
+ tsort = bf.SortingCode
235
+ #:
236
+ vscode = bf.VerticalSum
237
+ #:
238
+ hsfs = bf.SweepFrequencyStart
239
+ #:
240
+ hsfe = bf.SweepFrequencyEnd
241
+ #:
242
+ hslen = bf.SweepLength
243
+ #:
244
+ hstyp = bf.Sweep
245
+ #:
246
+ schn = bf.SweepChannel
247
+ #:
248
+ hstas = bf.SweepTaperStart
249
+ #:
250
+ hstae = bf.SweepTaperEnd
251
+ #:
252
+ htatyp = bf.Taper
253
+ #:
254
+ hcorr = bf.CorrelatedTraces
255
+ #:
256
+ bgrcv = bf.BinaryGainRecovery
257
+ #:
258
+ rcvm = bf.AmplitudeRecovery
259
+ #:
260
+ mfeet = bf.MeasurementSystem
261
+ #:
262
+ polyt = bf.ImpulseSignalPolarity
263
+ #:
264
+ vpol = bf.VibratoryPolarity
265
+ #:
266
+ unas1 = bf.Unassigned1
267
+ #:
268
+ extntrpr = bf.ExtEnsembleTraces
269
+ #:
270
+ extnart = bf.ExtAuxEnsembleTraces
271
+ #:
272
+ exthns = bf.ExtSamples
273
+ #:
274
+ extnso = bf.ExtSamplesOriginal
275
+ #:
276
+ extfold = bf.ExtEnsembleFold
277
+ #:
278
+ rev = bf.SEGYRevision
279
+ #:
280
+ revmin = bf.SEGYRevisionMinor
281
+ #:
282
+ trflag = bf.TraceFlag
283
+ #:
284
+ exth = bf.ExtendedHeaders
285
+ #:
286
+ unas2 = bf.Unassigned2