-
Notifications
You must be signed in to change notification settings - Fork 5
Writing
SeisBlocks can be written back onto the disk as a SEGY file using the writer segy_write
julia> segy_write("testwrite.segy", block)
WARNING: DataSampleFormat not supported for writing. Attempting to convert to IEEE Float32
SeisBlocks can also be read and written one by one into an exsiting SEGY file using the writer segy_write_append
julia> segy_write_append("testwrite.segy", new_block)
SeisBlock can currently read data in IBMFloat32(DSF 1) and IEEE Float32 (DSF 5), however it will convert IBMFloat32 data to IEEE Float32 when writing.
If the data you want to save as a SEGY file is just an array in memory, you will need to put it into a SeisBlock before you can write it. Passing a 2D array to the SeisBlock constructor will return a bare-bones SeisBlock instance, where all the headers value are zero except for the number of samples and data sample format, which are inferred from the array.
Create an array of data that you wish to save, and pass it to SeisBlock
to construct an object containing the array.
julia> data = zeros(Float32, 1000, 100)
julia> block = SeisBlock(data)
Use set_headers! to populate the blocks headers with the desired metadata. Header fields can be passed as either strings or symbols.
julia> set_header!(block, "dt", 8000)
If a value is the same for all traceheaders, you can pass a scalar.
julia> set_header!(block, :SourceX, 100)
julia> set_header!(block, :SourceY, 100)
Or if the value varies, pass a vector with length ntraces.
julia> set_header!(block, :GroupX, Array(1:100))
julia> set_header!(block, :GroupY, Array(1:100))
If a chosen field is present in both BinaryFileHeaders and BinaryTraceHeaders, both will be set.