Hi

Glad to hear my code is useful. While using the seisplotjs-waveformplot directly as you have is likely the easiest, you may wish to use seisplotjs, which is a umbrella project that pulls in seisplotjs-waveformplot plus lots of other useful things and so would be easier if you want to do more advanced things like filtering within your own javascript code.
 
https://github.com/crotwell/seisplotjs

Also included in this (and available separately) is seisplotjs-filter for basic waveform filtering, and seisplotjs-traveltime that queries the IRIS traveltime web service (which internally uses my java travel time calculator, TauP) as well as seisplotjs-distaz which will do the spherical distance calculations without a web call and seisplotjs-fdsnevent that queries a web service for event parameters. There are others as well, so anything in my github that starts with "seisplotjs-" is (or will be) part of this. Here are a bunch of links for your clicking pleasure...

https://github.com/crotwell/seisplotjs-filter
https://github.com/crotwell/seisplotjs-traveltime
https://github.com/crotwell/seisplotjs-distaz
https://github.com/crotwell/seisplotjs-fdsnevent

Also some of the examples that may be useful are here. This should be the same as the corresponding github code, just with the dependencies and so runnable:
http://www.seis.sc.edu/~crotwell/seisplotjs_demo

All free for reuse, but under active development so expect missing documentation, wrong examples and probably lots of changes as I improve it, :) but I hope it will be useful. The goal is to eventually be able to do basic seismic data processing in the browser without relying on any server-side coding.

Comments welcome.

thanks
Philip


On Monday, September 4, 2017 at 5:26:43 PM UTC-4, Gerard wrote:
Hi all

There have been various conversations about publishing raspberry shake output on personal web pages.  There have been some really good suggestions about the use of the obspy python software.  This is obviously a powerful toolkit which I think is especially useful if your web page is being hosted locally.  I thought I would share another approach which I have been working on.

I should acknowledge up front, that my approach has been largely inspired by the fantastic Android EQInfo App.  I bought cheap Android tablet specifically so I could use this application.  It is well designed and has some great features.  I live in a geologically quiet location (Brisbane Australia ).  So the most likely seismic activity I can pick up, above background noise, is related to large overseas quakes.  For that reason there is not much point displaying a continuous feed. It is most interesting to look at when it has picked up a large OS quake.

You can view my site at: http://greenbridge.net.au/quakes.php.  It is part of a small site which publishes weather information recorded at home.

As you can see it is built in PHP.  The quakes page has two panels.  The left panel lists quakes recorded in the last 60 days which, based on their location and magnitude, are likely to have being picked up by my Raspberry Shake.  This is using the US Geological Survey FDSN restful web services feed. I am using CURL to fetch all recent recordings worldwide with a magnitude > 5.  I am storing this in a mysql db and using a mysql query with appropriate filters to select the quakes that I think may show up at home.

The right panel uses the raspberry shake FDSN web service to fetch the recording from the raspberryshake FDSN server.  (For details see http://manual.raspberryshake.org/traces.html#tools4programmers). 

To fetch and display the seismic record I am using the javascript library published on github by Philip Crotwell. (I was quite delighted when I found this library, even more delighted when I got it to work).  https://github.com/crotwell/seisplotjs-waveformplot.  (Might be useful to add this to the tools4programmers section of the user guide)

To keep things simple, I have used a bit of a shortcut to calculate the time of arrival.  (apologies to professionals who may consider my approach a bit of a hack).

I used a commonly available table which sets angular distance against time of arrival for the P wave.  I then used Excel to get a best fit equation for the curve (I used a third order polynomial which had a R^2 value of 0.9997).

To fetch the correct time window I first calculate the angular distance between the earthquake location and my location.  I then use the equation to calculate the expected time of arrival.  I add a 60 second offset and display a 10 minute window. (So there is no theoretical foundation to the equation - but it is easier then doing a lookup which seems to be what other sites work on). 

To illustrate how easy it is to use the JS library.  The following snippet is dyamically added to the page when a quake is selected (and then the JS called):

<div class='myseisplot' net='AM' sta='R9A9D' loc='00' chan='SHZ' duration='600'  host='fdsnws.raspberryshakedata.com'  start='$start'></div>

(where $start is the start date / time for the plot)

There is obviously a lot of things that could be done with this site.  I would love to be able to apply a frequency filter to the output, but haven't had a chance to investigate options for doing this.  My site is hosted by an ISP that supports PHP, but I don't think they support python.  Hence one of the drivers for taking the approach I have. I think the way I call the JS function is a bit clumsy and could be a lot more elegant.

My code is a bit rough, but I am happy to share any of it if anybody is interested.  Thanks again to the Raspberry Shake team at OSOP and gempa GmbH.  Thanks also to Philip Crotwell for publishing his JS library and making it available for use.

Gerard