an example simple tutorial for getting seismic data, computing the power spectral densities, extracting the RMS and plotting
Required:
this should be easy to set up in a conda env: conda create -n covid python=3.7 obspy pandas jupyter notebook
Author: Thomas Lecocq @seismotom, Fred Massin @fmassin
import imp
import seismosocialdistancing
import datetime
import matplotlib.pyplot as plt
import matplotlib.ticker as ticker
import matplotlib.patheffects as pe
import numpy as np
import pandas as pd
from obspy import UTCDateTime
You'll have to make sure the seed_id you request is indeed available from the data_provider
start = UTCDateTime("2020-03-01")
end = UTCDateTime() # () means "now"
network = "CH"
station = "SLOP"#,SZUZ,SGEV,SBERN,SUSI"#,SEPFL,SBAM2" # Urban stations
location = ""
channel = "HGZ,HGE,HGN"
dataset = 'seismoRMSdata/urban-'
data_provider = "ETH"
logo = 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/44/Logo_SED_2014.png/220px-Logo_SED_2014.png'
bans = {"2020-03-13":'Groups >100 banned',
"2020-03-20":'Groups >5 banned'}
This can be done for multiple filters at once (freqs
below):
myPSDs = seismosocialdistancing.PSDs() #reloadme=myPSDs)
# 'user@hostname' import ssh-key before via `ssh-copy-id user@hostname`
myPSDs.clientpqlx(sshuserhost='SQLX',
network=network,
station=station,
location=location,
channel=channel,
start=start,
end=end)
# Define frequency bands of interest:
freqs = [(0.1,1.0),(1.0,20.0),(4.0,14.0),(4.0,20.0)]
myPSDs.dRMS(freqs)
o=myPSDs.plot(mode='*',
band = "4.0-14.0",
bans=bans,
logo=logo)
%autosave 1
import time
time.sleep(2)
%autosave 120
!jupyter nbconvert --to html sqlxSocialDistancing.ipynb
!nbstripout sqlxSocialDistancing.ipynb