trichter / rf

Receiver function calculation in seismology
MIT License
106 stars 62 forks source link

How to rewrite conf.json in only sacpz file #3

Closed likueimo closed 8 years ago

likueimo commented 8 years ago

Sorry I am new in python and never deal with Station XML format If I do not have any Station XML format Only have sacpz file like this

ZEROS 6
-90.0000  0.0000
-160.7000  0.0000
-3108.0000  0.0000
POLES 7
-0.0385  0.0366
-0.0385  -0.0366
-178.0000  0.0000
-135.0000  160.0000
-135.0000  -160.0000
-671.0000  1154.0000
-671.0000  -1154.0000
CONSTANT 1.480864e+14

Is it possible to use this rf repository ?Or how to rewrite conf.json ? Thank you a lot to develop this useful rf project !

trichter commented 8 years ago

It is not yet documented, but you can use every station file format, that ObsPy can read into an Inventory object. At the moment that are StationXML, Stationtxt (FDSNWS), SeiscompXML, and CSS. SACPZ is not supported. Anyway, you'd need station coordinates in the station file.

One option would be to remove instrument response beforehand with your sacpz file (or leave it out completely). You can then use the rf Python module directly (without batch module and conf.json). You won't need any StationXML file, but just the coordinates of the stations.

Here is a small code example

from obspy import read_events
from obspy.io.sac import attach_paz
from rf import read_rf, rfstats

stream = read_rf()  # use your 3 component data

for tr in stream:
    attach_paz(tr, 'sacpz.txt')  # use your sacpz file
stream.simulate('self')

station = {'latitude': 0, 'longitude': 0, 'elevation': 0}
event = read_events()[0]  # use your event file

stats = rfstats(station=station, event=event, phase='P', dist_range=(30, 90))
for tr in stream:
    tr.stats.update(stats)

stream.filter('bandpass', freqmin=0.05, freqmax=1.)
stream.rf()