Instrument correction (instrument response in dataless file)

Hi,

I am quite new to ObsPy, and I am trying to process a miniseed file by applying instrument correction included in a separate seedless file.
The result I am getting does not look quite right, the time history has a strong baseline deviation which the raw signal did not have; I am not sure if I need to define any more input for the function simulate to work or do any additional processing?

I have done the check just on a single trace of the stream. If I want to extend this to the whole stream, do I just apply st.simulate to the stream and call the relevant dataless file for the other stations sotred in the same miniseed, does the routine understand which instrument correction to apply for each channel?

Many thanks for any help you can give me.

Those are the code lines I am using:

import obspy
from obspy import read
from obspy.io.xseed import Parser

st=read("bdsAutodrm-rU8TsD") # contains the input miniseed file
print(st)
tr7= st[6] # assign trace to new variable

tr7.write('2021-12-27-WOL00-BH1-SH_ASC.asc', format='SH_ASC') # extracting one trace from the stream

parser = Parser("202112270145-0245WOL.dataless")
print(parser)

tr7.simulate(seedresp={'filename': parser, 'units': "ACC"}) #Apply instrument response to trace
tr7.write('2021-12-27-WOL00-BH1-SH_ASC_cor.asc', format='SH_ASC') #saves corrected waveform

You should switch to using read_inventory() and just provide that Inventory object to instrument response removal. Also in general you want to use Stream/Trace.remove_response() if you want to go to physical units. simulate is to simulate your data as recorded by another instrument, different from the one used in the original recording (e.g. simulate a Wood Anderson legacy instrument, etc etc), thats likely not what you want.

If you think something is fishy, please plot your data before and after processing, you can directly attach images here, otherwise people wont be able to comment much without more info.

Hi, many thanks for your reply.
I modified the script reading the seedless file as an inventory object and using the trace.remove_response, but I am getting a warning:

C:\Users\davim\Miniconda3\envs\obspy\lib\site-packages\obspy\io\xseed\parser.py:1271: UserWarning: Epoch BN.BKN…BHZ [2008-04-05T00:00:00.000000Z - 2099-01-01T00:00:00.000000Z]: Channel has multiple (but identical) blockettes 58 for stage 0. Only one will be used.

and an error :
ObsPyException: Can not use evalresp on response with no response stages.

Here is the script:
from obspy import read
from obspy.core.inventory import read_inventory

st=read(“bdsAutodrm-rU8TsD”)
print(st)
tr1= st[0] # assign trace to new variable
tr1.plot()
inv=read_inventory(path_or_file_object=“202112270145-0245BKN.dataless”, format=“seed”, level=‘response’)

tr1_cor=tr1.remove_response(inventory=inv, output=“ACC”)
tr1_cor.plot()

Maybe there’s something wrong with the metadata? I would try to get the metadata again from the people running the experiment, if you know a contact…

Ok, thanks, so you can confirm the script is right