Changeset 6368
- Timestamp:
- Feb 19, 2009, 12:06:56 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/busselton/standardised_version/run_model.py
r6343 r6368 37 37 from anuga.interface import create_sts_boundary 38 38 from anuga.interface import csv2building_polygons 39 <<<<<<< .mine40 =======41 39 from file_length import file_length 42 40 43 >>>>>>> .r634144 41 from anuga.shallow_water.data_manager import start_screen_catcher 45 42 from anuga.shallow_water.data_manager import copy_code_files … … 50 47 from setup_model import project 51 48 52 53 #-------------------------------------------------------------------------------54 # Get gauges (timeseries of index points)55 #-------------------------------------------------------------------------------56 def get_sts_gauge_data(filename, verbose=False):57 fid = NetCDFFile(filename+'.sts', 'r') #Open existing file for read58 permutation = fid.variables['permutation'][:]59 x = fid.variables['x'][:] + fid.xllcorner #x-coordinates of vertices60 y = fid.variables['y'][:] + fid.yllcorner #y-coordinates of vertices61 points = num.transpose(num.asarray([x.tolist(), y.tolist()]))62 time = fid.variables['time'][:] + fid.starttime63 elevation = fid.variables['elevation'][:]64 65 basename = 'sts_gauge'66 quantity_names = ['stage', 'xmomentum', 'ymomentum']67 quantities = {}68 for i, name in enumerate(quantity_names):69 quantities[name] = fid.variables[name][:]70 71 #---------------------------------------------------------------------------72 # Get maximum wave height throughout timeseries at each index point73 #---------------------------------------------------------------------------74 75 maxname = 'max_sts_stage.csv'76 fid_max = open(os.path.join(project.event_sts, maxname), 'w')77 fid_max.write('index, x, y, max_stage \n')78 for j in range(len(x)):79 index = permutation[j]80 stage = quantities['stage'][:,j]81 xmomentum = quantities['xmomentum'][:,j]82 ymomentum = quantities['ymomentum'][:,j]83 84 fid_max.write('%d, %.6f, %.6f, %.6f\n' % (index, x[j], y[j], max(stage)))85 86 #---------------------------------------------------------------------------87 # Get minimum wave height throughout timeseries at each index point88 #---------------------------------------------------------------------------89 90 minname = 'min_sts_stage.csv'91 fid_min = open(os.path.join(project.event_sts, minname), 'w')92 fid_min.write('index, x, y, max_stage \n')93 for j in range(len(x)):94 index = permutation[j]95 stage = quantities['stage'][:,j]96 xmomentum = quantities['xmomentum'][:,j]97 ymomentum = quantities['ymomentum'][:,j]98 99 fid_min.write('%d, %.6f, %.6f, %.6f\n' %(index, x[j], y[j], min(stage)))100 101 out_file = os.path.join(project.event_sts,102 basename+'_'+str(index)+'.csv')103 fid_sts = open(out_file, 'w')104 fid_sts.write('time, stage, xmomentum, ymomentum \n')105 106 #-----------------------------------------------------------------------107 # End of the get gauges108 #-----------------------------------------------------------------------109 for k in range(len(time)-1):110 fid_sts.write('%.6f, %.6f, %.6f, %.6f\n'111 % (time[k], stage[k], xmomentum[k], ymomentum[k]))112 113 fid_sts.close()114 115 fid.close()116 117 return quantities,elevation,time118 49 119 50 … … 226 157 227 158 # Create the STS file 228 <<<<<<< .mine229 build_urs_boundary(project.mux_data_folder,230 project.mux_input,231 os.path.join(project.event_folder,232 project.scenario_name))233 =======234 159 print 'project.mux_data_folder=%s' % project.mux_data_folder 235 160 bub.build_urs_boundary(project.mux_input_filename, 236 161 os.path.join(project.event_folder, 237 162 project.scenario_name)) 238 >>>>>>> .r6341239 163 240 164 # Read in boundary from ordered sts file
Note: See TracChangeset
for help on using the changeset viewer.