Changeset 2469
- Timestamp:
- Mar 3, 2006, 9:52:00 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/sydney_2006/get_timeseries.py
r2406 r2469 9 9 from matplotlib.ticker import MultipleLocator, FormatStrFormatter 10 10 11 swwfile = project.outputname2 + '.sww' 11 swwfile = project.outputname + '.sww' 12 13 12 14 13 15 #Time interval to plot … … 38 40 gauges, lines, locations = get_gauges_from_file(project.gauge_filename) 39 41 42 print 'number of gauges for Benfield: ', len(gauges) 43 40 44 #Read model output 41 45 quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum'] … … 63 67 ymom = [] 64 68 bearings = [] 69 depths = [] 65 70 66 71 max_depth = 0 … … 79 84 uh = f(t, point_id = k)[2] 80 85 vh = f(t, point_id = k)[3] 81 #myloc = locations[k] 86 myloc = locations[k] 87 depth = w-z 82 88 83 89 m = sqrt(uh*uh + vh*vh) #Absolute momentum 84 90 vel = sqrt(uh*uh + vh*vh) / (w-z + 1.e-30) #Absolute velocity 85 91 angle = degrees(atan(vh/(uh+1.e-15))) 86 print 'angle', angle87 92 if (0 < angle < 90.0): 88 93 if vh > 0: … … 106 111 ymom.append(vh) 107 112 bearings.append(bearing) 113 depths.append(depth) 108 114 109 115 if w-z > max_depth: … … 113 119 if vel > max_velocity: 114 120 max_velocity = vel 115 print 'max speed', max_velocity116 121 117 122 #Plot only those gauges that have been inundated by more than a threshold … … 128 133 plot(model_time, stages, '-b', 129 134 model_time, elevations, '-k') 130 name = 'Gauge_%d: (%.1f, %.1f)' %(k, g[0], g[1])131 #name = 'Gauge_%d: (%.1f, %.1f) Location: %s' %(k, g[0], g[1], myloc)135 #name = 'Gauge_%d: (%.1f, %.1f)' %(k, g[0], g[1]) 136 name = 'Gauge_%d: (%.1f, %.1f) Location: %s' %(k, g[0], g[1], myloc) 132 137 title(name) 133 138 … … 138 143 shadow=True, 139 144 loc='upper right') 140 savefig('Gauge_%d_stage' %k) # savefig('Gauge_%s_stage' %myloc) 141 142 raw_input('Next') 143 144 #X Momentum plot 145 ion() 146 hold(False) 147 plot(model_time, xmom, '-r') 148 title(name) 149 150 title('%s (x momentum)' %name) 151 xlabel('time [s]') 152 ylabel('uh [m^2/s]') 153 savefig('Gauge_%d_xmomentum' %k) 154 #savefig('Gauge_%s_momentum' %myloc) 155 156 raw_input('Next') 157 158 #y Momentum plot 159 ion() 160 hold(False) 161 plot(model_time, ymom, '-r') 162 title(name) 163 164 title('%s (y momentum)' %name) 165 xlabel('time [s]') 166 ylabel('vh [m^2/s]') 167 savefig('Gauge_%d_ymomentum' %k) 168 #savefig('Gauge_%s_momentum' %myloc) 169 170 raw_input('Next') 145 #savefig('Gauge_%d_stage' %k) 146 savefig('Gauge_%s_stage' %myloc) 147 148 # raw_input('Next') 171 149 172 150 #Momentum plot … … 179 157 xlabel('time [s]') 180 158 ylabel('sqrt( uh^2 + vh^2 ) [m^2/s]') 181 savefig('Gauge_%d_momentum' %k)182 #savefig('Gauge_%s_momentum' %myloc)183 184 raw_input('Next')159 #savefig('Gauge_%d_momentum' %k) 160 savefig('Gauge_%s_momentum' %myloc) 161 162 # raw_input('Next') 185 163 186 164 #Bearing plot … … 193 171 text(maxT+tstep, 90, 'East') 194 172 text(maxT+tstep, 270, 'West') 195 majorLocator = MultipleLocator(45)173 #majorLocator = MultipleLocator(3600) 196 174 #print 'major', majorLocator[1] 197 #ax. yaxis.set_major_locator(majorLocator) #'yticklabels', range(30,390,30))175 #ax.xaxis.set_major_locator(majorLocator) #'yticklabels', range(30,390,30)) 198 176 # set(labels,color='g',rotation=45) 199 177 … … 201 179 xlabel('time [s]') 202 180 ylabel(' atan(vh/uh) [degrees from North]') 203 savefig('Gauge_%d_bearing' %k)204 #savefig('Gauge_%s_bearing' %myloc)205 206 raw_input('Next')181 #savefig('Gauge_%d_bearing' %k) 182 savefig('Gauge_%s_bearing' %myloc) 183 184 # raw_input('Next') 207 185 208 186 #Speed plot … … 215 193 xlabel('time [s]') 216 194 ylabel('sqrt( uh^2 + vh^2 ) / depth [m/s]') 217 savefig('Gauge_%d_speed' %k) 218 #savefig('Gauge_%s_speed' %myloc) 219 220 raw_input('Next') 221 222 195 #savefig('Gauge_%d_speed' %k) 196 savefig('Gauge_%s_speed' %myloc) 197 198 # raw_input('Next') 199 200 whichone = '_%s' %myloc 201 thisfile = project.gaugetimeseries+whichone+'.csv' 202 fid = open(thisfile, 'w') 203 s = 'Time, Depth, Momentum, Velocity \n' 204 fid.write(s) 205 for i_t, i_d, i_m, i_vel in zip(model_time, depths, momenta, velocity): 206 s = '%.2f, %.2f, %.2f, %.2f\n' %(i_t, i_d, i_m, i_vel) 207 fid.write(s) 208 223 209 show() 224 210 211
Note: See TracChangeset
for help on using the changeset viewer.