up [pdf]
from rsfproj import *

xmax = 6.0
zmax = 2.0

layers = ((0.30,0.50,0.20,0.30),
          (0.55,0.75,0.45,0.55),
          (0.65,0.85,0.55,0.65),
          (1.30,1.30,1.60,1.20))

velocities = (0.44,
              0.40,
              0.35,
              0.30,
              0.25)

def arr2str(array,sep=' '):
    return string.join(map(str,array),sep)

n1 = len(layers[0])
n2 = len(layers)

Flow('layers',None,
     '''
     echo %s
     n1=%d n2=%d o1=0 d1=%g
     data_format=ascii_float in=$TARGET     
     ''' % (string.join(map(arr2str,layers),' '),
            n1,n2,xmax/(n1-1)))

d = 0.01

Flow('mod1','layers',
     '''
     spline o1=0 d1=%g n1=%d |
     unif2 d1=%g n1=%d v00=%s 
     ''' % (d,int(1.5+xmax/d),
            d,int(1.5+zmax/d),
            arr2str(velocities,','),))

Result('mod1',
       '''
       grey color=j title="Model 1" 
       screenratio=%g screenht=4
       allpos=y titlesz=8 labelsz=6
       label1="Depth (km)"
       label2="Distance (km)"
       ''' % (zmax/xmax))

End()

sfspline
sfunif2
sfgrey