obspy | Python Toolbox for seismology/seismological observatories | Audio Utils library
kandi X-RAY | obspy Summary
kandi X-RAY | obspy Summary
ObsPy is an open-source project dedicated to provide a Python framework for processing seismological data. It provides parsers for common file formats, clients to access data centers and seismological signal processing routines which allow the manipulation of seismological time series (see Beyreuther et al. 2010, Megies et al. 2011, Krischer et al. 2015). The goal of the ObsPy project is to facilitate rapid application development for seismology. ObsPy is licensed under the GNU Lesser General Public License (LGPL) v3.0. A one-hour introduction to ObsPy is available at YouTube.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Return the response for a channel .
- Compute the rotation of an array .
- Parse the name of the leg .
- Call Evalresp for given frequencies .
- Write a MSE file .
- Extract flags from multiple files .
- Read a M seed file .
- Plot a matplotlib matrix .
- Collect data from the seed link .
- Create an EventType subclass .
obspy Key Features
obspy Examples and Code Snippets
s = str (time.split (":")[2]) # second
s = open (stationlist, "r")
from pathlib import Path
from obspy import UTCDateTime
data_dir = Path('/home/alireza/Desktop/Saman/Eqcomplete')
home_d
DF = pd.read_csv(kat, sep=',', usecols=(['YYYY', 'LAT', 'LON', 'DEPTH', 'ML']))
new_data['YYYY'].unique()
new_data[new_data['YYYY'] == 'YYYY']
fig, (ax1, ax2, ax3) = plt.subplots(3, sharex=True)
ax1.plot(time, data1[0].data)
ax2.plot(time, data2.data)
spec = data2.spectrogram(axes=ax3, # <-- Assign a name.
show=True,
samp_rate
# using some random seperator to get the entire row as one column
df = pd.read_csv("coordinates.csv", sep="!", header=None)
df.columns = ['coord']
# added separate columns will blanks for lat and lon (I assumed them to be lat and lon)
df[
def pushButtonClicked(self):
pathfile, _ = QFileDialog.getOpenFileName(self)
if pathfile:
fname = basename(pathfile)
data = read(fname)
data.plot(fig=self.fig)
import glob, os
def save_fig(in_file_name, out_file_name):
line_1 = _read_segy(in_file_name)
data = np.stack(t.data for t in line_1.traces)
vm = np.percentile(data, 99)
plt.figure(figsize=(60, 30))
plt.imshow(data.T, cm
files = ['st1.segy', 'st2.segy']
lines = {} # creates an empty dictionary; dictionaries consist of key: value pairs
for f in files: # f will first be 'st1.segy', then 'st2.segy'
lines[f] = read_segy(f)
lines =
for i in range(len(di)):
try:
tt.append((latot[i],lotot[i],traveltime(dia[i])-traveltime(dib[i])))
except IndexError:
continue
/* This over-allocates proportional to the list size, making ro
a = float(columna[0])
b = float(columna[1])
c = float(columna[2])
d = float(columna[3])
e = float(columna[4])
For example:
port select --summary
port select --show python
port select --list python
port select --set python python34
port select --summary
sud
Community Discussions
Trending Discussions on obspy
QUESTION
maybe it will be a very basic question for the experts but I am just a beginner. I have multiple time series signals from different distances. I plotted all time series data with the help of the plt.plot command as given in the below script.
...ANSWER
Answered 2022-Feb-21 at 07:58Do not worry about being a beginner, good that you ask questions. It will help others in similar situation as you.
Regarding your question, it would be really helpful with a minimum working example so that we can investigate our selves. Which version of matplotlib are you running (matplotlib.__version__
)? What shapes do xarray
, yarray
, and zarray
have?
I can reproduce your error with a modified example from the matplotlib docs gallery (here https://matplotlib.org/stable/gallery/images_contours_and_fields/pcolormesh_levels.html). If I run
QUESTION
I am trying to read a text file line by line as integers. I did every suggestion I saw here but none works for me. here is the code I'm using. It reads some seismic data from the datadir and evaluates the SNR ratio to decide whether keep the data or remove it. To do so, I need to calculate the distance between stations and the earthquake which the info comes from input files.
...ANSWER
Answered 2021-Oct-18 at 02:56You define s
here:
QUESTION
I have a set of bulletins in txt format, those have some chunky (big header, tails, etc) data that I was able "to clean up" them using pandas. Then I had to append all DataFrames in a new one DataFrame in order to have a new file, because I need to process about 10 year of data, so the code is:
...ANSWER
Answered 2021-Aug-05 at 21:46Your code works well with your two files 1988.txt
et 1989.txt
.
To debug, I propose to remove the cast from read_csv
:
QUESTION
I have a question about setting the order of zero-phase bandpass filter in obspy.
I want to apply a 2nd order zero-phase filter, with corner frequencies of 0.05Hz and 0.1Hz.
I think it's right to type 'st.filter('bandpass', freqmin=0.05, freqmax=0.1, corners=2, zerophase=True)'.
However, I am a little bit confused since it is written that setting 'zerophase=True' results in twice the filter order according to the link below.
https://docs.obspy.org/_modules/obspy/signal/filter.html
So I want to ask if it is correct to set 'corners=2' or 'corners=1' or etc in my case.
It will be a great help to me if anyone gives an answer.
Thank you.
...ANSWER
Answered 2021-May-20 at 03:17You should specify corners = 1
.
The way a zero-phase filter is implemented is to run the data through the filter twice, once forwards and once backwards. This results in double the magnitude response but cancels out the phase response. Therefore, if you expect 12 dB/octave attenuation in the stopbands, as in a normal 2nd-order filter, then specify corners = 1
. This will result in 6 dB/octave attenuation on the forward pass, then another 6 dB/octave on the backwards pass.
QUESTION
I have a folder with seismogram files. Its format correspont to particle movement in three dimensions (HHE correponds to E-W, HHN correponds to N-S and HHZ corrsponds to vertical particle movement). The script to merge these three components in a file is the following:
...ANSWER
Answered 2020-Aug-06 at 17:03import os
path_folder = r"D:\test"
# get list of all files in folder which end on .sac
lst_of_filenames = [name for name in os.listdir(path_folder) if (name.endswith(".sac")]
# only get a unqiue filename without any ending
# r"" means raw string
lst_of_filenames_cleaned = [name.rstrip(r".HHE.sac").rstrip(r".HHN.sac").rstrip(r".HHZ.sac") for name in lst_of_filenames]
# get each filename only once (remove duplicates)
lst_of_filenames_cleaned = list(set(lst_of_filenames_cleaned))
QUESTION
I am going to display a figure graph using Python's GUI. GUI code and general code are applied differently (x-axis). I haven't put any options specifically in the plot, but the cause is unknown. Using obspy module, it is simple code to load mseed file which is earthquake data format and display graph. So far, in order to put the x-axis as the datetime, I tried using the 'arange' function and the 'for in' function to put it in the plot, but the GUI program does not run normally and ends. The problem is that the plot is normally plotted, but the x-axis is displayed as the sample rate of the data, not time.
The full code looks like this:
...ANSWER
Answered 2020-Apr-01 at 07:48Instead of creating a new ax it is necessary to just pass the Figure to the plot method:
QUESTION
I am using Obspy _read_segy
function to read a segy file using following line of code:
ANSWER
Answered 2020-Mar-05 at 11:37I'll focus on addressing the file looping, as you said you're new and I'm assuming simple loops are something you'd like to learn about (the first example is sufficient for this).
If you'd like an answer to your second question, it might be worth providing some example data, the output result (graph) of your current attempt, and a description of your desired output. If you provide that reproducible example and clear description of the problem you're having it'd be easier to answer.
Create a list (or other iterable) to hold the file names to read, and another container (maybe a dict
) to hold the result of your read_segy
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install obspy
Read about how to get started in the wiki and in our Tutorial section in the documentation. ObsPy Tutorial notebooks -- and much more on specific seismology topics -- can also be found on Seismo-Live, both as a static preview and as interactively runnable version.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page