SEGY handling in SegyIO.jl

SEGY handling in julia

SegyIO.jl is a Julia package for reading and writing SEGY Rev 1 files. In addition to providing tools for reading/writing entire files, SegyIO provides a parallel scanner that reduces any number of files into a single object with direct out-of-core access to the underlying data.

A video demonstrating the package's capabilities has been made available here.

In this tutorial we will show we handle SEGY data in julia:

  1. How to read a SEGY file
  2. How to scan multiple SEGY files
  3. How JUDI interfaces with SegyIO
using JUDI, SegyIO, PyPlot

Data

We consider a subset of the 2007 BP TTI dataset.

# run this one time to get the data
run(`curl -L -o data.zip https://www.dropbox.com/sh/m2ksfp7wjww3jds/AADswzf_8ZdMiDW-nmrLNgJ0a`)
run(`tar -xvf data.zip`)
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   151    0   151    0     0    595      0 --:--:-- --:--:-- --:--:--   596
100   276  100   276    0     0    247      0  0:00:01  0:00:01 --:--:--     0
100  827M  100  827M    0     0  42.9M      0  0:00:19  0:00:19 --:--:-- 48.2M
tar: Removing leading '/' from member names
x .
x bptti/
x jrmdata/
x bptti/BPTTI_12.segy
x jrmdata/data64.jld2
x bptti/BPTTI_120.segy
x bptti/BPTTI_121.segy
x bptti/BPTTI_122.segy
x bptti/BPTTI_123.segy
x bptti/BPTTI_124.segy
x bptti/BPTTI_125.segy
x bptti/BPTTI_126.segy
x bptti/BPTTI_127.segy
x bptti/BPTTI_128.segy
x bptti/BPTTI_129.segy
x bptti/BPTTI_1200.segy
x bptti/BPTTI_1201.segy
x bptti/BPTTI_1202.segy
x bptti/BPTTI_1203.segy
x bptti/BPTTI_1204.segy
x bptti/BPTTI_1205.segy
x bptti/BPTTI_1206.segy
x bptti/BPTTI_1207.segy
x bptti/BPTTI_1208.segy
x bptti/BPTTI_1209.segy
x bptti/BPTTI_1210.segy
x bptti/BPTTI_1211.segy
x bptti/BPTTI_1212.segy
x bptti/BPTTI_1213.segy
x bptti/BPTTI_1214.segy
x bptti/BPTTI_1215.segy
x bptti/BPTTI_1216.segy
x bptti/BPTTI_1217.segy
x bptti/BPTTI_1218.segy
x bptti/BPTTI_1219.segy
x bptti/BPTTI_1220.segy
x bptti/BPTTI_1221.segy
x bptti/BPTTI_1222.segy
x bptti/BPTTI_1223.segy
x bptti/BPTTI_1224.segy
x bptti/BPTTI_1225.segy
x bptti/BPTTI_1226.segy
x bptti/BPTTI_1227.segy
x bptti/BPTTI_1228.segy
x bptti/BPTTI_1229.segy
x bptti/BPTTI_1230.segy
x bptti/BPTTI_1231.segy
x bptti/BPTTI_1232.segy
x bptti/BPTTI_1233.segy
x bptti/BPTTI_1234.segy
x bptti/BPTTI_1235.segy
x bptti/BPTTI_1236.segy
x bptti/BPTTI_1237.segy
x bptti/BPTTI_1238.segy
x bptti/BPTTI_1239.segy
x bptti/BPTTI_1240.segy
x bptti/BPTTI_1241.segy
x bptti/BPTTI_1242.segy
x bptti/BPTTI_1243.segy
x bptti/BPTTI_1244.segy
x bptti/BPTTI_1245.segy
x bptti/BPTTI_1246.segy
x bptti/BPTTI_1247.segy
x bptti/BPTTI_1248.segy
x bptti/BPTTI_1249.segy
x bptti/BPTTI_1250.segy
x bptti/BPTTI_1251.segy
x bptti/BPTTI_1252.segy
x bptti/BPTTI_1253.segy
x bptti/BPTTI_1254.segy
x bptti/BPTTI_1255.segy
x bptti/BPTTI_1256.segy
x bptti/BPTTI_1257.segy
x bptti/BPTTI_1258.segy
x bptti/BPTTI_1259.segy
x bptti/BPTTI_1260.segy
x bptti/BPTTI_1261.segy
x bptti/BPTTI_1262.segy
x bptti/BPTTI_1263.segy
x bptti/BPTTI_1264.segy
x bptti/BPTTI_1265.segy
x bptti/BPTTI_1266.segy
x bptti/BPTTI_1267.segy
x bptti/BPTTI_1268.segy
x bptti/BPTTI_1269.segy
x bptti/BPTTI_1270.segy
x bptti/BPTTI_1271.segy
x bptti/BPTTI_1272.segy
x bptti/BPTTI_1273.segy
x bptti/BPTTI_1274.segy
x bptti/BPTTI_1275.segy
x bptti/BPTTI_1276.segy
x bptti/BPTTI_1277.segy
x bptti/BPTTI_1278.segy
x bptti/BPTTI_1279.segy
x bptti/BPTTI_1280.segy
x bptti/BPTTI_1281.segy
x bptti/BPTTI_1282.segy
x bptti/BPTTI_1283.segy
x bptti/BPTTI_1284.segy
x bptti/BPTTI_1285.segy
x bptti/BPTTI_1286.segy
x bptti/BPTTI_1287.segy
x bptti/BPTTI_1288.segy
x bptti/BPTTI_1289.segy
x bptti/BPTTI_1290.segy
x bptti/BPTTI_1291.segy
x bptti/BPTTI_1292.segy
x bptti/BPTTI_1293.segy
x bptti/BPTTI_1294.segy
x bptti/BPTTI_1295.segy
x bptti/BPTTI_1296.segy
x bptti/BPTTI_1297.segy
x bptti/BPTTI_1298.segy
x bptti/BPTTI_1299.segy
x wavefieldreconstruction/
x wavefieldreconstruction/Data.jld
x jrmdata/timelapsevrho64vint.jld2
Process(`tar -xvf data.zip`, ProcessExited(0))

SegyRead

We first red a single file directly into memory.

This data is a segy container. We can access different headers and the traces:

  • shot.data contains the traces (in IBMFloat32 format)
  • shot.fileheader contains the file header
  • shot.traceheader[i] containts thew trace heaader for the trace numer i
shot = segy_read("bptti/BPTTI_1289.segy");
┌ Warning: Fixed length trace flag set in stream: IOBuffer(data=UInt8[...], readable=true, writable=false, seekable=true, append=false, size=3878800, maxsize=Inf, ptr=3601, mark=-1)
└ @ SegyIO /Users/francisyin/.julia/packages/SegyIO/qkvUT/src/read/read_file.jl:26
shot.fileheader
/_static/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.json
BinaryFileHeader:
                                Job:         0
                               Line:         0
                               Reel:         0
               DataTracePerEnsemble:         0
          AuxiliaryTracePerEnsemble:         0
                                 dt:      8000
                             dtOrig:         0
                                 ns:      1151
                             nsOrig:         0
                   DataSampleFormat:         5
                       EnsembleFold:         0
                       TraceSorting:         0
                    VerticalSumCode:         0
                SweepFrequencyStart:         0
                  SweepFrequencyEnd:         0
                        SweepLength:         0
                          SweepType:         0
                       SweepChannel:         0
              SweepTaperlengthStart:         0
                SweepTaperLengthEnd:         0
                          TaperType:         0
               CorrelatedDataTraces:         0
                         BinaryGain:         0
            AmplitudeRecoveryMethod:         0
                  MeasurementSystem:         0
              ImpulseSignalPolarity:         0
              VibratoryPolarityCode:         0
           SegyFormatRevisionNumber:         0
               FixedLengthTraceFlag:         0
          NumberOfExtTextualHeaders:         0


shot.traceheaders[10]
/_static/e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.json
BinaryTraceHeader:
                 TraceNumWithinLine:         0
                 TraceNumWithinFile:         0
                        FieldRecord:         0
                        TraceNumber:         0
                  EnergySourcePoint:         0
                                CDP:         0
                           CDPTrace:         0
                        TraceIDCode:         0
                      NSummedTraces:         0
                     NStackedTraces:         0
                            DataUse:         0
                             Offset:         0
                  RecGroupElevation:         0
             SourceSurfaceElevation:         0
                        SourceDepth:         0
                  RecDatumElevation:         0
               SourceDatumElevation:         0
                   SourceWaterDepth:         0
                    GroupWaterDepth:         0
                    ElevationScalar:    -10000
                    RecSourceScalar:    -10000
                            SourceX: 644000000
                            SourceY:         0
                             GroupX: 544875000
                             GroupY:         0
                         CoordUnits:         0
                 WeatheringVelocity:         0
              SubWeatheringVelocity:         0
                   UpholeTimeSource:         0
                    UpholeTimeGroup:         0
             StaticCorrectionSource:         0
              StaticCorrectionGroup:         0
                 TotalStaticApplied:         0
                           LagTimeA:         0
                           LagTimeB:         0
                 DelayRecordingTime:         0
                      MuteTimeStart:         0
                        MuteTimeEnd:         0
                                 ns:      1151
                                 dt:      8000
                           GainType:         0
             InstrumentGainConstant:         0
               InstrumntInitialGain:         0
                         Correlated:         0
                SweepFrequencyStart:         0
                  SweepFrequencyEnd:         0
                        SweepLength:         0
                          SweepType:         0
         SweepTraceTaperLengthStart:         0
           SweepTraceTaperLengthEnd:         0
                          TaperType:         0
               AliasFilterFrequency:         0
                   AliasFilterSlope:         0
               NotchFilterFrequency:         0
                   NotchFilterSlope:         0
                    LowCutFrequency:         0
                   HighCutFrequency:         0
                        LowCutSlope:         0
                       HighCutSlope:         0
                               Year:         0
                          DayOfYear:         0
                          HourOfDay:         0
                       MinuteOfHour:         0
                     SecondOfMinute:         0
                           TimeCode:         0
               TraceWeightingFactor:         0
            GeophoneGroupNumberRoll:         0
      GeophoneGroupNumberTraceStart:         0
        GeophoneGroupNumberTraceEnd:         0
                            GapSize:         0
                         OverTravel:         0
                               CDPX:         0
                               CDPY:         0
                           Inline3D:         0
                        Crossline3D:         0
                          ShotPoint:         0
                    ShotPointScalar:         0
           TraceValueMeasurmentUnit:         0
       TransductionConstnatMantissa:         0
          TransductionConstantPower:         0
                   TransductionUnit:         0
                    TraceIdentifier:         0
                  ScalarTraceHeader:    -10000
                         SourceType:         0
      SourceEnergyDirectionMantissa:         0
      SourceEnergyDirectionExponent:         0
           SourceMeasurmentMantissa:         0
          SourceMeasurementExponent:         0
               SourceMeasurmentUnit:         0
                        Unassigned1:         0
                        Unassigned2:         0


We can then easily extra headers from the segy container

sx = get_header(shot, "SourceX")
rx = get_header(shot, :GroupX);
dt = get_header(shot, :dt)[1]*1e-3
T = (get_header(shot, :ns)[1] -1)*dt
9200.0
extent = [rx[1], rx[end], T, 0]
figure(figsize=(10, 10))
imshow(Float32.(shot.data), vmin=-.5, vmax=.5, cmap="PuOr", interpolation=:hamming, extent=extent)
xlabel("Receiver positon (m)")
ylabel("Time (ms)")
title("Source at $(sx[1])m")
Figure(PyObject <Figure size 1000x1000 with 1 Axes>)
PyObject Text(0.5, 1.0, 'Source at 64400.0m')

Segy Scan

The scanner is designed to be multi-scale, meaning that your workflow will stay the same regardless of whether you are working on 1 MB or 1TB of data. SegyIO accomplishes this by being:

  • Direct. Read only what needs to be read.

  • Seamless. Remove the need to deal with complex filesystems.

  • Performant. Read, write, and scan at disk speed.

A scanned volume provides a higher level of abstraction, removing the need for a user to directly manage individual files. Scanning a file (or a group of files) returns a SeisCon object, which contains the necessary information to partition the volume into more managable pieces and directly access these partitions. By default, the scanner will automatically partition the volume when the source location changes.

dir2scan = joinpath(pwd(),"bptti/")
file_filter = "BPTTI"
"BPTTI"

We choose wich keys we want to get easy access to after the scan.

keys = ["GroupX", "GroupY", "RecGroupElevation", "SourceSurfaceElevation", "dt"]
5-element Vector{String}: "GroupX" "GroupY" "RecGroupElevation" "SourceSurfaceElevation" "dt"
segy_lu = segy_scan(dir2scan, file_filter, keys);
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1200.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1201.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1202.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1203.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1204.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1205.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1206.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1207.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1208.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1209.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1210.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1211.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1212.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1213.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1214.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1215.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1216.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1217.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1218.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1219.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1220.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1221.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1222.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1223.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1224.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1225.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1226.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1227.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1228.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1229.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1230.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1231.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1232.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1233.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1234.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1235.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1236.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1237.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1238.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1239.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1240.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1241.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1242.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1243.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1244.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1245.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1246.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1247.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1248.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1249.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1250.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1251.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1252.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1253.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1254.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1255.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1256.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1257.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1258.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1259.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1260.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1261.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1262.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1263.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1264.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1265.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1266.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1267.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1268.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1269.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1270.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1271.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1272.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1273.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1274.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1275.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1276.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1277.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1278.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1279.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1280.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1281.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1282.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1283.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1284.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1285.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1286.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1287.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1288.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1289.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1290.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1291.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1292.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1293.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1294.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1295.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1296.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1297.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1298.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_1299.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_129.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_128.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_127.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_126.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_125.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_124.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_123.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_122.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_121.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_120.segy
Scanning ... /Users/francisyin/Desktop/SLIMTutorials/bptti/BPTTI_12.segy

As we can see we found all the segy files in the directory. We know there is 111 shot records let's check the container

length(segy_lu)
111

We scanned correctly the directory for all the shot records. We can now extract global information such as all the source positions

src_locations = get_sources(segy_lu).*1e-4
111×2 Matrix{Float64}: 59950.0 0.0 60000.0 0.0 60050.0 0.0 60100.0 0.0 60150.0 0.0 60200.0 0.0 60250.0 0.0 60300.0 0.0 60350.0 0.0 60400.0 0.0 60450.0 0.0 60500.0 0.0 60550.0 0.0 ⋮ 64900.0 0.0 6400.0 0.0 6350.0 0.0 6300.0 0.0 6250.0 0.0 6200.0 0.0 6150.0 0.0 6100.0 0.0 6050.0 0.0 6000.0 0.0 5950.0 0.0 550.0 0.0

judiVector

Finally, we can wrap the segy container into a judiVector to use it for example for inversion

d_tti = judiVector(segy_lu);
d_tti.nsrc
111

And we can create a source object with unknow wavelet (initialize to a wavelet in this case)

src_geometry = Geometry(segy_lu; key="source")
wavelet = ricker_wavelet(src_geometry.t[1], src_geometry.dt[1], 0.015)  # 15 Hz peak frequency
q = judiVector(src_geometry, wavelet)
judiVector{Float32, Matrix{Float32}} with 111 sources
shot_id = 47
shot = get_data(d_tti[47])
xrec = shot.geometry.xloc[1]
xsrc = Geometry(q[47].geometry).xloc[1] # convert the out of core geometry to an incore geometry to read the value
1-element Vector{Float32}: 62250.0
extent = [xrec[1], xrec[end], src_geometry.t[1], 0]
figure(figsize=(10, 10))
imshow(shot.data[1], vmin=-.5, vmax=.5, cmap="PuOr", interpolation=:hamming, extent=extent)
xlabel("Receiver positon (m)")
ylabel("Time (ms)")
title("Source at $(sx[1])m")
Figure(PyObject <Figure size 1000x1000 with 1 Axes>)
PyObject Text(0.5, 1.0, 'Source at 64400.0m')