jpjones76 / SeisIO.jl

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

issue with get_data() #19

Closed kura-okubo closed 5 years ago

kura-okubo commented 5 years ago

Hello jpjones76,

I found an error when using SeisIO.get_data. When downloading a specific channel, it returns unknown error message, which is not simply like 'no data found' or 'Document is empty'. I would like to ask if this is an error associated with SeisIO or server error.

script

using SeisIO

get_data("FDSN", "TA.353A..LHZ", s="2012-08-20T12:00:00", t = t, src="IRIS", v=1) # this works get_data("FDSN", "TA.355A..LHZ", s="2012-08-20T12:00:00", t = t, src="IRIS", v=1) # this does not work

error message

julia> get_data("FDSN", "TA.355A..LHZ", s="2012-08-20T12:00:00", t = t, src="IRIS", v=1) [ Info: 2019-08-22T16:48:11.050: Querying FDSN stations [ Info: 2019-08-22T16:48:11.357: Building list of channels [ Info: 2019-08-22T16:48:11.361: Data query begins ERROR: MethodError: no method matching read(::Base.GenericIOBuffer{Array{UInt8,1}}, ::Int64; all=false) Closest candidates are: read(::Base.GenericIOBuffer, ::Integer) at iobuffer.jl:461 got unsupported keyword argument "all" read(::IO, ::Integer) at io.jl:827 got unsupported keyword argument "all" read(::IOStream, ::Integer; all) at iostream.jl:512 ... Stacktrace: [1] blk_201(::SeisData, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Int64) at ~/.julia/dev/SeisIO/src/Formats/SEED/1_mSEEDblk.jl:42 [2] parserec!(::SeisData, ::SeisIO.SeisIOBuf, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Int64, ::Int64, ::Int64) at ~/.julia/dev/SeisIO/src/Formats/SEED/2_parserec.jl:190 [3] parsemseed!(::SeisData, ::Base.GenericIOBuffer{Array{UInt8,1}}, ::Int64, ::Int64, ::Int64) at ~/.julia/dev/SeisIO/src/Formats/SEED/readmseed.jl:13 [4] #FDSNget!#172(::String, ::Int64, ::String, ::Array{Float64,1}, ::Array{Float64,1}, ::String, ::Bool, ::String, ::Int64, ::Int64, ::Int64, ::Bool, ::String, ::Bool, ::typeof(SeisIO.FDSNget!), ::SeisData, ::Array{String,2}) at ~/.julia/dev/SeisIO/src/Web/FDSN.jl:234 [5] (::getfield(SeisIO, Symbol("#kw##FDSNget!")))(::NamedTuple{(:fmt, :nd, :opts, :rad, :reg, :s, :si, :src, :t, :to, :v, :w, :xf, :y),Tuple{String,Int64,String,Array{Float64,1},Array{Float64,1},String,Bool,String,Int64,Int64,Int64,Bool,String,Bool}}, ::typeof(SeisIO.FDSNget!), ::SeisData, ::Array{String,2}) at ./none:0 [6] #get_data#203(::Bool, ::Bool, ::String, ::Int64, ::String, ::Array{Float64,1}, ::Array{Float64,1}, ::Bool, ::Bool, ::String, ::Bool, ::String, ::Bool, ::Int64, ::Int64, ::Bool, ::Bool, ::Int64, ::Bool, ::String, ::Bool, ::typeof(get_data), ::String, ::String) at ~/.julia/dev/SeisIO/src/Wrappers/get_data.jl:82 [7] (::getfield(SeisIO, Symbol("#kw##get_data")))(::NamedTuple{(:s, :t, :src, :v),Tuple{String,Int64,String,Int64}}, ::typeof(get_data), ::String, ::String) at ./none:0 [8] top-level scope at none:0

Best, Kurama

jpjones76 commented 5 years ago

Confirmed! Pushing a fix to master as soon as tests finish.

The cause: buried in the "read" function help text is the statement

Note that not all stream types support the all option.

I used "all=" in my blockette decoders. A file IO stream supports this keyword, so my tests always passed; yet the keyword evidently isn't allowed when reading streaming buffers. I assume that the Julia designers do this to avoid buffer overruns The relevant SEED blockette types rarely show up in my web tests.

Removing "all=false" from the functions in 1_mSEEDblk.jl fixes everything.

jpjones76 commented 5 years ago

Ok, the fix is live and all tests pass. If you run into this issue again please re-open. Thanks!