Weather Software > Station Software Development

Earthquake and local seismic data


Here is an example of my local seismic data.
 [ You are not allowed to view attachments ]

It represents the last 3 hours data from my local seismograph station and also the last important event.

If, like me, you are in a seismic zone and are interested, here is how to obtain it.

Go to this site:

Find the station closest to you that is active and note the archive and station code. Apologies, this is a European site - there will be an equivalent for the USA.

To get the data and process it you will need python and specifically a python library called obspy -

You will also need matplotlib and numpy.

Here is the python code to produce the last 3 hours seismic data:

import matplotlib
from obspy.clients.fdsn import Client
from datetime import datetime
from obspy import UTCDateTime
from pytz import timezone
zonename = "UTC"
now =

#this is the archive name
client = Client("INGV")
#the first and second part of the station identifier
net = "IV"
station = "PLMA"

t = UTCDateTime(now)

#this returns all the available data for the last 3 hours
st = client.get_waveforms(net, station, "*", "*", t - 3*60*60, t)

#and saves it graphically
st.plot(color = 'red', outfile='seismic.png')
To get the data for a specific event you just need to change t.

Read the obspy documentation for more options.

Great, thank you!

to install matplotlib in debian distribution and python3

--- Code: ---sudo apt-get install python3-matplotlib
--- End code ---
then numpy

--- Code: ---pip3 install numpy
--- End code ---
and finally ObsPy

--- Code: ---pip3 install obspy
--- End code ---
Then I got an error since my numpy version was too old 1.13.3 so

--- Code: ---pip3 install numpy --upgrade
--- End code ---
Then I got another error since there was no data for the station chosen

--- Code: ---obspy.clients.fdsn.header.FDSNNoDataException: No data available for request.
--- End code ---
I changed station and got my quake
 [ You are not allowed to view attachments ]
this one
2021-05-21 18:04:15UTC    Mwp 7.0    Qinghai, China [Land: China]

Well done! And thanks for giving the detail for the matplotlib and numpy installation - I should have included it in my post.

For installation I simply searched on search engines and I learned that pip doesn't upgrade libraries, the same for apt.
Forgot to tell that all commands must be preceded by sudo if you are not working as root, the Administrator account in Unix/Linux.


[0] Message Index

Go to full version