From c90305912000989632cd48333e5123126f283ead Mon Sep 17 00:00:00 2001 From: Joshua Date: Tue, 11 Aug 2020 22:30:18 -0700 Subject: [PATCH] Issue #54 --- docs/CHANGELOG.md | 6 ++++++ src/Processing/detrend.jl | 2 +- src/Submodules/Nodal/Utils/merge.jl | 1 + src/Submodules/Nodal/imports.jl | 1 + test/Nodal/test_processing.jl | 10 ++++++++++ 5 files changed, 19 insertions(+), 1 deletion(-) create mode 100644 src/Submodules/Nodal/Utils/merge.jl create mode 100644 test/Nodal/test_processing.jl diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index 29aa6c5c..1fe54441 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -1,3 +1,9 @@ +# 2020-08-11 +* Automated testing for Julia v.1.4 has ended. Tested versions of the language include v1.0 (LTS) and v1.5 (stable). +* Added tests for processing functions on a NodalData object; tests Issue #54 +* Changed internal function dtr! to accept `::AbstractArray{T,1}` in first +positional argument; fixes Issue #54 + # 2020-07-15 Added SeisIO.Nodal for reading data files from nodal arrays * New types: diff --git a/src/Processing/detrend.jl b/src/Processing/detrend.jl index a154a2bd..f5572583 100644 --- a/src/Processing/detrend.jl +++ b/src/Processing/detrend.jl @@ -71,7 +71,7 @@ demean(S::GphysData, irr::Bool=false) = (U = deepcopy(S); demean!(U, chans=chans, irr=irr); return U) demean(C::GphysChannel) = (U = deepcopy(C); demean!(U); return U) -function dtr!(x::Array{T,1}, ti::Array{Int64,2}, fs::Float64, n::Int64) where T <: AbstractFloat +function dtr!(x::AbstractArray{T,1}, ti::Array{Int64,2}, fs::Float64, n::Int64) where T <: AbstractFloat L = length(x) # check for nans diff --git a/src/Submodules/Nodal/Utils/merge.jl b/src/Submodules/Nodal/Utils/merge.jl new file mode 100644 index 00000000..fc906141 --- /dev/null +++ b/src/Submodules/Nodal/Utils/merge.jl @@ -0,0 +1 @@ +merge_ext!(S::NodalData, Ω::Int64, rest::Array{Int64, 1}) = nothing diff --git a/src/Submodules/Nodal/imports.jl b/src/Submodules/Nodal/imports.jl index f6c09544..a74da9b2 100644 --- a/src/Submodules/Nodal/imports.jl +++ b/src/Submodules/Nodal/imports.jl @@ -18,6 +18,7 @@ import SeisIO: BUF, dtconst, flat_resp, loctyp2code, + merge_ext!, mk_t, mkxstr, parsetimewin, diff --git a/test/Nodal/test_processing.jl b/test/Nodal/test_processing.jl new file mode 100644 index 00000000..ca640a96 --- /dev/null +++ b/test/Nodal/test_processing.jl @@ -0,0 +1,10 @@ +printstyled(" processing of NodalData\n", color=:light_green) + +fstr = path*"/SampleFiles/Nodal/Node1_UTC_20200307_170738.006.tdms" +S1 = read_nodal(fstr) + +# these should all work +for f in (:convert_seis!, :demean!, :detrend!, :filtfilt!, :merge!, :sync!, :taper!, :ungap!, :unscale!) + printstyled(string(" ", f, "\n"), color=:light_green) + getfield(SeisIO, f)(S1) +end