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?
good question. I don't have much experience with obspy specifically - nonetheless, I have been unable to locate any functionality 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 but NOT with obspy. I have used SeismicUnix before to do this via A2B functionality. Also, I have used both SeisLab (a MATLAB package) and OpendTect to 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 found this and though it may be of some use to you - I have not tested it. Lastly, I don't remember, but I think GeoGIGA may have a free software that included such functionality as part of its tool set.
Perhaps watching this will help, too.
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])