krischer / instaseis

Instant high-frequency seismograms from an AxiSEM database
http://instaseis.net
Other
49 stars 23 forks source link

Finite source route #20

Closed krischer closed 8 years ago

krischer commented 8 years ago

This PR adds a new route to the server that accepts USGS param files as the contents of a POST request and spits out seismograms.

This turned out to be much more tricky and nasty to implement than expected so it would be great if someone could review it and check if it actually produces the expected output.

Rendered version of the documentation for the new route: http://www.geophysik.uni-muenchen.de/~krischer/instaseis_fs_doc/routes/finite_source.html

Usage from Python for those who want to test it. curl and sac or whatever you fancy should of course also work.

import io
import requests
import obspy

with open("nepal.param", "rb") as fh:
    r = requests.post("http://localhost:8123/finite_source?receiverlatitude=10&"
                      "receiverlongitude=20&format=miniseed", data=fh)

with io.BytesIO(r.content) as fh:
    st = obspy.read(fh)

This is the order of operations performed:

  1. The sliprate of each point source is defined as an asymmetric cosine with a certain rupture, rise, and fall time. We sample it at 10 Hz for a thousand seconds - this limits the maximum rise and fall times. Rise and fall times smaller than one second will be set to one second to make sure it can be accurately sampled.
  2. Each sampled sliprate is zero padded with a number of samples at the beginning and the end (the additional time shift is later accounted for). This is done to avoid running into boundary issues with the following filter.
  3. A fourth order Butterworth filter is applied twice (forwards and backwards) resulting in a zero phase filter. The corner frequency is the dominant frequency of the database. This makes sure we don’t introduce frequencies in the convolution that we cannot propagate in the numerical simulation.
  4. The seismograms for all point sources are calculated, time-shifted, convolved, and stacked.

The origin time is defined as the onset time of the first slipping point source. All relative times and phase relative times refer to it.

A couple of other things:

alexhutko commented 8 years ago

We are ready to add this functionality to syngine whenever it is ready. At first we'll just fetch the USGS FFM and POST it from our handler. Later we will see about allowing users to submit their own models.

krischer commented 8 years ago

It is ready from instaseis' point of view. Fetching the USGS model seems like a very sensible thing to do.

http://instaseis.net/routes/finite_source.html