# convert SEGY file to SEG2

**URL:** <https://discourse.obspy.org/t/convert-segy-file-to-seg2/487>\
**Category:** Users Mailing List Archive\
**Tags:** archive\
**Created:** [January 5, 2016, 12:21am UTC](https://discourse.obspy.org/t/convert-segy-file-to-seg2/487 "2016-01-05T00:21:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Goldman\_Mark\_R](https://discourse.obspy.org/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@Goldman\_Mark\_R](https://discourse.obspy.org/u/Goldman_Mark_R)\
**Post date:** [January 5, 2016, 12:21am UTC](https://discourse.obspy.org/t/convert-segy-file-to-seg2/487/1 "2016-01-05T00:21:25Z")

</div>

Is it possible in Obspy to convert a SEGY file to a SEG2 file?  
I see where one can read in a SEG2 file (Obspy.seg2.seg2)  
but is it possible to write data in SEG2 format, similar to SEGY?  
Thanks,  
Mark Goldman  
U.S. Geological Survey  
345 Middlefield Rd, MS 977  
Menlo Park, CA 94025  
goldman@usgs.gov  
650-329-5496

---

<div class="post-metadata">

**Author:** ![Peter\_Danecek1](https://discourse.obspy.org/user_avatar/discourse.obspy.org/peter_danecek1/32/1123_2.png) [@Peter\_Danecek1](https://discourse.obspy.org/u/Peter_Danecek1)\
**Post date:** [January 6, 2016, 9:52am UTC](https://discourse.obspy.org/t/convert-segy-file-to-seg2/487/2 "2016-01-06T09:52:25Z")

</div>

Hi Mark,

> Is it possible in Obspy to convert a SEGY file to a SEG2 file?  
> I see where one can read in a SEG2 file (Obspy.seg2.seg2)  
> but is it possible to write data in SEG2 format, similar to SEGY?

currently the SEG2 plugin provides only a reader.

See for example:

&nbsp;&nbsp;[https://github.com/obspy/obspy/blob/master/setup.py#L219-L222](https://github.com/obspy/obspy/blob/master/setup.py#L219-L222)  
&nbsp;&nbsp;[https://github.com/obspy/obspy/blob/master/obspy/io/seg2/seg2.py](https://github.com/obspy/obspy/blob/master/obspy/io/seg2/seg2.py)

For the conversion you are asking for (SEGY -\> SEG2), you'd needed the writer to be implemented. This should be not to complicated, but nobody ever contributed it. The conversion in the other direction is should be possible, as the writer for SEGY already exists.

In case your are considering to give it a try and want to contribute the writer for SEG2, the routine would go into `obspy/io/seg2/seg2.py` and then needs to be registered in the `setup.py` (see links above). If you open a ticket or a pull request, the developer will guide you through the process.

Cheers!  
~petr

---

<div class="post-metadata">

**Author:** ![Goldman\_Mark\_R](https://discourse.obspy.org/letter_avatar_proxy/v4/letter/g/a9a28c/32.png) [@Goldman\_Mark\_R](https://discourse.obspy.org/u/Goldman_Mark_R)\
**Post date:** [January 6, 2016, 6:46pm UTC](https://discourse.obspy.org/t/convert-segy-file-to-seg2/487/3 "2016-01-06T18:46:19Z")

</div>

Thanks for the example, I may give it a try

There is also a common IRIS varient of SEGY files that  
should be an easy plugin to develop  
(no 3600 byte reel header, bytes 229-232=#samples/trace, bytes 205-206=data\_sample\_format: 0 = 2 byte int, 1=4 byte int)

Mark
