Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • 10:09
    claudiodsf labeled #2778
  • 10:09
    claudiodsf opened #2778
  • Jan 19 00:27
    nukenine edited #2777
  • Jan 19 00:26
    nukenine opened #2777
  • Jan 16 06:33
    cicyby starred obspy/obspy
  • Jan 15 22:24
    scottstanie starred obspy/obspy
  • Jan 13 04:41
  • Jan 13 00:03
    dsentinel commented #2761
  • Jan 11 21:08
    chad-iris edited #2776
  • Jan 11 21:06
    chad-iris commented #2761
  • Jan 11 20:32
    chad-iris commented #2761
  • Jan 11 17:18
    dsentinel commented #2761
  • Jan 11 13:15
  • Jan 11 13:15
    limitswen starred obspy/obspy
  • Jan 11 01:53
    chad-iris commented #2761
  • Jan 11 01:10
    chad-iris opened #2776
  • Jan 10 09:43
    malikos180 commented #2767
  • Jan 08 15:46
    lsawade starred obspy/obspy
  • Jan 08 00:04
    JakovGlavac starred obspy/obspy
  • Jan 06 03:18
    lynlyf opened #2775
geophysics91
@geophysics91
However i have a problem on slicing the UTCDateTime, i just want to convert tr.stats.starttime i.e. RT.RET.00.BHE2018-01-01T01:00:00.005000Z to RT.RET.00.BHE20180101T010000Z .while slicing it gives error like UTCDateTime object is not subscriptable.My files are in miniseed format. can anybody suggest a solutions for the same ??
Calum Chamberlain
@calum-chamberlain
I'm not really sure what you are asking @geophysics91 - it looks like you want to format a UTCDateTime as a string? If so, look at the UTCDateTime.strftime method. Like most things in Obspy, UTCDateTime has pretty handy docs that you should read
Kevin2020US
@Kevin2020US
I am doing modeling work. I am wondering if ObsPy can generate both first arrival traveltimes and synthetic seismograms based on a velocity model?
I am pretty new for ObsPy. Thanks.
Chet Hopp
@cjhopp

Hi @Kevin2020US , for travel times, check out the port of TauP here: https://docs.obspy.org/packages/obspy.taup.html

I have no experience using this, but you can query the IRIS Syngine database like detailed here: https://docs.obspy.org/packages/obspy.clients.syngine.html

I believe both of these are limited to various 1D reference models, so for 3D models you may have to look elsewhere. Hope those prove helpful!

Also, usage questions like this are moving to https://discourse.obspy.org/, where you can search for previously-answered questions (or feel free to ask one yourself). That way, others can find the answers down the road.

Kevin2020US
@Kevin2020US
Thanks @cjhopp. I will check it out.
filefolder
@filefolder
hi, does anyone have an opinion on which machine learning python package would be best to learn/adopt with obspy/general seismic processing? the obspy docs reference MLPY with CWT stuff but it hasn't been maintained since 2012 (along with the usual resulting install errors / dependency issues)
Tobias Megies
@megies
i personally dont do ML but i htink scikit learn is pretty popular
filefolder
@filefolder
thanks, yeah thats what im leaning towards, seems best integrated with sci/np but was wondering if obspy development may be leaning towards one or another in the future, particularly re: CWT e.g. https://docs.obspy.org/tutorial/code_snippets/continuous_wavelet_transform.html
Tobias Megies
@megies
that was really just somebody wanting a CWT done and we thought it might a nice thing to show in the code snippets. mlpy likely is dead like you already stated

if obspy development may be leaning towards one or another in the future

i dont think you have to worry about that, obspy might get used in ML applications, but i dont see it happening the other way around

Carlos Alberto Ospina Caicedo
@cospina1_gitlab

Im also trying to generate a script exe with PyInstaller, there was an answer to @yhtang1974?

I packaged a python script to exe with Pyinstaller, this script use obspy trace to write a SAC file, and can normally run in Pycharm ,but the exe file throws the following error...

sanjay kumar
@kpsanjay
I tried to run the example to generate the fault plane solution using obspy- isola. while executing the code class_isola.py , i found the syntax error. base) sanjay@SanjayNCS:~/misola/1_Efpalio_SAC_orig$ src/invert.py
Traceback (most recent call last):
File "src/invert.py", line 3, in <module>
from class_isola import
File "/home/sanjay/misola/1_Efpalio_SAC_orig/src/class_isola.py", line 31, in <module>
import obspy
ImportError: No module named obspy
(base) sanjay@SanjayNCS:~/misola/1_Efpalio_SAC_orig$ source activate obspy
(obspy) sanjay@SanjayNCS:~/misola/1_Efpalio_SAC_orig$ src/invert.py
Traceback (most recent call last):
File "src/invert.py", line 3, in <module>
from class_isola import

File "/home/sanjay/misola/1_Efpalio_SAC_orig/src/class_isola.py", line 64
return dict(map(lambda (key, value): (prefix+str(key)+suffix, value), somedict.items()))
^
Thomas Lecocq
@ThomasLecocq
This message was deleted
please provide the full traceback of the error , only for the (obspy) environment (of course it doesn't work when obspy is not installed)
AFAIK (as far as I know) ISOLA-Obspy is a package that uses obspy and the documentaiton hasn't been updated since 2016, so not sure if it is still under development. You should contact the author directly maybe
geophysics91
@geophysics91
hii experts, i want to cut all given waveforms of a directory to 9001 data points randomly..how can i do it.can anybody suggest a looping script for the same .original wave have the .npts 360000
Thomas Lecocq
@ThomasLecocq
I don't understand what you mean
geophysics91
@geophysics91
sir i have the original seismic waveform having the tr.stats.npts = 360000 which is of 1 hour length. Now i want to cut the waveforms randomly in such a way that tr.stats.npts would be 9001...same thing i want to do for many waveforms
Thomas Lecocq
@ThomasLecocq
sorry, you want random 90 seconds of data from a 100 Hz waveform, right ?
geophysics91
@geophysics91
yes
Thomas Lecocq
@ThomasLecocq
assuming your data is continuous, you could:
  • generate a random number between 0 and 3510
  • copy & trim the stream to st.stats.starttime + randomnumber, st.stats.starttime + randomnumber + 90
geophysics91
@geophysics91
thanks sir..i will try and let u know.
geophysics91
@geophysics91

@ThomasLecocq i wrote few lines of code it shows error like AttributeError: 'str' object has no attribute 'copy' plus i want to save each sliced traces in the sac format or text file...i donot know where i am doing wrong. my code is attached below: `import glob
from obspy import read
from numpy import random

x = random.randint(50)

files=glob.glob("/home/geo/test_data/*.sac")

trace_lenght = 90

for trace in files:
tr=trace.copy()
print(tr)
start = tr.stats.starttime + x
stop = tr.stats.starttime+x+trace_length
tr1=tr.slice(start,stop)
tr1.write('files'+str(stop),format='SAC')
`

Thomas Lecocq
@ThomasLecocq
you have to read the file first into a Stream object
geophysics91
@geophysics91
I want to export a seismogram in ascii file.Thus i used 'TSPAIR' that saves time series in time and amplitude column. If i want time column to be represent in round(seconds) only(donot need that much long 2018-01-01T00:25:57.045000),how should i do.
Thomas Lecocq
@ThomasLecocq
list(tr.times()) give you the timing of the samples in seconds
geophysics91
@geophysics91
@ThomasLecocq then how to set list(tr.times()) in tr.write('test_data.ascii,format='TSPAIR') so that i will get timing of the samples and amplitude in test_data.ascii....can u please suggest
Thomas Lecocq
@ThomasLecocq
you'll have to do it manually
geophysics91
@geophysics91
@ThomasLecocq can you please suggest how to do it..
sion kumar
@sionkumar_gitlab
Hii friends...i am trying to do slicing of a continuous data of 1 hour length. where slicing length is 20 seconds. That means i need 180 nos of sliced length to produce and wanna save it . Are there any readymade script to do it in obspy.
Thomas Lecocq
@ThomasLecocq
@geophysics91 please try yourself. You have to create a 2 lists, one with data, one with time and save to file.
@sionkumar_gitlab the documentation of the slice method should be quite helpful in that case
geophysics91
@geophysics91
Thanks @ThomasLecocq. you are great!!!
sion kumar
@sionkumar_gitlab

@ThomasLecocq I wrote a small code after following the manual of obspy for slicing.But my code only slice first 20 seconds of the given trace, but i need to slice whole 1 hr length continuous trace by shifting 20 seconds....can you please suggest whats wrong with my code ....my code is here `
from obspy import read

for wav in list:
st = read(wav)
tr=st.copy()
tr1=tr[0]
start = tr1.stats.starttime
stop = tr1.stats.starttime+20
tr2 = tr1.slice(start,stop)
print(tr2)
tr2.write('sample_data.SAC',format='SAC')`

Thomas Lecocq
@ThomasLecocq

this is not an obspy problem, it's a logic one...

start = whatever_value
stop = start + 3600

will give you an hour of data (if there is enough data in the stream)

sion kumar
@sionkumar_gitlab
@ThomasLecocq 1 hour data i already have ...need to slice that 1 hr data by shifting 20 sec...then 20 sec etc
Thomas Lecocq
@ThomasLecocq
check the documentation for Stream.slide()
sion kumar
@sionkumar_gitlab
@ThomasLecocq simply i just need to cut the trace first 20 seconds then 20 seconds ....so on up to completing the 1hr continuous file(180 no of 20 secs traces should produce)
sion kumar
@sionkumar_gitlab
@ThomasLecocq solved my pblm by adopting Stream.slide()...Thanks
Tom Eulenfeld
@trichter
Hi devs, could anybody have a look at the following PR: obspy/obspy#2708. I think it could fix the failing tests on the master branch.
Tobias Megies
@megies
done
Kay089
@Kay089
Hi! I'm trying to create a dayplot from a miniseed. In doing so, I get the following value error, "Too few samples to use dayplot with the given arguments. Adjust your arguments or use a different plotting method." Does anyone know the minimum number of samples required for dayplot? Thanks in advance!
Tobias Megies
@megies
how many samples you have in your data? try to read the file and print the stream and check samples :)
Thomas Lecocq
@ThomasLecocq
looks like it was close to 0 samples :)
Kay089
@Kay089
Thanks for the reply:) It was close to 2000 samples, 1 sample per minute.
Calum Chamberlain
@calum-chamberlain

@Kay089 it looks like this error is raised by this line which suggests that you should reduce the width of your dayplot to get around this.

1 sample-per minite is quite a low sampling-rate, so I doubt this plotting routine is designed with this in mind, hence the slightly opaque error message. Try passing the argument st.plot(..., size=(200, 600)) - in the size argument, width is the first part of the tuple. The default is 600, so reduce this until you get a plot!

Kay089
@Kay089
@calum-chamberlain It works! Thank you so much!!
Calum Chamberlain
@calum-chamberlain
No worries - always a good idea to check out the source code if you run into unexpected errors!
Tobias Megies
@megies