Changeset 3248


Ignore:
Timestamp:
Jun 27, 2006, 6:16:24 PM (18 years ago)
Author:
sexton
Message:

small change

File:
1 edited

Legend:

Unmodified
Added
Removed
  • documentation/user_manual/examples/harbour.py

    r3247 r3248  
    2525harbour_length = 2000.0
    2626shelf_length = 10000.0
     27bottom_length = 10000.0
    2728harbour_width = 250.0
    2829shelf_depth = -100.
     
    3334#------------------------------------------------------------------------------
    3435
    35 centre = 340000.
    36 west = centre-harbour_length_shelf_length-10000.
    37 east = centre+10000.
    38 south = 6265000.
    39 north = 6250000.
     36west = 10000.+harbour_length+shelf_length+bottom_length
     37east = 0.
     38south = 0.
     39north = 5000.
    4040polygon = [[east,north],[west,north],[west,south],[east,south]]
    4141meshname = 'harbour_test.msh'
     
    113113def gauge_line(west,east,north,south):
    114114    from Numeric import arange
    115     gaugex = arange(west,east,1000.)
     115    gaugex = arange(east,west,-1000.)
    116116    gauges = []
     117    gaugey = []
    117118    for x in gaugex:
    118119        y = (north+south)/2.
     120        gaugey.append(y)
    119121        gauges.append([x,y])
    120     return gauges
     122    return gauges, gaugex, gaugey
    121123
    122 gauges = gauge_line(west,east,north,south)
     124gauges, gaugex, gaugey = gauge_line(west,east,north,south)
    123125
    124126from pyvolution.util import file_function
     
    130132                  use_cache = True)
    131133
    132 maxw = 0.0
    133 themaxw = maxw
    134 maxws = []
     134from pylab import plot, xlabel, ylabel, title, ion, close, savefig, figure
     135ion()
     136
     137maxw = []
     138minw = []
     139maxd = []
     140count = 0
    135141for k, g in enumerate(gauges):
     142    stage = []
     143    elevation = []
     144    depths = []
    136145    for i, t in enumerate(f.get_time()):
    137146        w = f(t, point_id = k)[0]
    138         elevation = f(t, point_id = k)[1]
    139         if w > maxw: maxw = w
    140     maxws.append(maxw)
    141     if themaxw < maxw:
    142         themaxw = maxw
    143         gaugeloc = k
     147        elev = f(t, point_id = k)[1]
     148        depth = w-elev
     149        stage.append(w)
     150        elevation.append(elev)
     151        depths.append(elev)
     152    maxw.append(max(stage))
     153    minw.append(min(stage))
     154    maxd.append(max(depths))
    144155
    145 from pylab import plot, xlabel, ylabel, title, ion, close, savefig
    146 ion()
    147 plot(gaugex,maxws,'g-',gaugestar[0],gaugestar[1],'r*')
     156filename = 'point'+str(waveheight)+'.csv'
     157fid = open(filename,'w')   
     158s = 'Waveheight,\n'
     159fid.write(s)
     160
     161figure(1)
     162plot(gaugex[:loc],maxw[:loc],'g-')
    148163xlabel('x')
    149164ylabel('stage')
    150165title('Maximum stage for gauge line')
    151 savefig('max_stage_harbour')
     166savefig('max_stage')
     167
    152168close('all')
Note: See TracChangeset for help on using the changeset viewer.