Changeset 2083
- Timestamp:
- Nov 28, 2005, 7:17:33 PM (19 years ago)
- Location:
- production/karratha_2005
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/karratha_2005/get_timeseries.py
r2069 r2083 1 1 """Read in sww file, interpolate at specified locations and plot time series 2 Additionally, store augmented building database with max inundation depths 2 3 3 """ 4 4 … … 9 9 10 10 11 plot = False12 11 13 12 swwfile = project.outputname + '.sww' … … 41 40 gauges, buildings = get_gauges_from_file(project.gauge_filename) 42 41 42 gauges = [[easting, northing-10]] 43 44 43 45 #Read model output 44 46 quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum'] … … 50 52 51 53 52 buildings[0] = buildings[0].strip() +\53 ',MAX INUNDATION DEPTH (m)' +\54 ',MAX MOMENTUM (m^2/s)\n'55 54 56 55 from math import sqrt … … 68 67 max_momentum = 0 69 68 for i, t in enumerate(f.T): 69 #if tmin < t < tmax: 70 70 w = f(t, point_id = k)[0] 71 71 z = f(t, point_id = k)[1] … … 85 85 max_momentum = m 86 86 87 #Augment building data88 buildings[k+1] = buildings[k+1].strip() +\89 ',%f' %max_depth +\90 ',%f\n' %max_momentum91 87 92 #print buildings[k]93 94 if plot is True:95 #Plot only those gauges that have been inundated by more than a threshold96 if max_depth < 0.2:97 print 'Skipping gauge %d' %k98 continue99 88 100 #FIXME Reduce to tmin and tmax 101 #i0 = model_timefind 102 103 ion() 104 hold(False) 89 #Plot only those gauges that have been inundated by more than a threshold 90 #if max_depth < 0.2: 91 # print 'Skipping gauge %d' %k 92 # continue 105 93 106 if elevations[0] < -10: 107 plot(model_time, stages, '-b') 108 else: 109 plot(model_time, stages, '-b', 110 model_time, elevations, '-k') 111 name = 'Gauge_%d: (%.1f, %.1f)' %(k, g[0], g[1]) 112 title(name) 94 ion() 95 hold(False) 113 96 114 title('%s (stage)' %name)115 xlabel('time [s]')116 ylabel('elevation [m]')117 legend(('Stage', 'Bed = %.1f' %elevations[0]),118 shadow=True,119 loc='upper right')120 savefig('Gauge_%d_stage' %k)97 if elevations[0] < -10: 98 plot(model_time, stages, '-b') 99 else: 100 plot(model_time, stages, '-b', 101 model_time, elevations, '-k') 102 name = 'Gauge_%d: (%.1f, %.1f)' %(k, g[0], g[1]) 103 title(name) 121 104 122 raw_input('Next') 105 title('%s (stage)' %name) 106 xlabel('time [s]') 107 ylabel('elevation [m]') 108 legend(('Stage', 'Bed = %.1f' %elevations[0]), 109 shadow=True, 110 loc='upper right') 111 savefig('Gauge_%d_stage' %k) 112 113 raw_input('Next') 123 114 124 115 125 126 127 128 129 116 #Momentum plot 117 ion() 118 hold(False) 119 plot(model_time, momenta, '-r') 120 title(name) 130 121 131 132 133 134 135 136 122 title('%s (momentum)' %name) 123 xlabel('time [s]') 124 ylabel('sqrt( uh^2 + vh^2 ) [m^2/s]') 125 savefig('Gauge_%d_momentum' %k) 126 127 raw_input('Next') 137 128 138 129 139 #Store new building file with mak depths added 130 show() 140 131 141 FN = 'inundation_augmented_' + project.gauge_filename142 fid = open(FN, 'w')143 for line in buildings:144 fid.write(line)145 fid.close()146 147 148 if plot is True:149 show()150
Note: See TracChangeset
for help on using the changeset viewer.