up [pdf]
from rsf.proj import *

def layer(output):
    return 'math n1=200 n2=100 d1=0.05 d2=0.05 output="%s" ' % output

Flow('one',None,layer('1.2'))
Flow('two',None,layer('2+x1*(0.1-0.014*x1)-0.1*x2'))
Flow('three',None,layer('3.3+0.1*x1-0.2*x2'))

Flow('struct','one two three','cat ${SOURCES[1:3]}')

Flow('l1',None,layer('0'))
Flow('l2',None,layer('sqrt((x1-5)^2+(x2-2.5)^2)'))
Flow('l3','l1','noise seed=2005 var=5 | smooth rect1=4 rect2=2')
Flow('l4','l2','noise seed=2006 var=5 | smooth rect1=4 rect2=4')

Flow('texture','l1 l2 l3 l4','cat ${SOURCES[1:4]}')

def grey3(bias=0,extra=''):
    return '''
    byte allpos=y clip=2.2 bias=%g %s |
    grey3 frame1=80 frame2=100 frame3=50 flat=n  point1=.7 point2=.7
    color=j wanttitle=n
    label1="Depth(km)" label2="X_Position(km)" label3="Y_Position(km)"
    ''' % (bias,extra)

Flow('const','struct','unif3 n1=200 d1=0.025 v00=0,0.5,1.2,2')
Result('const',grey3())

Flow('rand','struct texture','unif3 n1=200 d1=0.025 layers=${SOURCES[1]}')
Result('rand',grey3())

def gauss(a,d1,d2,d3):
    return '%g*exp(-0.5*sqrt((x1-%g)^2+(x2-%g)^2+(x3-%g)^2))' % \
           (a,d1,d2,d3)

Flow('gauss',None,
     '''
     math n1=200 n2=200 n3=100 d1=0.025 d2=0.05 d3=0.05
     output="1.5+%s-%s+%s"
     ''' % (gauss(0.2,1,2,1),gauss(0.5,3,8,3),gauss(0.3,4,4,4)))

Result('gauss',grey3())

Flow('model','const gauss','add ${SOURCES[1]}')

Result('model',grey3(1.5))

End()

sfmath
sfcat
sfnoise
sfsmooth
sfunif3
sfbyte
sfgrey3
sfadd