seismic-py: Reading seismic da a wi h Py hon
Ku Schweh
Cen e o Coas al and Ocean Mapping, Uni e si y o New Hampshi e
Abs ac . The ield o seismic explo a ion o he Ea h has changed
d ama ically o e he las hal a cen u y. The Socie y o Explo a ion
Geophysicis s (SEG) has wo ked o c ea e s anda ds o s o e he as
amoun s o seismic da a in a way ha will be po able ac oss compu e
a chi ec u es. Howe e , i has been impossible o p edic he needs o he
immense ange o seismic da a acquisi ion sys ems. As a esul , endo s ha e
had o bend he ules o accommoda e he needs o new ins umen s and
expe imen ypes. Fo low le el access o seismic da a, he e is need o a
s anda d open sou ce lib a y o allow access o a wide ange o endo da a
iles ha can handle all o he a ia ions. A new seismic so wa e package,
seismic-py, p o ides an in as uc u e o c ea ing and managing d i e s o
each pa icula o ma . D i e s can be de i ed om one o he known o ma s
and al e ed o handle any sligh a ia ions. Al e na i ely d i e s can be
de eloped om sc a ch o o ma s ha a e e y di e en om any p e iously
de ined o ma . Py hon has been he key o making d i e de elopmen easy
and e icien o implemen . The goal o seismic-py is o be he base sys em
ha will powe a wide ange o expe imen a ion wi h seismic da a and a he
same ime p o ide clea documen a ion o he his o ical eco d o seismic
da a o ma s.
INTRODUCTION
Seismic da a sys ems use acous ic pulses o send
sound wa es h ough wa e and he solid ea h o map
laye s wi hin he subsu ace. They a y om simple
single sou ce and single ecei e sys ems o mul iple
sou ces and long a ays o geophones o hyd ophones.
The p ocessing o he ecei ed sound wa es equi es a
ange o da a s o age and signal analysis echniques.
Py hon can suppo bo h he da a a chi al and p e-
cessing asks.
In his pape , I will use he example o a single
sou ce seismic ins umen owed behind a ship (e.g. Fig-
u e 1a,b). The de ice (known as a ow- ish, o jus a
ish) is a 2m long de ice ha emi s a pulse o sound
ene gy o e a ange o equencies s aigh down using
piezoelec ic ansduce s. The ene gy a els as wa es
h ough he wa e and bo om ma e ial. As he sound
eloci y o he medium changes, a small po ion o he
ene gy is e lec ed back up owa ds he ish whe e i is
collec ed by he ecei e s and s o ed o la e p ocess-
ing. Each pulse o ou going ene gy is e e enced o as
asho and he esul ing e u ned da a a e collec i ely
called a ace. A GPS on-boa d he ship eco ds he po-
si ion and ime o he ship o each sho . When aces
a e combined and geo e e enced, a ibbon iew is c e-
a ed ha is call a seismic line (Figu e 1c). The inse
in Figu e 1c shows he seismic lines combined wi h he
ba hyme y o gi e an o e all pic u e o he ocean bo -
om. The p ocess o going om sho s o a 3D model
wi h in e p e a ion h ough o a publica ion can be a -
duous, especially when he e a e e aby es da a.
The e a e li e ally housands o pieces o code a ound
he wo ld o eading and w i ing seismic da a bo h
in he comme cial and academic wo ld. Do we need
ye ano he one? The Socie y o Explo a ion Geophysi-
cis s (SEG) has wo ked o p o ide a numbe o well
hough ou s anda ds o seismic da a (e.g. SEGY Re
0) [Ba y e al.,1975]. The SEG has con inued e alu-
a ing he needs o he communi y and has eleased an
upda ed o ma ha a emp s o accommoda e changes
in he indus y (e.g. SEGY Re 1) [No is and Faich-
ney,2002]. Howe e , he eali y is ha no one so wa e
package can ead all o he a ia ions on hese s anda d
1
Schweh : seismic-py, Py hon Pape s 2008 2
0.5-6 kHz
T ansduce
2-16 kHz
T ansduce
High equency
ecei e
4 low equency
ecei e s
b)a) c)
Wi e ou
GPS
Layback
Fish
Figu e 1. a) Schema ic o a ship owing a seismic subbo om p o ile ( ish). Base image cou esy Gene ie e
Tauxe. b) Unde side o an EdgeTech Chi p ish showing he ansduce s ha p oduce he acous ic sho and he
senso s ha ecei e he e lec ed ene gy, which a e s o ed as a ace. Image cou esy Lau en Begue y. c) T aces
a e shown oge he as a cu ain o show a seismic line and a e o en combined wi h mul ibeam ba hyme y as
isualized by Flede maus in he inse . Da a cou esy Neal D iscoll and Pa Iampie o.
o ma s and he e is no cen al eposi o y documen -
ing how hese o ma s di e om he SEGY s anda ds.
Many seismic p ocessing packages come wi h ools ha
allow bina y le el inspec ion o da a iles o a emp
o asce ain how a pa icula SEGY ile is s uc u ed.
Use s cu en ly need a ange o ools in hei a senal o
ex ac c i ical da a om eco ded da a s eams.
seismic-py is a package designed o alle ia e he p ob-
lems o changing da a ile o ma s in he seismic indus-
y. I p o ides a Py hon Applica ion P og amming
In e ace (API) o seismic da a ha elies on a se o
d i e s ha speci y and documen he ac ual layou o
a pa icula ile o ma . seismic-py p o ides his c i ical
unc ionali y in a lib a y eleased unde he GNU Gen-
e al Public License (GPL) [S allman,1984–], an Open
Sou ce Ini ia i e (OSI) [Raymond,1998–] app o ed li-
cense. This means ha s uden s and p o essionals alike
ha e he igh o modi y and imp o e he seismic-py
package. The sou ce code is a ailable o download he e:
h p://schweh .o g/so wa e/seismic-py/
SEGY FILE LAYOUT
Be o e p oceeding in o he de ails o he so wa e sys-
em, i is impo an o ha e an unde s anding o he lay-
ou o SEGY Re 1 da a. The o ma is a Fo an s yle
se ies o bina y da a eco ds p eceded by a heade . The
o e all layou o SEGY iles b eaks he con en in o wo
majo sec ions. Fi s is a heade g oup s a ing wi h
a 3200 by e ex block (ei he ASCII o EBCDIC)
ha is ei he ee o m o g ouped in o 40 p ede ined
80 cha ac e eco ds. Following he ex block is a well
de ined 400 by e bina y heade egion. A e his a e
ze o o mo e Ex ended Tex ual File Heade s ha do
no ha e hei o ma de ined in he s anda d. The es
o he ile consis s o seismic ace eco ds. These ace
eco ds a e no equi ed o all be he same size, bu
hey a e equi ed o ha e a 240 by e bina y heade a
he beginning o each ace. Vendo s and people p o-
cessing seismic da a equen ly c ea e hei own o ma
by changing he meaning o hese bina y ields.
DESIGN
The choice o compu e language is he mos pi o al
design elemen o a so wa e p ojec . This choice al e s
which asks will be ha d o easy. Fo mos seismic pack-
ages, Fo an and/o C/C++ a e he usual choices o
implemen a ion. Fo an is he mos common language
o he geophysical communi y, bu is a he igid. The
C/C++ amily o languages p o ides ex eme lexibil-
i y, dynamically loadable modules, objec o ien ed de-
sign and much mo e, bu a a cos o complexi y and e-
quency o bugs. Py hon appea s o be an excellen com-
p omise be ween he wo g oups o languages. Py hon
comes wi h addi ional unc ionali y no easily a ailable
wi h ei he o he o he al e na i es. S uden s a e able
o quickly pickup skills in Py hon as e han Fo an
o C. Py hon’s addi ional unc ionali y simpli ied he
ini ial design and implemen a ion o seismic-py.
Wi h he wide ange o endo implemen a ions o
SEGY w i e s, i is c i ical ha SEGY eade s be able
o easily handle a la ge numbe o d i e s and allow
d i e w i e s o quickly p oduce he needed changes.
Wi h C/C++, his ask is possible wi h dynamically
loaded, sha ed lib a ies o by pa sing speci ica ion iles,
Schweh : seismic-py, Py hon Pape s 2008 3
de c ea eD i e Name(d S ):
’’’Make Py hon ilename o load:
xs a -> segy_d _xs a
d _xs a -> segy_d _xs a
segy_d _xs a .py -> segy_d _xs a
’’’
i -1 != d S . ind(’.py’):
d S = d S [:-3]
i -1 == d S . ind(’d _’):
d S = ’segy_d _’+d S
i -1 == d S . ind(’segy_’):
d S = ’segy_’+d S
e u n d S
de ge D i e Module(d S =’segy_d _ e 1’):
d i e name = c ea eD i e Name(d S )
ile, pa hname, desc ip ion =
imp. ind_module(d i e name)
d = imp.load_module(d i e name, ile,
pa hname,desc ip ion)
e u n d
Figu e 2. The ge D i e Module unc ion w aps he
Py hon module loaded. By w apping he s anda d
Py hon module loade wi h he c ea eD i e Name
unc ion, seismic-py is able o le he use use
sho hand d i e names such as “ e 1” ins ead o
“segy d e 1.py”.
bu is p one o e o s and di icul ies wi h dynamic link-
e s. Py hon p o ides his unc ionali y wi h he imp
module [Py hon So wa e Founda ion,2008b] allowing
de ice loading o be coded in py hon. The imp mod-
ule p o ides he componen s equi ed o c ea e a cus-
om impo unc ion in py hon. seismic-py p o ides a
ge D i e Module unc ion ha w aps he imp module
allowing he use o speci y he d i e name in any one
o ou o ms (Figu e 2). Py hon loads a d i e module
om he use s PYTHONPATH and e u ns he d objec .
All Py hon code is hen able o access he d i e da a
jus as i would any o he Py hon module.
A non objec -o ien ed design wo ks jus as well and
should be mo e app oachable o scien is s who may
no be amilia wi h objec -o ien ed design. Fo mos
p ojec s o his na u e, he ob ious choice o a design
would be o c ea e a pa en class and de i e d i e s om
he pa en class o om sibling d i e s. Wi h he his-
o y o he SEGY o ma s, a s aigh inhe i ance ee
would p obably be a he di icul . I is expec ed ha as
he pool o d i e s inc eases, new d i e s will pull pieces
1. ex FileHeade En ies (Op ional)
2. bina yHeade En ies
3. ex Tex FileHeade En ies (Op ional)
4. aceHeade
5. ileHeade Tables
6. aceHeade Tables
7. ileHeade Sho Lis
8. aceHeade Sho Lis
Figu e 3. Lookup ables (dic iona ies) o a SEGY ile
d i e . Each able speci ies all o he alid ield names
and by e loca ions o each ield. All o hese ables a e
equi ed excep he ex and ex ended ex ile heade
en ies.
om a wide a ie y o exis ing d i e s. A ue objec -
o ien ed design would po en ially c ea e a complica ed
pa h o mul iple inhe i ances. The d i e app oach he e
appea s o simpli y his p oblem and allows d i e s o
euse pieces om whe e e e hey exis wi hou code
duplica ions. I one we e o y o d aw he his o i-
cal ela ionships o SEGY o ma a ia ions, i migh
look some hing like he a emp s o g aph Unix sys em
lineages: e y complica ed and ne e uly accu a e.
D i e Speci ica ion File
Each speci ica ion d i e is simply a Py hon ile wi h
a se o equi ed dic iona ies (lookup ables; Figu e 3).
These lookup ables ha e a a ie y o asks anging
om ac ing as poin e s in o bina y da a o allowing
decoding o da a elemen s. Each sec ion dic iona y
con ains by e o se anges o each da a ield. The
“segy d e 1.py” p o ides he e e ence d i e .
I ems 1-4 in Figu e 3p o ide he co e lookup ables.
These ables speci y he loca ion o each ield in he
heade s. The bina yHeade En ies and aceHeade
ables oge he dic a e how o decode he da a in he
aces. The majo i y o hese ields a e in ege s. Fo
hose in ege s ha a e enume a ed alues, i is impo -
an o be able o c ea e human eadable ex ep esen-
a ions o alues. Take he da aField dic iona y as an
example. A ’5’ means ha he da a will be a ”4-by e
IEEE loa ing-poin .” The lookup ables p o ide by e
o se s in i ems 5 and 6 o each ield. Figu e 4shows a
code example showing how o use he ables con ained
in a d i e .
The sho lis s (i ems 7 and 8) a e used o p og ams
ha wish o show a smalle lis o i ems conside ed o
be he mos c i ical. The sho lis p o ides a less o e -
whelming iew o he ace heade and a e he i ems
Schweh : seismic-py, Py hon Pape s 2008 4
>>> impo segy
>>> s = segy.Segy(’ ile.sgy’)
>>> p in s.d .bina yHeade En ies
[’SampleFo ma ’]
[3225, 3226, ’Da a sample o ma code’]
>>> s.heade .ge BinEn y(’SampleFo ma ’)
1
>>> p in s.d . ileHeade Tables
[’SampleFo ma ’][1]
4-by e IBM loa ing poin
Figu e 4. The Py hon command line is a quick way o
explo e a SEGY ile. Once a ile is loaded, i is possi-
ble o que y o he aw alues as wi h ge BinEn y o
ge he English ansla ion by using one o he lookup
ables.
om segy_d _ e 1 impo da aFo ma s
om segy_d _ e 1 impo da aFo ma S uc
om segy_d _ e 1 impo aceSo ingCodes
om segy_d _ e 1 impo sweepTypeCodes
Figu e 5. Reuse o common d i e unc ionali y is en-
cou aged. This can also be used o show he he i age o
ile o ma . Fo example, i a d i e is essen ially SEGY
Re 1 wi h a ew modi ica ions, his will immedia ely
be clea o anyone who eads he d i e ile.
ha he d i e au ho decided a e he mos impo an
o use s o examine. Fo example, he sho lis o
a ace heade migh consis o only he sho numbe
(Sho poin ), he geog aphic loca ion o he GPS (X,
Y), and he delay om he sho i ing o he ime he
ecei e s s a eco ding (Delay). The s anda d ace
heade has an o e whelming 90 i ems, whe eas he sho
lis migh ha e jus 4 o 5 en ies.
De i ing Va ian Speci ica ions
Once a basic d i e has been c ea ed o a amily o
SEGY o ma s, i is easy o c ea e de i a i e d i e s
ha only modi y small po ions o an exis ing d i e .
The segy d xs a .py ile p o ides an example o a
de i a i e d i e . The SIO EdgeTech Chi p XS a o -
ma is simila o SEGY Re 1. All o he componen s
ha emain he same a e di ec ly impo ed (Figu e 5).
Py hon ies o keep only e e ences o objec s when
hey a e used elsewhe e wi hin a Py hon p og am. Fo
i ems ha need o be changed, i is impo an o make
a comple ely new and sepa a e local copy o he da a.
This is done wi h wha Py hon calls a deepcopy [Py hon
bina yHeade En ies = copy.deepcopy (
segy_d _ e 1.bina yHeade En ies
)
del bina yHeade En ies[’JobId’]
del bina yHeade En ies[’ReelNo’]
del bina yHeade En ies[’T acesPe Ensemble’]
Figu e 6. I is c i ical o use deepcopy when de i ing
ables om d i e s. This p e en s he o iginal d i e
om being co up ed when al e ing o dele ing en ies
in a new d i e .
So wa e Founda ion,2008a]. Figu e 6is an example
wi h he bina yHeade En ies. The XS a o ma does
no ill in a numbe o ields. Missing en ies a e e-
mo ed om he local copy a e he SEGY Re 1 en ies
a e deep copied.
Pe o mance
So wa e pe o mance is c i ical o seismic p ocessing
applica ions. Seismic ins umen s a e capable o apidly
gene a ing eno mous quan i ies o da a. I he code is
no able o cope wi h his olume, use s will quickly be-
come us a ed. seismic-py akes he app oach o using
he mmap sys em call h ough he mmap Py hon module
[Py hon So wa e Founda ion,2008c]. This call allows
he ope a ing sys em (OS) o page da a in o memo y on
demand ia he paging sys em. Since hese pages a e
ma ked as ead only, he OS can dump pages quickly
as memo y p essu e inc eases du ing p ocessing uns.
Loca ions o each name a e s o ed in a Py hon dic io-
na y (basically hash ables). Wi h he small size o
hese dic iona ies, he lookups p oceed quickly. mmap
b ings in aw bina y da a ha canno be di ec ead
wi h Py hon. Howe e , Py hon p o ides he s uc
module [Py hon So wa e Founda ion,2008d] ha can
con e bina y da a o Py hon objec s gi en a con e -
sion s ing. The s uc module can con e a ange
o in ege ypes along wi h IEEE 32- and 64-bi loa -
ing poin numbe s. Much olde seismic da a is in IBM
loa ing poin o ma ha is no suppo ed by s uc ,
he e o e seismic-py can no ye ead hose seismic da a
iles.
I he speed o he pu e Py hon is no as enough, i
is possible o eplace da a pa sing code wi h op imized
C o C++ code. O iginally, his was only possible wi h
he Py hon/C p og amming API [ an Rosum,2008],
bu he e now exis a wide ange o ools o w ap-
ping C++ o using py hon such as SWIG [Beazley and
Lomdhal,1997] o Boos .Py hon [Ab ahams,2002–], o
Schweh : seismic-py, Py hon Pape s 2008 5
-20000
-15000
-10000
-5000
0
5000
10000
15000
20000
750 800 850 900 950 1000 1050 1100
Ampli ude
A/D sample
Seismic T ace
' ile.sgy-00002.da '
Figu e 7. Gnuplo ou pu om plo ing he ASCII
ace alues w i en o disk by segydump. Plo ed wi h
“plo ’ ile.sgy-00002.da ’ wi h linespoin s”.
al e na i ely using C inline wi hin Py hon sou ce code
[Ma dal and Wes lie,2007-;Simpson,2001].
SAMPLE APPLICATIONS
To make i easie o ge s a ed wi h seismic-py, he
package comes wi h many sample applica ions. I will
discuss 3 applica ions o gi e a la o o he possibili-
ies. Segydump p o ides a quick look capabili y simila
s anda d hex iewe s, bu wi h an unde s anding o he
heade ield names. Seqysql loads he ace heade s
in o a simple SQL da abase. Segysqlgm combines he
ace loca ions wi h a p og am o d aw maps.
Segydump
Segydump p o ides in e nal lis ings and ace da a
dumps o SEGY da a iles. This is an excellen s a ing
example as i exe cises jus abou all o he unc ionali y
in he d i e bu hides mos o i behind he Segy class.
The mos challenging po ion o Segydump is handling
all o he command line op ions such as being able o in-
clude he ilename in on o each line o ex . Figu e 8
is a s ipped down e sion o he dumping code.
By speci ying he d i e wi h he Segy class, all o
he qui ks o he XS a o ma a e i ele an a his
le el o he in e ace. The code s a s by opening a
SEGY da a ile wi h he speci ied d i e on Line 3.
Line 4 p in s ou he numbe o aces in he ile. The
p in Bina yHeade s call in line 5 p in s ou all o he
heade en ies. The use can eques ha aces be
dumped ou o disk, which is done in lines 6-8. Line 9
inishes by p in ing ou he heade in o ma ion o each
ace. Addi ional code in segydump (no shown he e)
handles looping o e each o he p o ided iles, selec ing
1 aceNum = 123
2 ilename = ’LaJolla-line101.xs a ’
3 s = Segy( ilename, d i e name=’xs a ’)
4 p in ’ aces = %s’ % s.ge Numbe O T aces()
5 s.heade .p in Bina yHeade s()
6 s.w i eT aceToFile(’%s-%05d.da ’
7 % ( ilename, aceNum),
8 aceNum)
9 s.ge T aceHd ( aceNum).p in Heade ()
Figu e 8. This code snippe w i es he da a om a
ace ou o an ASCII ex da a ile. This da a ile is
sui able o loading in o Oc a e o plo ing wi h Gnu-
plo .
sho o long ou pu , and p o iding addi ional in o ma-
ion. I is up o he use o use a ool like g ep o pull
ou speci ic heade ields. Think o segydump as he
equi alen o he Unix ls o DOS di commands.
The abili y o w i e ou indi idual aces should
make a wide ange o s udies mo e con enien . Mos
p ocessing en i onmen s and languages can ead in
ASCII da a ha is in (sample numbe , alue) pai s. The
simples case is isual inspec ion o indi idual aces as
shown in Figu e 7, which shows he gnuplo esul s
om unning “segydump -w - 2 ile.sgy” ollowed
by gnuplo . This idea can be ex ended o p og ams
such as MATLAB and IDL/ENVI whe e addi ional signal
p ocessing is adi ionally can be pe o med.
Segysql
One o he mos common asks o wo king wi h seis-
mic da a is ying o manage all o he me ada a o
SEGY iles. Py hon p o ides a ich se o modules ha
simpli y many o hese asks. Use s o en wan o know
which lines c oss h ough a egion o he sho closes
o a ea u e, co e, o s a ion. The s a egy mos e-
quen ly used in he academic wo ld is o c ea e a wide
ange o ex columns managed wi h awk,sed, and Pe l
sc ip s. SQL p o ides an easie way o que y la ge da a
se s. The p oblem is ha he e has been no easy way
o impo he heade da a o iles and aces in o an
SQL da abase. Segysql p o ides a comple e example
o da abase impo ing using he SQLi e [Wy ick and
Hipp,2000–] da abase. SQLi e was solely o i s ease
o use. The e is no need o se up a da abase se e .
As o e sion 2.5, Py hon has a SQLi e da abase in e -
ace called sqli e3, ha simply uses a single ile as he
da abase eposi o y. Olde e sions o Py hon can use
pysqli e [Owens and Hae ing,2001–]. Swi ching o any
Schweh : seismic-py, Py hon Pape s 2008 6
01 impo segy
02 impo sqli e3
03 cx = sqli e3.connec (’segy.db3’)
04 cu = cx.cu so ()
05 cu.execu e(segy.sqlC ea eFileTable(’xs a ’))
06 cu.execu e(segy.sqlC ea eT aceTable(’xs a ’))
07 cx.commi ()
08 xs a = segy.Segy( ilename,’xs a ’)
09 cu.execu e(xs a .heade .sqlInse ( ilename))
10 cx.commi ()
11 cu.execu e(’SELECT ileKey FROM segyFile WHERE ilename=:1;’,( ilename,))
12 ileKey = cu. e chone()[’ ileKey’]
13 o i in ange(1,xs a .ge Numbe O T aces()+1):
14 cu.execu e(xs a .ge T aceHd (i).sqlInse ( aceNumbe =i, ileKey= ileKey))
15 cx.commi ()
Figu e 9. seismic-py p o ides helpe mechanisms o simpli y SQL da abase c ea ion ha can easily be combined
wi h SQLi e.
o he da abase in e ace equi es changing only a ew
lines. The seismic-py Py hon API p o ides me hods
ha e u n he necessa y SQL s ing o able c ea ion
and ow inse ion. Jus pass hese s ing in o a new
da abase in e ace.
Figu e 9demons a es a s ipped down e sion o
code o c ea e and ill an SQL da abase om a se o
SEGY iles. Lines 3-7 connec o a new da abase ile and
c ea e he da abase ables. Once, he da abase has been
c ea ed, he i s ask is o add a ile o he da abase
(Line 09). To inse all o he ace heade s in o he
heade s, i s we ha e o ge (wi h an SQL SELECT) he
e e ence key c ea ed by he da abase o he ile (Line
9-10). Finally, each ace is added in a loop o e all o
he aces (Line 13-14). The commi calls a e pa o he
SQL da abase in e ace ansac ion handling. No hing
is ac ually added o he da abase un il he commi call.
Segysqlgm
Once heade in o ma ion is in a da abase, i becomes
much easie o c ea e mini-applica ions ha add o he
seismic p ocesso ’s ool ches . Ma ine scien is s ypi-
cally use GMT [Wessel and Smi h,2006] and MBSys-
em [Ca ess and Chayes,2001–] o make maps o a eas
ha can inco po a e o he c i ical da a. segysqlgm , a
p og am o display he acks o seismic lines on a map,
illus a es his concep . mbm g dplo , a sc ip wi h in
MB Sys em, eads a GMT g d and hen ou pu s a de-
aul plo ing sc ip using GMT commands, p o iding
a simple basemap. Fo example, wi h a San a Ba ba a
Basin, CA mu libeam da a se [Ha che and Mahe ,
1999], he command is “mbm g dplo -Igm .g d.” This
is much easie ha s a ing o w i ing you own GMT
sc ip . Segysqlgm can hen p o ide ex o ma da a
iles o he ship acks and sho coun s a in e als in a
o ma sui able o GMT’s psxy and ps ex along wi h
he shell sc ip lines o add o he mbm g dplo o ig-
inal sc ip . segysqlgm c ea es quick look sho plo s
o su eys on op o ha base map ha can be seen in
Figu e 10.
FUTURE DIRECTIONS
The e is s ill much wo k o be done on seismic-
py. This pape desc ibes only he ini ial wo k done
by one de elope . seismic-py akes a di e en app oach
o seismic da a p ocessing compa ed o o he academic
packages such as sioseis [Henka ,1975]), Seismic Unix
[S ockwell,1997], o pl segy [Ha ding,2005] by p o id-
ing s and alone base le el d i e s. An open sou ce con-
ibu ion o he seismic communi y will hope ully spu
mo e esea ch in o seismic da a p ocessing, isualiza-
ion, and in e p e a ion ha will gi e he geoscience
communi y new iews in o ou ocky plane s.
To da e, seismic-py only implemen s he SEGY Re
1 and he EdgeTech XS a o ma , bu i holds p omise
o p o iding a as ange o da a o ma s. C i ical
missing ea u es include ull handling o ASCII/EBCDIC
heade s, ex ended ex heade s, IBM loa ing poin
da a, de ini ion o non-in ege heade alues, and many
mo e endo s’ o ma s. All o hese a e no ha d o
p o ide and a e jus a ma e o addi ional de elope
Schweh : seismic-py, Py hon Pape s 2008 7
Ship T ack and Sho poin s o BPSIO 2004
239˚35’
239˚35’
239˚45’
239˚45’
239˚55’
239˚55’
240˚05’
240˚05’
240˚15’
240˚15’
240˚25’
240˚25’
34˚00’ 34˚00’
34˚10’ 34˚10’
34˚20’ 34˚20’
34˚30’ 34˚30’
Figu e 10. Ship acks and sho poin s o a San a Ba ba a Basin chi p c uise in 2004. The map was c ea ed wi h
a combina ion o MB-Sys em, GMT, and seismic-py. By d awing co es, ship acks, and sho numbe s, analys s
can quickly ind he ele an da a.
ime. Py hon has p o ed o be an ideal language o
handling o ma s like his ha a e Fo an s yle bina y
da a eco ds. The buil -in dic iona y and lis da a ypes
make he d i e iles appea e y close o he o iginal
ex speci ica ion documen s.
The segy class in e ace needs a ew addi ions. The
mos c i ical o making seismic-py mo e ”Py honic” is
o add an i e a o in e ace, such ha a o loop on a
segy objec will loop o e he aces. Addi ionally, he
ini ial da abase in e ace only suppo s adi ional SQL
calls. Fu u e e sions need o add suppo o spa ial
da abases such as Pos GIS [Re ac ions Resea ch,2008]
and [Fu ie i,2008]
The ini ial wo k on seismic-py used Py hon dic io-
na ies o de ine he SEGY ile o ma and o he iles
a iances p oduced by each ins umen . This is e ec i e
o ini ial p o o ypes, bu o la ge impac on he com-
muni y, u u e p ojec s should use eX ensible Ma kup
Language (XML) con igu a ion iles. XML allows so -
wa e implemen e s o choose hei language o p e e -
ence (assuming ha i has an XML eading lib a y) o
a compile could be gene a ed ha emi s sou ce code
o any pa icula p og amming language. A compiled
e sion ( esul ing in Py hon code) could be made as e
wi hou he cu en un- ime able lookups.
CONCLUSION
seismic-py p o ides a e e ence implemen a ion o an
in e ace o he wide a ie y o seismic da a ha end
use s encoun e in p ocessing seismic da a. seismic-
py will p o ide he basis o he apid de elopmen o
new ools o inspec ing and p ocessing seismic da a.
seismic-py emo es he es ic ion o using one ype o
seismic da a a a ime. Use s can open many di e -
en seismic s eams a he same ime wi h each s eam
u ilizing a di e en d i e ma ching each da a ile ype.
Today, many s uden s in geophysics and geology
lea n p og amming on non-geoscience ype p oblems.
Tools like seismic-py will allow beginning s uden s lea n
he compu e languages such as Py hon while wo king
wi h da a se s ha a e exci ing and cu ing edge. Why
no ha e s uden s s a by accessing and iewing seis-
mic da a when hey a e lea ning o p og am i hey a e
s udying geophysics? The hope is o u n seismic-py
in o one componen o an in oduc ion o scien i ic com-
pu ing class. The class can use packages such as SciPy
[Jones e al.,2001–], Scien i icPy hon[Hinsen,1999–],
he pygsl in e ace o Gnu Scien i ic Lib a y [Gaedke
and Schnize ,2001–]), and he Py hon Imaging Lib a y
[Py honWa e,2006] o di e igh in o p ocessing eal
da a while lea ning da a s uc u es and algo i hms. The
a ious asks can hen be combined o c ea e igu es
Schweh : seismic-py, Py hon Pape s 2008 8
sui able o scien i ic publica ions (e.g. Figu e 1c).
Pe haps he mos impo an side e ec o seismic-
py is he beginning o a lib a y ha documen s seis-
mic o ma s. The e is a as weal h o comme cial and
academic seismic da a al eady collec ed o da e. By
keeping hese olde da a se s eadable, new expe imen s
s udying change in ea h s uc u es become mo e man-
ageable. Huge amoun s o money ha e al eady been
spen collec ing seismic da a and i is impo an o sim-
pli y access o he aluable esou ce.
Acknowledgmen s
I would like o hank he e iewe s and many o he
people who ead d a s o his pape o hei aluable
inpu . Lisa Tauxe and Neal D iscoll p o ided much
encou agemen . NSF and BP p o ided unding he da a
collec ion ha led o his so wa e p ojec .
Re e ences
Ab ahams, D., Boos .Py hon, h p: // www. boos .
o g/ doc/ libs/ elease/ libs/ py hon/ doc/ ,
2002–.
Ba y, K. M., D. A. Ca e s, and C. W. Kneale, Repo
on ecommended s anda ds o digi al ape o ma s,
Geophysics,40, 344–352, 1975.
Beazley, D. M., and P. S. Lomdhal, Feeding a
La ge–scale Physics Applica ion o Py hon, In e -
na ional Py hon Con e ence,6,h p://www.swig.
o g/pape s/Py97/beazley.h ml, 1997.
Ca ess, D., and D. Chayes, MB-Sys em Ve -
sion 5, Open sou ce so wa e dis ibu ed om
he MBARI and L-DEO web si es, 12 be a
eleases, h p: // www. ldeo. columbia. edu/ es/
pi/ MB-Sys em/ MB-Sys em. in o. h ml , 2001–.
Fu ie i, A., Spa iaLi e - Vi ualShape, h p: // www.
gaia-gis. i / spa iali e-2. 0/ index. h ml ,
2008.
Gaedke, A., and P. Schnize , PyGSL: Py hon in e -
ace o GNU Scien i ic Lib a y, h p: // pygsl.
sou ce o ge. ne / , 2001–.
Ha ding, A., pl segy, 2005.
Ha che , G., and N. Mahe , MBARI San a Ba ba a
Basin Mul ibeam Su ey, h p: // www. mba i.
o g/ da a/ mapping/ SBBasin/ de aul . h m , 1999.
Henka , P., Sioseis, h p: // sioseis. ucsd. edu/ ,
1975.
Hinsen, K., Scien i icPy hon, h p: // s a ship.
py hon. ne / ∼hinsen/ Scien i icPy hon/ , 1999–
.
Jones, E., T. Oliphan , P. Pe e son, e al., SciPy:
Open sou ce scien i ic ools o Py hon, h p: //
www. scipy. o g/ , 2001–.
Ma dal, K., and M. Wes lie, Ins an , h p: // www.
enics. o g/ wiki/ Ins an , 2007-.
No is, M. W., and A. K. Faichney, SEG Y
e 1 Da a Exchange o ma , h p: // seg. o g/
publica ions/ ech-s and/ , 2002.
Owens, M., and G. Hae ing, pysqli e - A DB API 2.0
compa ible in e ace o SQLi e, h p: // ini d.
o g/ acke / pysqli e , 2001–.
Py hon So wa e Founda ion, copy – Shallow and deep
copy ope a ions, h p: // docs. py hon. o g/ lib/
module-copy. h ml , 2008a.
Py hon So wa e Founda ion, imp – Access he im-
po in e nals, h p: // docs. py hon. o g/ lib/
module-imp. h ml , 2008b.
Py hon So wa e Founda ion, mmap – Memo y-
mapped ile suppo , h p: // docs. py hon. o g/
lib/ module-mmap. h ml , 2008c.
Py hon So wa e Founda ion, s uc – In e p e s ings
as packed bina y da a, h p: // docs. py hon. o g/
lib/ module-s uc . h ml , 2008d.
Py honWa e, Py hon Imaging Lib a y (PIL), h p: //
www. py honwa e. com/ p oduc s/ pil/ , 2006.
Raymond, E. S., The Open Sou ce Ini ia i e, h p:
// www. opensou ce. o g/ , 1998–.
Re ac ions Resea ch, Pos GIS, h p: // pos gis.
e ac ions. ne / , 2008.
Simpson, K., PyInline, h p: // www. enics. o g/
wiki/ Ins an , 2001.
S allman, R., The GNU Gene al Public License, h p:
// www. gnu. o g/ licenses/ licenses. h ml ,
1984–.
S ockwell, J. W., F ee So wa e in Educa ion: A case
s udy o CWP/SU: Seismic Un*x, The Leading Edge,
1997.
an Rosum, G., Py hon/C API Re e ence, h p: //
docs. py hon. o g/ api/ api. h ml , 2008.
Wessel, P., and W. H. F. Smi h, Gene ic Mapping Tools,
h p: // gm . soes . hawaii. edu/ , 2006.
Wy ick, G., and R. Hipp, SQLi e, h p: // www.
sqli e. o g/ , 2000–.
K. Schweh , Cen e o Coas al and Ocean Map-
ping, Uni e si y o New Hampshi e, Chase Ocean
Enginee ing 24 Colo os Rd, Du ham, NH 03824,
schw[email p o ec ed], h p://schweh .o g