Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(self.nEast - 1)
self.startCrline = segyfile.xlines[0]
self.endCrline = segyfile.xlines[-1]
self.nNorth = len(segyfile.xlines)
self.stepCrline = (self.endCrline - self.startCrline) // \
(self.nNorth - 1)
self.startDepth = segyfile.samples[0]
self.endDepth = segyfile.samples[-1]
self.nDepth = len(segyfile.samples)
self.stepDepth = (self.endDepth - self.startDepth) // \
(self.nDepth - 1)
inline_A = self.startInline
crline_A = self.startCrline
index_A = 0
x_A = segyfile.header[index_A][segyio.su.cdpx]
y_A = segyfile.header[index_A][segyio.su.cdpy]
inline_B = inline_A
crline_B = self.startCrline + 2 * self.stepCrline
index_B = 2
x_B = segyfile.header[index_B][segyio.su.cdpx]
y_B = segyfile.header[index_B][segyio.su.cdpy]
inline_C = self.startInline + 2 * self.stepInline
crline_C = crline_B
index_C = 2 * self.nNorth + 2
x_C = segyfile.header[index_C][segyio.su.cdpx]
y_C = segyfile.header[index_C][segyio.su.cdpy]
setting_dict = {
"inline_range": [
samplecount = len(spec.samples)
with segyio.create(filename, spec) as f:
tr = 0
for ilno, il in enumerate(spec.ilines):
for xlno, xl in enumerate(spec.xlines):
for offno, off in enumerate(spec.offsets):
f.header[tr] = {
segyio.su.tracf : tr,
segyio.su.cdpt : tr,
segyio.su.offset : off,
segyio.su.ns : samplecount,
segyio.su.dt : dt,
segyio.su.delrt : delrt,
segyio.su.iline : il,
segyio.su.xline : xl
}
if dimensions == 2: f.trace[tr] = data[tr, :]
if dimensions == 3: f.trace[tr] = data[ilno, xlno, :]
if dimensions == 4: f.trace[tr] = data[ilno, xlno, offno, :]
tr += 1
f.bin.update(
tsort=TraceSortingFormat.INLINE_SORTING,
hdt=dt,
dto=dt
)
spec.samples = list(range(np.size(data,3)))
samplecount = len(spec.samples)
with segyio.create(filename, spec) as f:
tr = 0
for ilno, il in enumerate(spec.ilines):
for xlno, xl in enumerate(spec.xlines):
for offno, off in enumerate(spec.offsets):
f.header[tr] = {
segyio.su.tracf : tr,
segyio.su.cdpt : tr,
segyio.su.offset : off,
segyio.su.ns : samplecount,
segyio.su.dt : dt,
segyio.su.delrt : delrt,
segyio.su.iline : il,
segyio.su.xline : xl
}
if dimensions == 2: f.trace[tr] = data[tr, :]
if dimensions == 3: f.trace[tr] = data[ilno, xlno, :]
if dimensions == 4: f.trace[tr] = data[ilno, xlno, offno, :]
tr += 1
f.bin.update(
tsort=TraceSortingFormat.INLINE_SORTING,
hdt=dt,
dto=dt
)
samplecount = len(spec.samples)
with segyio.create(filename, spec) as f:
tr = 0
for ilno, il in enumerate(spec.ilines):
for xlno, xl in enumerate(spec.xlines):
for offno, off in enumerate(spec.offsets):
f.header[tr] = {
segyio.su.tracf : tr,
segyio.su.cdpt : tr,
segyio.su.offset : off,
segyio.su.ns : samplecount,
segyio.su.dt : dt,
segyio.su.delrt : delrt,
segyio.su.iline : il,
segyio.su.xline : xl
}
if dimensions == 2: f.trace[tr] = data[tr, :]
if dimensions == 3: f.trace[tr] = data[ilno, xlno, :]
if dimensions == 4: f.trace[tr] = data[ilno, xlno, offno, :]
tr += 1
f.bin.update(
tsort=TraceSortingFormat.INLINE_SORTING,
hdt=dt,
dto=dt
)
if dimensions == 4:
spec.ilines = list(range(1, np.size(data, 0) + 1))
spec.xlines = list(range(1, np.size(data, 1) + 1))
spec.offsets = list(range(1, np.size(data, 2)+ 1))
spec.samples = list(range(np.size(data,3)))
samplecount = len(spec.samples)
with segyio.create(filename, spec) as f:
tr = 0
for ilno, il in enumerate(spec.ilines):
for xlno, xl in enumerate(spec.xlines):
for offno, off in enumerate(spec.offsets):
f.header[tr] = {
segyio.su.tracf : tr,
segyio.su.cdpt : tr,
segyio.su.offset : off,
segyio.su.ns : samplecount,
segyio.su.dt : dt,
segyio.su.delrt : delrt,
segyio.su.iline : il,
segyio.su.xline : xl
}
if dimensions == 2: f.trace[tr] = data[tr, :]
if dimensions == 3: f.trace[tr] = data[ilno, xlno, :]
if dimensions == 4: f.trace[tr] = data[ilno, xlno, offno, :]
tr += 1
f.bin.update(
tsort=TraceSortingFormat.INLINE_SORTING,
hdt=dt,
spec.ilines = list(range(1, np.size(data, 0) + 1))
spec.xlines = list(range(1, np.size(data, 1) + 1))
spec.offsets = list(range(1, np.size(data, 2)+ 1))
spec.samples = list(range(np.size(data,3)))
samplecount = len(spec.samples)
with segyio.create(filename, spec) as f:
tr = 0
for ilno, il in enumerate(spec.ilines):
for xlno, xl in enumerate(spec.xlines):
for offno, off in enumerate(spec.offsets):
f.header[tr] = {
segyio.su.tracf : tr,
segyio.su.cdpt : tr,
segyio.su.offset : off,
segyio.su.ns : samplecount,
segyio.su.dt : dt,
segyio.su.delrt : delrt,
segyio.su.iline : il,
segyio.su.xline : xl
}
if dimensions == 2: f.trace[tr] = data[tr, :]
if dimensions == 3: f.trace[tr] = data[ilno, xlno, :]
if dimensions == 4: f.trace[tr] = data[ilno, xlno, offno, :]
tr += 1
f.bin.update(
tsort=TraceSortingFormat.INLINE_SORTING,
hdt=dt,
dto=dt
)
# the rightmost digits is the index of the sample in that trace meaning
# looking up an inline's i's jth crosslines' k should be roughly equal
# to (offset*100) + i.j0k.
trace = np.arange(start = start,
stop = start + step * len(spec.samples),
step = step,
dtype = np.single)
# Write the file trace-by-trace and update headers with iline, xline
# and offset
tr = 0
for il in spec.ilines:
for xl in spec.xlines:
for off in spec.offsets:
f.header[tr] = {
segyio.su.offset : off,
segyio.su.iline : il,
segyio.su.xline : xl
}
f.trace[tr] = trace + (xl / 100.0) + il + (off * 100)
tr += 1
f.bin.update(
tsort=segyio.TraceSortingFormat.INLINE_SORTING
)
# to (offset*100) + i.j0k.
trace = np.arange(start = start,
stop = start + step * len(spec.samples),
step = step,
dtype = np.single)
# Write the file trace-by-trace and update headers with iline, xline
# and offset
tr = 0
for il in spec.ilines:
for xl in spec.xlines:
for off in spec.offsets:
f.header[tr] = {
segyio.su.offset : off,
segyio.su.iline : il,
segyio.su.xline : xl
}
f.trace[tr] = trace + (xl / 100.0) + il + (off * 100)
tr += 1
f.bin.update(
tsort=segyio.TraceSortingFormat.INLINE_SORTING
)
for il in spec.ilines:
for xl in spec.xlines:
if masklambda(il, xl):
f.header[tr] = {segyio.su.offset: 1, segyio.su.iline: il, segyio.su.xline: xl}
f.trace[tr] = trace * ((xl / 100.0) + il)
tr += 1
f.bin.update(tsort=segyio.TraceSortingFormat.CROSSLINE_SORTING)
else:
# Write the file trace-by-trace and update headers with iline, xline
# and offset
tr = 0
for il in spec.ilines:
for xl in spec.xlines:
if masklambda(il, xl):
f.header[tr] = {segyio.su.offset: 1, segyio.su.iline: il, segyio.su.xline: xl}
f.trace[tr] = trace + (xl / 100.0) + il
tr += 1
f.bin.update(tsort=segyio.TraceSortingFormat.INLINE_SORTING)
print(f"\ttraces: {tr}")
spec.xlines = list(range(1, np.size(data, 1) + 1))
spec.offsets = list(range(1, np.size(data, 2)+ 1))
spec.samples = list(range(np.size(data,3)))
samplecount = len(spec.samples)
with segyio.create(filename, spec) as f:
tr = 0
for ilno, il in enumerate(spec.ilines):
for xlno, xl in enumerate(spec.xlines):
for offno, off in enumerate(spec.offsets):
f.header[tr] = {
segyio.su.tracf : tr,
segyio.su.cdpt : tr,
segyio.su.offset : off,
segyio.su.ns : samplecount,
segyio.su.dt : dt,
segyio.su.delrt : delrt,
segyio.su.iline : il,
segyio.su.xline : xl
}
if dimensions == 2: f.trace[tr] = data[tr, :]
if dimensions == 3: f.trace[tr] = data[ilno, xlno, :]
if dimensions == 4: f.trace[tr] = data[ilno, xlno, offno, :]
tr += 1
f.bin.update(
tsort=TraceSortingFormat.INLINE_SORTING,
hdt=dt,
dto=dt
)