Getting your Feet Wet II - How to cut SEGY from continuous data

Onto the big reveal … Let’s cut SEGY data from continuous data! For a brief introduction into why one might do this go back and read my last post.  

In all honesty it took me several attempts with different toolsets before I finally figured out how to successfully cut SEGY data from continuous data.  At first glance it feels like this should be trivial - that is, converting seismic data from one format to another - but in practice it's not nearly as easy as it looks.  That's until I found ObsPy.  One of the major difficulties in handling SEGY data are the byte-specific headers.  SEGY stores important information like trace number, source location (X,Y), receiver location (X,Y), and numerous other fields in a very specific binary header (EBCDIC) which is not intuitive to create without extensive experience.  There are many useful posts concerning SEGY data and how it's created (I suggest this one by Agile and this one from the SIOSEIS group).  Needless to say I'm not going to go any detail about the difficulties of SEGY and instead let's just jump straight into the deep end of trying to create it.  

After talking to colleagues who've successfully done this in the past it's clear that there's not one standard method that's used.  Some people will create shot tables in Antelope and cut the data as if cutting earthquake records while others will use a combination of shell scripts (glueSG) and PASSCAL programs (ref2segy).  However, neither of these procedures were straight forward or simple to execute thus I struck out on my own with ObsPy.  

Flow chart of the structure of my script to cut SEGY from continuous data for a large network of stations and for multiple active-source lines.  (Like the way this flow chart looks? Try it for yourself at Lucidchart - it's free!)

My final, working script, is organized in three nested for-loops: 1) Loop through all stations; 2) Loop through all refraction lines; 3) Loop through all individual shots in a given line.  The trick to cutting SEGY is creating small SEGY files that only encompass one shot each with the associated header information and then concatenating all of those individual files together into your master SEGY file.  

Example receiver gather for onshore station SCH for Line 2 of the SEGMeNT active-source experiment created using my script to cut SEGY data from continuous data.  Inset map shows the location of Line 2 and the instrument.  Clear first arrivals are visible across the entire line.

Depending on exactly your experiment setup (i.e. number of stations, format of continuous data, number of shots ... you'd likely have to make some edits to the script I have written.  Nevertheless, be brave, have no fear, and start scripting! You can find the current version of my script here.