diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5fcacde..acf7f89 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: - version: ['1.6', '1.7', '1.8'] + version: ['1.6', '1.7', '1.8', '1.9', '1.10'] os: [ubuntu-latest, macos-latest] steps: diff --git a/Project.toml b/Project.toml index 453ce50..84b177a 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "SegyIO" uuid = "157a0f19-4d44-4de5-a0d0-07e2f0ac4dfa" authors = ["Henryk Modzelewski "] -version = "0.8.3" +version = "0.8.4" [deps] Distributed = "8ba89e20-285c-5b6f-9357-94700520ee1b" diff --git a/src/read/read_con.jl b/src/read/read_con.jl index ef4f676..51a2d78 100644 --- a/src/read/read_con.jl +++ b/src/read/read_con.jl @@ -25,9 +25,7 @@ function read_con(con::SeisCon, blocks::Array{Int,1}; # Pre-allocate data = Array{datatype,2}(undef, con.ns, prealloc_traces) headers = zeros(BinaryTraceHeader, prealloc_traces) - fh = FileHeader() - set_fileheader!(fh.bfh, :ns, con.ns) - set_fileheader!(fh.bfh, :DataSampleFormat, con.dsf) + fh = read_fileheader(con.blocks[1].file) trace_count = 0 # Read all blocks @@ -75,8 +73,7 @@ function read_con(con::SeisCon, keys::Array{String,1}, blocks::Array{Int,1}; # Pre-allocate data = Array{datatype,2}(undef, con.ns, prealloc_traces) headers = zeros(BinaryTraceHeader, prealloc_traces) - fh = FileHeader(); set_fileheader!(fh.bfh, :ns, con.ns) - set_fileheader!(fh.bfh, :DataSampleFormat, con.dsf) + fh = read_fileheader(con.blocks[1].file) trace_count = 0 # Read all blocks diff --git a/src/read/read_fileheader.jl b/src/read/read_fileheader.jl index 24efaa2..27f953c 100644 --- a/src/read/read_fileheader.jl +++ b/src/read/read_fileheader.jl @@ -67,3 +67,19 @@ function read_fileheader(s::IO, keys::Array{String,1}; bigendian::Bool = true) seek(s, 3600) return FileHeader(String(th[1:3200]), bfh) end + + +""" +# Info + +Use: fileheader = read_fileheader(s::String; bigendian::Bool = true) + +Returns a binary file header formed using bytes 3200-3600 from the stream 's' that is +automatically opened then closed +""" +function read_fileheader(s::String; bigendian::Bool = true) + open(s) do file + fh = read_fileheader(file; bigendian=bigendian) + return fh + end +end \ No newline at end of file