Working on SeisIO#master with Julia 1.5.0, trying to resample some NodalData, which throws an error. Here is a MWE:
using SeisIO, SeisIO.Nodal
ND = NodalData(rand(Float32,1000,10),Dict{String,Any}(),Int64[],0) # initialize from random matrix
ND.fs = ones(10) .* 1000. # set fs = 1000 Hz
resample(ND,fs=200.) # resample to 200 Hz
ERROR: MethodError: no method matching deleteat!(::SubArray{Float32,1,Array{Float32,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}, ::UnitRange{Int64})
Closest candidates are:
deleteat!(::SentinelArrays.MissingVector, ::Any) at /home/timclements/.julia/packages/SentinelArrays/Ubf17/src/missingvector.jl:51
deleteat!(::BitArray{1}, ::UnitRange{Int64}) at bitarray.jl:942
deleteat!(::BitArray{1}, ::Any) at bitarray.jl:966
...
Stacktrace:
[1] cheap_resample!(::Array{Int64,2}, ::SubArray{Float32,1,Array{Float32,2},Tuple{Base.Slice{Base.OneTo{Int64}},Int64},true}, ::Float64, ::Float64) at /home/timclements/.julia/dev/SeisIO/src/Processing/resample.jl:31
[2] resample!(::NodalData; chans::Array{Int64,1}, fs::Float64) at /home/timclements/.julia/dev/SeisIO/src/Processing/resample.jl:72
[3] #resample#153 at /home/timclements/.julia/dev/SeisIO/src/Processing/resample.jl:99 [inlined]
[4] top-level scope at REPL[38]:1
cheap_resample! is throwing an error when trying to delete a 1D view of a matrix.
I can write a new version of cheap_resample for 2D arrays. My solution is to overwrite the existing data column by column, then trim the excess rows in the case of downsampling (upsampling requires a vcat).
Working on SeisIO#master with Julia 1.5.0, trying to
resample
someNodalData
, which throws an error. Here is a MWE:cheap_resample!
is throwing an error when trying to delete a 1D view of a matrix.I can write a new version of
cheap_resample
for 2D arrays. My solution is to overwrite the existing data column by column, then trim the excess rows in the case of downsampling (upsampling requires avcat
).