<p>If there is no direct function available, you can create a Trace/Stream object yourself.</p>

<p>The solution I use (example for one time series) is:</p>

<ul>
<li>read the Ascii file into a numpy array</li>
<li>trace = obspy.core.Trace(data=<em>numpy array</em>, header=<em>header dictionnary of your choice</em>)</li>
<li>stream = obspy.core.Stream(traces=[trace])</li>
<li>stream.plot()</li>
</ul>

CC BY-SA 4.0
2020-04-16T02:30:37.067Z
Thanks for your suggestion.
Atikul Haque Farazi
CC BY-SA 4.0
2019-11-20T14:44:31.597Z
2019-11-20T14:44:31.597Z
Navid
<p>good question. I don't have much experience with <a href="https://github.com/obspy/obspy/wiki" rel="nofollow noreferrer">obspy</a> specifically - nonetheless, I have been unable to locate <em>any</em> 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.</p>

<p>Not all is lost, though. I have done this many times before but <em>NOT</em> with <strong>obspy</strong>. I have used <a href="https://en.wikipedia.org/wiki/Seismic_Unix" rel="nofollow noreferrer">SeismicUnix</a> before to do this via <a href="http://web.mit.edu/cwpsu_v44r1/sumanual_600dpi_letter.pdf" rel="nofollow noreferrer">A2B</a> functionality. Also, I have used both <a href="https://www.mathworks.com/matlabcentral/fileexchange/53109-seislab-3-02" rel="nofollow noreferrer">SeisLab</a> (a MATLAB package) and <a href="https://dgbes.com/" rel="nofollow noreferrer">OpendTect</a> 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.</p>

<p>I found <a href="https://github.com/wassname/ascii2segy" rel="nofollow noreferrer">this</a> and though it may be of some use to you - I have not tested it. Lastly, I don't remember, but I think <a href="http://www.geogiga.com/en/frontendexpress.php" rel="nofollow noreferrer">GeoGIGA</a> may have a free software that included such functionality as part of its tool set.</p>

<p>Perhaps watching <a href="https://www.youtube.com/watch?v=kFwdjfiK4gk" rel="nofollow noreferrer">this</a> will help, too.</p>

CC BY-SA 4.0
2020-04-16T02:29:33.383Z
Hi, thanks, the problem is now solved, because of directly using sac files.
Atikul Haque Farazi
CC BY-SA 4.0
2019-11-03T16:49:21.410Z
2019-11-03T16:49:21.410Z
nate
<p>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?</p>

<seismology><python>
How to read and plot seismic waveform data in Ascii format using Obspy?
Atikul Haque Farazi
# How to read and plot seismic waveform data in Ascii format using Obspy?

(Asked by: username_0 on 2019-11-02)

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?

**Tags:** seismology, python


---

## 2 answers

### Answer by username_1 on 2019-11-20. Score: 1

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()

> **Comments:**
> **username_0**: Thanks for your suggestion.  

---

### Answer by username_2 on 2019-11-03. Score: 0

good question. I don't have much experience with [obspy](https://github.com/obspy/obspy/wiki) 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](https://en.wikipedia.org/wiki/Seismic_Unix) before to do this via [A2B](http://web.mit.edu/cwpsu_v44r1/sumanual_600dpi_letter.pdf) functionality. Also, I have used both [SeisLab](https://www.mathworks.com/matlabcentral/fileexchange/53109-seislab-3-02) (a MATLAB package) and [OpendTect](https://dgbes.com/) 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](https://github.com/wassname/ascii2segy) and though it may be of some use to you - I have not tested it. Lastly, I don't remember, but I think [GeoGIGA](http://www.geogiga.com/en/frontendexpress.php) may have a free software that included such functionality as part of its tool set.

Perhaps watching [this](https://www.youtube.com/watch?v=kFwdjfiK4gk) will help, too.

> **Comments:**
> **username_0**: Hi, thanks, the problem is now solved, because of directly using sac files.  

---

