Some issue with removing the instrument response using "simulate"

Hello there,

I am trying to remove the instrument response from a waveform I have retrieved using obspy.arclink.client.
I use the code given below. However, when it reaches the command “wav.simulate (paz_remove=paz,paz_simulate=None)” it gives back an error.
For some reason the key ‘poles’ from the “paz” dictionary was not recognized. I put the error below.
It would be great if you kindly can help me and give me your thoughts in this regard.

Cheers,
Sep

Error:

{‘SABA.2006.303.HZ’: AttribDict({‘poles’: [(-0.037+0.037j), (-0.037-0.037j), (-13300+0j), (-10530+10050j), (-10530-10050j), (-520.3+0j), (-374.8+0j), (-97.34-400.7j), (-97.34+400.7j), (-15.64+0j), (-255.1+0j)], ‘sensitivity’: 629145000.0, ‘zeros’: [(-463.1+430.5j), (-463.1-430.5j), (-176.6+0j), (-15.15+0j), 0j, 0j], ‘name’: ‘SABA.2006.303.HZ’, ‘gain’: 3.46844e+17})}
Traceback (most recent call last):
File “./sleeman2.py”, line 37, in
wav.simulate (paz_remove=paz,paz_simulate=None)
File “/usr/local/lib/python2.7/site-packages/obspy.core-0.7.1-py2.7.egg/obspy/core/stream.py”, line 1702, in simulate
simulate_sensitivity=simulate_sensitivity, **kwargs)
File “/usr/local/lib/python2.7/site-packages/obspy.core-0.7.1-py2.7.egg/obspy/core/trace.py”, line 1186, in simulate
simulate_sensitivity=simulate_sensitivity, **kwargs)
File “/usr/local/lib/python2.7/site-packages/obspy.signal-0.7.0-py2.7-linux-x86_64.egg/obspy/signal/invsim.py”, line 422, in seisSim
raise KeyError(“Missing key: %s” % key)
KeyError: ‘Missing key: poles’

Code:

#!/usr/bin/env python
import obspy.signal
import os
import matplotlib.pyplot as plt
from obspy.core import read
from obspy.core import UTCDateTime
from obspy.arclink.client import Client
from obspy.xseed import Parser

client=Client(“webdc.eu”, 18001, user=’’) t0 = UTCDateTime (“2012-09-08 20:30:00”) wav = client.getWaveform (‘NA’, ‘SABA’, ‘’, ‘BHZ’, t0 - 900, t0 + 900) paz = client.getPAZ (‘NA’, ‘SABA’, ‘’, ‘BHZ’, t0 - 900, t0 + 900 ) wav.simulate (paz_remove=paz,paz_simulate=None) wav.plot()

Dear Sepideh,

the syntax of obspy.arclink.client.Client.getPAZ() method has been
changed a while ago to retrieve a single PAZ at a given single
timestamp instead of a time span.

See also:
http://docs.obspy.org/packages/autogen/obspy.arclink.client.Client.getPAZ.html#obspy.arclink.client.Client.getPAZ

So if you change line 13 in your code to:

paz = client.getPAZ('NA', 'SABA', '', 'BHZ', t0)

everything works fine.

Keep in mind it's your responsibility to check if there are any PAZ
changes during the requested time span of the waveform where you are
going to remove the instrument response.

Cheers,
Robert

Hello there,

I am trying to remove the instrument response from a waveform I
have retrieved using obspy.arclink.client. I use the code given
below. However, when it reaches the command "wav.simulate
(paz_remove=paz,paz_simulate=None)" it gives back an error. For
some reason the key'_poles_' from the "_paz_" dictionary was not
recognized. I put the error below. It would be great if you kindly
can help me and give me your thoughts in this regard.

Cheers, Sep

Error:

{'SABA.2006.303.HZ': AttribDict({'poles': [(-0.037+0.037j),
(-0.037-0.037j), (-13300+0j), (-10530+10050j), (-10530-10050j),
(-520.3+0j), (-374.8+0j), (-97.34-400.7j), (-97.34+400.7j),
(-15.64+0j), (-255.1+0j)], 'sensitivity': 629145000.0, 'zeros':
[(-463.1+430.5j), (-463.1-430.5j), (-176.6+0j), (-15.15+0j), 0j,
0j], 'name': 'SABA.2006.303.HZ', 'gain': 3.46844e+17})} Traceback
(most recent call last): File "./sleeman2.py", line 37, in
<module> wav.simulate (paz_remove=paz,paz_simulate=None) File
"/usr/local/lib/python2.7/site-packages/obspy.core-0.7.1-py2.7.egg/obspy/core/stream.py",

line 1702, in simulate

simulate_sensitivity=simulate_sensitivity, **kwargs) File
"/usr/local/lib/python2.7/site-packages/obspy.core-0.7.1-py2.7.egg/obspy/core/trace.py",

line 1186, in simulate

simulate_sensitivity=simulate_sensitivity, **kwargs) File
"/usr/local/lib/python2.7/site-packages/obspy.signal-0.7.0-py2.7-linux-x86_64.egg/obspy/signal/invsim.py",

line 422, in seisSim

raise KeyError("Missing key: %s" % key) KeyError: 'Missing key:
poles'

Code:

#!/usr/bin/env python import obspy.signal import os import
matplotlib.pyplot as plt from obspy.core import read from
obspy.core import UTCDateTime from obspy.arclink.client import
Client from obspy.xseed import Parser

client=Client("webdc.eu", 18001, user='test@obspy.org') t0 =
UTCDateTime ("2012-09-08 20:30:00") wav = client.getWaveform ('NA',
'SABA', '', 'BHZ', t0 - 900, t0 + 900) paz = client.getPAZ ('NA',
'SABA', '', 'BHZ', t0 - 900, t0 + 900 ) wav.simulate
(paz_remove=paz,paz_simulate=None) wav.plot()

_______________________________________________ obspy-users mailing
list obspy-users@lists.sevor.de
ObsPy Forum

- --
Dr. Robert Barsch

EGU Office Munich
Luisenstr. 37
80333 Munich
Germany

Phone: +49-89-21806549
Fax: +49-89-218017855
eMail: barsch@egu.eu

Dear Robert,
thanks very much for the great help. I changed it and it worked!
Cheers,
Sep