-
Notifications
You must be signed in to change notification settings - Fork 5
/
test_read.jl
90 lines (71 loc) · 2.61 KB
/
test_read.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# Test reading component of SegyIO
global s = IOBuffer(read(joinpath(SegyIO.myRoot,"data/overthrust_2D_shot_1_20.segy")))
@testset "read" begin
##0000
@testset "read_fileheader" begin
fh = read_fileheader(s)
@test typeof(fh) == SegyIO.FileHeader
@test sizeof(fh.th) == 3200
@test fh.bfh.ns == 751
@test fh.bfh.Job == 1
fh = read_fileheader(s, ["ns"; "Job"])
@test typeof(fh) == SegyIO.FileHeader
@test sizeof(fh.th) == 3200
@test fh.bfh.ns == 751
@test fh.bfh.Job == 1
fh = read_fileheader(s, bigendian = false )
@test typeof(fh) == SegyIO.FileHeader
@test sizeof(fh.th) == 3200
@test fh.bfh.ns == -4350
@test fh.bfh.Job == 16777216
fh = read_fileheader(s, ["ns"; "Job"], bigendian = false )
@test typeof(fh) == SegyIO.FileHeader
@test sizeof(fh.th) == 3200
@test fh.bfh.ns == -4350
@test fh.bfh.Job == 16777216
end
println(" ")
##3600
@testset "read_traceheader" begin
seek(s, 3600)
th_b2s = th_byte2sample()
th = read_traceheader(s, th_b2s)
@test typeof(th) == BinaryTraceHeader
@test th.ns == 751
@test th.SourceX == 400
@test th.GroupX == 100
seek(s, 3600)
th = read_traceheader(s, ["ns", "SourceX", "GroupX"], th_b2s)
@test typeof(th) == BinaryTraceHeader
@test th.ns == 751
@test th.SourceX == 400
@test th.GroupX == 100
seek(s, 3600)
th = read_traceheader(s, th_b2s, bigendian = false)
@test typeof(th) == BinaryTraceHeader
@test th.ns == -4350
@test th.SourceX == -1878982656
seek(s, 3600)
th = read_traceheader(s, ["ns", "SourceX", "GroupX"], th_b2s, bigendian = false)
@test typeof(th) == BinaryTraceHeader
@test th.ns == -4350
@test th.SourceX == -1878982656
end
##0000
@testset "read_file" begin
b = read_file(s, false)
@test typeof(b) == SegyIO.SeisBlock{SegyIO.IBMFloat32}
@test b.fileheader.bfh.ns == 751
@test b.traceheaders[1].ns == 751
@test size(b.data) == (751, 3300)
@test length(b.traceheaders) == 3300
@test Float32(b.data[100]) == -2.2972927f0
b = read_file(s, ["ns"], false)
@test typeof(b) == SegyIO.SeisBlock{SegyIO.IBMFloat32}
@test b.fileheader.bfh.ns == 751
@test b.traceheaders[1].ns == 751
@test size(b.data) == (751, 3300)
@test length(b.traceheaders) == 3300
@test Float32(b.data[100]) == -2.2972927f0
end
end