Changeset 5581
- Timestamp:
- Jul 28, 2008, 6:20:17 PM (16 years ago)
- Location:
- anuga_work/production/perth
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/perth/get_gauges.py
r5580 r5581 9 9 from anuga.utilities.numerical_tools import ensure_numeric 10 10 from Scientific.IO.NetCDF import NetCDFFile 11 12 11 13 12 def get_sts_gauge_data(filename,polygon,verbose=False): … … 31 30 #show() 32 31 32 33 33 basename='sts_gauge' 34 34 quantity_names=['stage','xmomentum','ymomentum'] … … 38 38 if inside_points is not None: 39 39 quantities[name] = take(quantities[name],indices,1) 40 for j in range(len(x)-1):41 locx=int(x[j])42 locy=int(y[j])43 fid_sts = open(project.boundaries_dir+sep+basename+'_'+str(locx)+'_'+str(locy)+'.csv', 'w')44 s = 'time, stage, xmomentum, ymomentum \n'45 fid_sts.write(s)46 stage = quantities[name][:,j]47 xmomentum = quantities[name][:,j]48 ymomentum = quantities[name][:,j]49 for k in range(len(time)-1):50 s = '%.2f, %.2f, %.2f, %.2f\n' %(time[k], stage[k], xmomentum[k], ymomentum[k])51 fid_sts.write(s)52 40 else: 53 41 msg = 'No gauges found inside polygon' 54 42 raise msg 55 fid_sts.close() 43 44 for j in range(len(x)-1): 45 locx=int(x[j]) 46 locy=int(y[j]) 47 fid_sts = open(project.boundaries_dir+sep+basename+'_'+str(locx)+'_'+str(locy)+'.csv', 'w') 48 s = 'time, stage, xmomentum, ymomentum \n' 49 fid_sts.write(s) 50 stage = quantities['stage'][:,j] 51 xmomentum = quantities['xmomentum'][:,j] 52 ymomentum = quantities['ymomentum'][:,j] 53 for k in range(len(time)-1): 54 s = '%.2f, %.2f, %.2f, %.2f\n' %(time[k], stage[k], xmomentum[k], ymomentum[k]) 55 fid_sts.write(s) 56 57 fid_sts.close() 58 56 59 fid.close() 57 60 58 61 return inside_points,quantities,elevation,time 59 62 … … 61 64 points,quantities,elevation,time=get_sts_gauge_data(os.path.join(project.boundaries_dir,project.scenario_name),polygon,verbose=False) 62 65 63 64 66 assert len(points)==len(elevation)==len(quantities['stage'][0,:]) -
anuga_work/production/perth/project.py
r5576 r5581 36 36 scenario = 'perth_tsunami_scenario' 37 37 38 tide = 0. 638 tide = 0.0 #0.6 39 39 40 40 alpha = 0.1
Note: See TracChangeset
for help on using the changeset viewer.