I wish to plot seismic waveform data using Obspy, bu they are in Ascii format. Is it possible to read and plot Ascii file using Obspy?
2 Answers
If there is no direct function available, you can create a Trace/Stream object yourself.
The solution I use (example for one time series) is:
- read the Ascii file into a numpy array
- trace = obspy.core.Trace(data=numpy array, header=header dictionnary of your choice)
- stream = obspy.core.Stream(traces=[trace])
- stream.plot()
good question. I don't have much experience withobspyspecifically - nonetheless, I have been unable to locateanyfunctionality to do some kind of TXT to SEGY/SEGD/SEG2 conversion with this particular Python package, which is interesting. I truly doubt obspy is missing this kind of tool. But, in the unlikely and unfortunate case that this mauy be indeed true, I'll list some other (hopefully) viable options for you.
Not all is lost, though. I have done this many times before butNOTwithobspy. I have usedSeismicUnixbefore to do this viaA2Bfunctionality. Also, I have used bothSeisLab(a MATLAB package) andOpendTectto do this. Note that which tool is best is somewhat dependent on what kinda of seismic data you have. For example, if you are looking at a single trace, one software package and/or code may be better suited to solve you problems than if your data are many traces, especially if there are 3-D data.
I foundthisand though it may be of some use to you - I have not tested it. Lastly, I don't remember, but I thinkGeoGIGAmay have a free software that included such functionality as part of its tool set.
Perhaps watchingthiswill help, too.
-
$\begingroup$ Hi, thanks, the problem is now solved, because of directly using sac files. $\endgroup$ Apr 16, 2020 at 2:29