Skip to content

Commit

Permalink
merge! no longer ungaps
Browse files Browse the repository at this point in the history
  • Loading branch information
jpjones76 committed May 24, 2016
1 parent d7d3576 commit 2e5cd08
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/SeisData/SeisData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -427,8 +427,9 @@ function merge!(S::SeisObj, U::SeisObj)

# Two full channels
S.fs != U.fs && error("Sampling frequency mismatch; correct manually.")
ungap!(S, m=false, w=false)
T = ungap(U, m=false, w=false)
# ungap!(S, m=false, w=false)
# T = ungap(U, m=false, w=false)
T = deepcopy(U)
if !isapprox(S.gain,T.gain)
(T.x .*= (S.gain/T.gain); T.gain = copy(S.gain)) # rescale T.x to match S.x
end
Expand All @@ -452,8 +453,8 @@ function merge!(S::SeisData, U::SeisObj)
i = i[1]
S.fs[i] != U.fs && return push!(S,U)
T = deepcopy(U)
ungap!(S[i], m=false, w=false)
ungap!(T, m=false, w=false)
#ungap!(S[i], m=false, w=false)
#ungap!(T, m=false, w=false)
if !isapprox(S.gain[i],T.gain)
(T.x .*= (S.gain[i]/T.gain); T.gain = copy(S.gain[i])) # rescale T.x to match S.x
end
Expand Down
2 changes: 2 additions & 0 deletions test/seisdata_test.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ S += (s1 + s2)
@test_approx_eq(length(S.t),1)
@test_approx_eq(length(S.x),1)
@test_approx_eq(true, S.id[1]=="DEAD.STA..EHZ")
ungap!(S, m=false, w=false)
@test_approx_eq(length(S.x[1]), 260)
@test_approx_eq(S.x[1][1:50], s1.x[1:50])
@test_approx_eq(S.x[1][51:75], 0.5.*(s1.x[51:75] .+ s2.x[1:25]))
Expand Down Expand Up @@ -102,6 +103,7 @@ S += (s2 + s4)
@test_approx_eq(S.fs[2], 100.0)
@test_approx_eq(S.gain[1], 10.0)
@test_approx_eq(true, S.id[1]=="DEAD.STA..EHZ")
ungap!(S, m=false, w=false)
@test_approx_eq(length(S.x[1]), 260)
println("...auto-resample on merge...")
@test_approx_eq(length(S.x[2]), 350)
Expand Down

0 comments on commit 2e5cd08

Please sign in to comment.