jpjones76 / SeisIO.jl

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

Using SeisIO to read metadata file (format of resp) with errors? #89

Open OUCyf opened 2 years ago

OUCyf commented 2 years ago

Hi~ I'm unable to read a metadata file (format of resp) in SeisIO. But it works in ObsPy, so I think the resp.file are not damaged.

With SeisIO in Julia:

julia> versioninfo()
Julia Version 1.6.2
Commit 1b93d53fc4 (2021-07-14 15:36 UTC)
Platform Info:
  OS: macOS (x86_64-apple-darwin18.7.0)
  CPU: Intel(R) Core(TM) i7-1068NG7 CPU @ 2.30GHz
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-11.0.1 (ORCJIT, icelake-client)
Environment:
  JULIA_PKG_SERVER = https://mirrors.ustc.edu.cn/julia

julia> using SeisIO

julia> xml = expanduser("RESP.G1.53275.01.SHZ")
"RESP.G1.53275.01.SHZ"

julia> Resp = read_meta("resp", xml)
ERROR: BoundsError: attempt to access 18-element Vector{Union{Nothing, CoeffResp, GenResp, PZResp, PZResp64}} at index [260]
Stacktrace:
 [1] getindex(A::Vector{Union{Nothing, CoeffResp, GenResp, PZResp, PZResp64}}, i1::Int64)
   @ Base ./array.jl:801
 [2] add_stage!(C::SeisChannel, n::Int64, tfc::UInt8)
   @ SeisIO.SEED ~/.julia/packages/SeisIO/JgSIN/src/Submodules/SEED/seed_resp.jl:60
 [3] read_seed_resp!(S::SeisData, files::Vector{String}, memmap::Bool, units::Bool)
   @ SeisIO.SEED ~/.julia/packages/SeisIO/JgSIN/src/Submodules/SEED/seed_resp.jl:433
 [4] read_meta!(S::SeisData, fmt::String, fpat::String; memmap::Bool, msr::Bool, s::String, t::String, units::Bool, v::Int64)
   @ SeisIO ~/.julia/packages/SeisIO/JgSIN/src/Wrappers/read_meta.jl:54
 [5] read_meta(fmt::String, fpat::String; memmap::Bool, msr::Bool, s::String, t::String, units::Bool, v::Int64)
   @ SeisIO ~/.julia/packages/SeisIO/JgSIN/src/Wrappers/read_meta.jl:83
 [6] read_meta(fmt::String, fpat::String)
   @ SeisIO ~/.julia/packages/SeisIO/JgSIN/src/Wrappers/read_meta.jl:82
 [7] top-level scope
   @ REPL[7]:1

With ObsPy in python:

>>> import obspy
>>> 
>>> st = obspy.read("./G1.53275.01.SHZ.D.2012.087.00.00.00.mseed")
>>> 
>>> tr = st[0]
>>> 
>>> inv = obspy.read_inventory("./RESP.G1.53275.01.SHZ")
>>> 
>>> pre_filt = [0.001, 0.005, 45, 50]
>>> 
>>> tr.remove_response(inventory=inv, pre_filt=pre_filt, output="DISP",
...                    water_level=60, plot=True)  

<obspy.core.trace.Trace object at 0x7f7f29199a90>
>>> 

and get an imagine: WechatIMG341

RESP file here: RESP.G1.53275.01.SHZ.zip

Thanks in advance~