jpjones76 / SeisIO.jl

Julia language support for geophysical time series data
http://seisio.readthedocs.org
Other
47 stars 21 forks source link

mseed parse error on download #42

Closed tclements closed 4 years ago

tclements commented 4 years ago

When trying to download mseed data using get_data, SeisIO throws a MethodError.

I am using Julia 1.3 and SeisIO v1.0.0.

MWE:

using SeisIO, Dates
S = get_data("FDSN","IU.ANMO.00.LHZ",s="2019-02-14",t="2019-02-15")
ERROR: MethodError: no method matching *(::UInt32, ::String)
Closest candidates are:
  *(::Any, ::Any, ::Any, ::Any...) at operators.jl:529
  *(::Missing, ::AbstractString) at missing.jl:170
  *(::T, ::T) where T<:Union{Int128, Int16, Int32, Int64, Int8, UInt128, UInt16, UInt32, UInt64, UInt8} at int.jl:54
  ...
Stacktrace:
 [1] *(::UInt32, ::String, ::UInt32) at ./operators.jl:529
 [2] blk_calib(::SeisData, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Int64, ::UInt16) at /home/timclements/.julia/packages/SeisIO/pSAug/src/Submodules/SEED/1_mSEEDblk.jl:114
 [3] parserec!(::SeisData, ::SeisIO.SeisIOBuf, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Int64, ::Int64, ::Bool, ::Int64) at /home/timclements/.julia/packages/SeisIO/pSAug/src/Submodules/SEED/2_parserec.jl:206
 [4] parsemseed!(::SeisData, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Int64, ::Int64, ::Bool, ::Int64) at /home/timclements/.julia/packages/SeisIO/pSAug/src/Submodules/SEED/readmseed.jl:11
 [5] #FDSNget!#199(::Bool, ::String, ::Bool, ::Int64, ::String, ::Array{Float64,1}, ::Array{Float64,1}, ::String, ::Bool, ::String, ::String, ::Int64, ::Int64, ::Bool, ::String, ::Bool, ::typeof(SeisIO.FDSNget!), ::SeisData, ::Array{String,2}) at /home/timclements/.julia/packages/SeisIO/pSAug/src/Web/FDSN.jl:260
 [6] (::SeisIO.var"#kw##FDSNget!")(::NamedTuple{(:autoname, :fmt, :msr, :nd, :opts, :rad, :reg, :s, :si, :src, :t, :to, :v, :w, :xf, :y),Tuple{Bool,String,Bool,Int64,String,Array{Float64,1},Array{Float64,1},String,Bool,String,String,Int64,Int64,Bool,String,Bool}}, ::typeof(SeisIO.FDSNget!), ::SeisData, ::Array{String,2}) at ./none:0
 [7] #get_data#230(::Bool, ::Bool, ::Bool, ::String, ::Bool, ::Int64, ::String, ::Array{Float64,1}, ::Array{Float64,1}, ::Bool, ::Bool, ::String, ::Bool, ::String, ::Bool, ::String, ::Int64, ::Bool, ::Bool, ::Int64, ::Bool, ::String, ::Bool, ::typeof(get_data), ::String, ::String) at /home/timclements/.julia/packages/SeisIO/pSAug/src/Wrappers/get_data.jl:60
 [8] (::SeisIO.var"#kw##get_data")(::NamedTuple{(:s, :t),Tuple{String,String}}, ::typeof(get_data), ::String, ::String) at ./none:0
 [9] top-level scope at none:0

It looks like IRIS is sending mseed that SeisIO is having trouble reading.

I'm able to read with Obspy, though there is definitely some corrupted data in this trace:

image

jpjones76 commented 4 years ago

Finally! This is one of those calibration blockettes that I've never seen in real data until now. I'll fix the bug today. I'm happy to see it, because finding a real example of one is like finding a unicorn.

jpjones76 commented 4 years ago

Fix pushed live to master. Added your example to SeisIO tests to verify that it now parses. Thanks again for finding one!

jpjones76 commented 4 years ago

I don't actually care that my code coverage decreased 0.01%, but that's the reason for "Some checks were not successful". I wish I could edit those criteria.