Changeset 1921
- Timestamp:
- Oct 14, 2005, 11:49:24 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
production/karratha_2005/get_timeseries.py
r1901 r1921 7 7 8 8 #swwfile = project.outputdir + project.basename + '.sww' 9 swwfile = project.outputname + '_0.0tide' + '.sww' 9 #swwfile = project.outputname + '_0.0tide' + '.sww' 10 swwfile = project.outputname + '.sww' 11 #swwfile = project.outputname + '_0.0tide_notsunami.sww' 10 12 #swwfile = project.outputdir + 'karratha_100m_12m.sww' 11 13 12 14 #MOST Boundary directly north of Legendre island 13 y= project.north14 x = (project.p3[1] + project.p4[1])/2 #?????// 15 z, easting, northing = redfearn( y, x)15 lat = project.north 16 lon = (project.p3[1] + project.p4[1])/2 17 z, easting, northing = redfearn(lat, lon) 16 18 17 19 18 20 #From Neil 19 gauges = [[easting, northing - 10], 21 gauges = [[easting, northing - 5], 22 [easting, northing - 10], 23 [easting, northing - 20], 24 [easting, northing - 30], 25 [easting, northing - 50], 26 [easting, northing - 100], 20 27 [470882, 7717952], 21 28 [469390, 7715426], … … 25 32 [470285, 7717470]] 26 33 27 28 29 #gauge_names = ['MOST',30 # 'Gauge_1', 'Gauge_2', 'Gauge_3',31 # 'Gauge_4', 'Gauge_5', 'Gauge_6']32 33 34 34 35 #Read model output … … 40 41 41 42 f = cache(file_function, swwfile, 42 {'quantities': 'stage',43 {'quantities': ['stage', 'elevation', 'xmomentum', 'ymomentum'], 43 44 'interpolation_points': gauges, 44 45 'verbose': True}, … … 51 52 52 53 54 from math import sqrt 55 for k, g in enumerate(gauges): 53 56 54 for k, g in enumerate(gauges): 55 model_values = [] 57 stages = [] 58 elevations = [] 59 momenta = [] 60 56 61 for i, t in enumerate(f.T): 57 val = f(t, point_id = k)[0] 58 model_values.append(val) 62 w = f(t, point_id = k)[0] 63 z = f(t, point_id = k)[1] 64 uh = f(t, point_id = k)[2] 65 vh = f(t, point_id = k)[3] 66 67 stages.append(w) 68 elevations.append(z) #Should be constant over time 69 momenta.append( sqrt(uh*uh + vh*vh) ) #Absolute momentum 59 70 60 71 from pylab import * 72 61 73 ion() 62 74 hold(False) 63 plot(model_time, model_values, '-b') 64 name = 'Gauge_%d: %s' %(k, str(g)) 75 76 if elevations[0] < -10: 77 plot(model_time, stages, '-b') 78 else: 79 plot(model_time, stages, '-b', 80 model_time, elevations, '-k') 81 name = 'Gauge_%d: (%.1f, %.1f)' %(k, g[0], g[1]) 65 82 title(name) 66 67 savefig('Gauge_%d' %k) 83 84 title('%s (stage)' %name) 85 xlabel('time [s]') 86 ylabel('elevation [m]') 87 legend(('Stage', 'Bed = %.1f' %elevations[0]), 88 shadow=True, 89 loc='upper right') 90 savefig('Gauge_%d_stage' %k) 68 91 69 92 raw_input('Next') 93 94 95 #Momentum plot 96 ion() 97 hold(False) 98 plot(model_time, momenta, '-r') 99 title(name) 100 101 title('%s (momentum)' %name) 102 xlabel('time [s]') 103 ylabel('sqrt( uh^2 + vh^2 ) [m^2/s]') 104 savefig('Gauge_%d_momentum' %k) 105 106 raw_input('Next') 107 108 109 70 110 show() 71 111
Note: See TracChangeset
for help on using the changeset viewer.