Changeset 3248
- Timestamp:
- Jun 27, 2006, 6:16:24 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
documentation/user_manual/examples/harbour.py
r3247 r3248 25 25 harbour_length = 2000.0 26 26 shelf_length = 10000.0 27 bottom_length = 10000.0 27 28 harbour_width = 250.0 28 29 shelf_depth = -100. … … 33 34 #------------------------------------------------------------------------------ 34 35 35 centre = 340000. 36 west = centre-harbour_length_shelf_length-10000. 37 east = centre+10000. 38 south = 6265000. 39 north = 6250000. 36 west = 10000.+harbour_length+shelf_length+bottom_length 37 east = 0. 38 south = 0. 39 north = 5000. 40 40 polygon = [[east,north],[west,north],[west,south],[east,south]] 41 41 meshname = 'harbour_test.msh' … … 113 113 def gauge_line(west,east,north,south): 114 114 from Numeric import arange 115 gaugex = arange( west,east,1000.)115 gaugex = arange(east,west,-1000.) 116 116 gauges = [] 117 gaugey = [] 117 118 for x in gaugex: 118 119 y = (north+south)/2. 120 gaugey.append(y) 119 121 gauges.append([x,y]) 120 return gauges 122 return gauges, gaugex, gaugey 121 123 122 gauges = gauge_line(west,east,north,south)124 gauges, gaugex, gaugey = gauge_line(west,east,north,south) 123 125 124 126 from pyvolution.util import file_function … … 130 132 use_cache = True) 131 133 132 maxw = 0.0 133 themaxw = maxw 134 maxws = [] 134 from pylab import plot, xlabel, ylabel, title, ion, close, savefig, figure 135 ion() 136 137 maxw = [] 138 minw = [] 139 maxd = [] 140 count = 0 135 141 for k, g in enumerate(gauges): 142 stage = [] 143 elevation = [] 144 depths = [] 136 145 for i, t in enumerate(f.get_time()): 137 146 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)) 144 155 145 from pylab import plot, xlabel, ylabel, title, ion, close, savefig 146 ion() 147 plot(gaugex,maxws,'g-',gaugestar[0],gaugestar[1],'r*') 156 filename = 'point'+str(waveheight)+'.csv' 157 fid = open(filename,'w') 158 s = 'Waveheight,\n' 159 fid.write(s) 160 161 figure(1) 162 plot(gaugex[:loc],maxw[:loc],'g-') 148 163 xlabel('x') 149 164 ylabel('stage') 150 165 title('Maximum stage for gauge line') 151 savefig('max_stage_harbour') 166 savefig('max_stage') 167 152 168 close('all')
Note: See TracChangeset
for help on using the changeset viewer.