Method for creating animation of s.surf.rst calculation

    
    
    # Start interpolation on another machine
    # s.surf.rst stp_bathy elev=watch02 tens=20.0 \
    #            smooth=0.3 mask=mask.6 tree=watch02.tree
    
    # Link new file created in .tmp/machine_name to $LOCATION/cell/watch2
    # also create a $LOCATION/cellhd/watch2 file containing the current window,
    #            plus the lines:
    #  format:     3
    #  compressed: 0
    
    # OPTIONAL d.rast slows it down a little
    # OPTIONAL add "sleep xx" for longer computations
    set t = 1
    while ( 1 )
        d.rast watch2
        r.out.ppm watch2 out=$t.ppm
        @ t++
    end
    
    # fix numbers in names to use preceding zeros
    # \ls ?.ppm ??.ppm | \
    # awk -F"." ' { printf "mv %s %03d.ppm\n", $0, $1 } ' > dofix
    # sh dofix
    
    # Now import each ppm, use it as a mask to capture interpolation
    # results (watch02) at that step, draw the result to a D_cell and overlay
    # the vector treefile, export as ppm.
    # cellhd2 is header file to shift imported ppm to current window
    # so that it aligns with the treefile
    rm -f tmp.ppm
    foreach i (*.ppm)
        g.region rast=watch02
        imflip -yf $i tmp.ppm
        r.in.ppm tmp.ppm out=tmp.ppm
        cp cellhd2 $LOCATION/cellhd/tmp.ppm
        r.null tmp.ppm null=5
        r.mapcalc watch.tmp="if(tmp.ppm==5,watch02,tmp.ppm)"
        cp $LOCATION/colr/WATCH $LOCATION/colr/watch.tmp
        d.mon start=CELL
        d.erase aqua
        d.rast watch.tmp
        d.vect watch02.tree co=brown
        d.mon stop=CELL
        g.region rast=D_cell
        r.out.ppm D_cell out=cell.$i
    end
    
    # OPTIONAL: might also need to remove some window border, e.g.
    # imcopy $i -xposition 86 -xsize 466 n.$i.rgb
    foreach i (cell.*.ppm)
        imconv $i $i.rgb
        gzip $i
        echo $i
    end
    
    rgb2gifanim watch cell.*.rgb