Changeset 6261
- Timestamp:
- Feb 3, 2009, 11:51:59 AM (16 years ago)
- Location:
- anuga_work/production/busselton/standardised_version
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/busselton/standardised_version/build_busselton.py
r6254 r6261 14 14 15 15 # Standard modules 16 from os import sep 17 from os.path import dirname, basename 16 from os.path import dirname 18 17 from os import mkdir, access, F_OK 19 from shutil import copy20 import time21 import sys22 18 23 19 # Related major packages … … 35 31 #------------------------------------------------------------------------------ 36 32 37 copy_code_files(project.output_build_time_dir,__file__, 38 dirname(project.__file__)+sep+ project.__name__+'.py' ) 33 #copy_code_files(project.output_build_time_dir,__file__, 34 # dirname(project.__file__)+os.sep+ project.__name__+'.py' ) 35 #start_screen_catcher(project.output_build_time_dir) 39 36 40 start_screen_catcher(project.output_build_time_dir)41 42 print 'USER: ', project.user43 37 44 38 #------------------------------------------------------------------------------- … … 50 44 #------------------------------------------------------------------------------- 51 45 52 # FIXME(Ole): Here's the Shark Bay way. 46 print 'project.poly_all', project.poly_all 47 print 'project.combined_dir_name', project.combined_dir_name 53 48 54 ## FIXME (Ole): Clip data by interior regions if possible 49 # input elevation directory filenames 50 #onshore_in_dir_name = project.onshore_in_dir_name 51 #coast_in_dir_name = project.coast_in_dir_name 52 #coast_in_dir_name1 = project.coast_in_dir_name1 53 #offshore_in_dir_name = project.offshore_in_dir_name 54 #offshore_in_dir_name1 = project.offshore_in_dir_name1 55 #offshore_in_dir_name2 = project.offshore_in_dir_name2 56 #offshore_in_dir_name3 = project.offshore_in_dir_name3 57 #offshore_in_dir_name4 = project.offshore_in_dir_name4 58 #offshore_in_dir_name5 = project.offshore_in_dir_name5 59 60 # output elevation directory filenames 61 #onshore_dir_name = project.onshore_dir_name 62 #coast_dir_name = project.coast_dir_name 63 #coast_dir_name1 = project.coast_dir_name1 64 #offshore_dir_name = project.offshore_dir_name 65 #offshore_dir_name1 = project.offshore_dir_name1 66 #offshore_dir_name2 = project.offshore_dir_name2 67 #offshore_dir_name3 = project.offshore_dir_name3 68 #offshore_dir_name4 = project.offshore_dir_name4 69 #offshore_dir_name5 = project.offshore_dir_name5 70 71 72 # Create Geospatial data from ASCII files 73 geospatial_data = {} 74 for filename in project.ascii_grid_filenames: 75 absolute_filename = project.topographies_in_dir + filename 76 convert_dem_from_ascii2netcdf(absolute_filename, 77 basename_out=absolute_filename, 78 use_cache=True, 79 verbose=True) 80 dem2pts(absolute_filename, use_cache=True, verbose=True) 81 82 geospatial_data[filename] = Geospatial_data(file_name=absolute_filename+'.pts', 83 verbose=True) 84 85 # Create Geospatial data from TXT files 86 for filename in project.point_filenames: 87 absolute_filename = project.topographies_in_dir + filename 88 geospatial_data[filename] = Geospatial_data(file_name=absolute_filename, 89 verbose=True) 90 91 92 #print "creates DEMs from asc data" 93 #print onshore_in_dir_name, onshore_dir_name 94 #print offshore_in_dir_name5, offshore_dir_name5 55 95 # 56 #print 'creating geospatial data objects from asc data (via dem and pts formats)' 57 #for filename in project.ascii_grid_filenames: 58 # convert_dem_from_ascii2netcdf(filename, 59 # basename_out=filename, 60 # use_cache=True, verbose=True) 61 # dem2pts(filename, use_cache=True, verbose=True)# 96 #convert_dem_from_ascii2netcdf(onshore_in_dir_name, basename_out=onshore_dir_name, use_cache=True, verbose=True) 62 97 # 63 # geospatial_data += Geospatial_data(file_name=filename + '.pts', 64 # verbose=True) 98 #convert_dem_from_ascii2netcdf(offshore_in_dir_name5, basename_out=offshore_dir_name5, use_cache=True, verbose=True)# 65 99 ## 66 100 # 67 #print 'creating geospatial data objects from txt data'68 #for filename in project.point_filenames:69 # geospatial_data += Geospatial_data(file_name=filename + '.txt',70 # verbose=True)71 #72 #73 #print 'clip combined geospatial object by bounding polygon'74 #G = geospatial_data.clip(project.bounding_polygon)75 #76 #77 #print 'export combined geospatial data'78 #if access(project.topographies_dir, F_OK) == 0:79 # mkdir (project.topographies_dir)80 #G.export_points_file(project.combined_dir_name + '.pts')81 82 83 84 print "project.poly_all", project.poly_all85 print "project.combined_dir_name", project.combined_dir_name86 87 # input elevation directory filenames88 onshore_in_dir_name = project.onshore_in_dir_name89 coast_in_dir_name = project.coast_in_dir_name90 coast_in_dir_name1 = project.coast_in_dir_name191 offshore_in_dir_name = project.offshore_in_dir_name92 offshore_in_dir_name1 = project.offshore_in_dir_name193 offshore_in_dir_name2 = project.offshore_in_dir_name294 offshore_in_dir_name3 = project.offshore_in_dir_name395 offshore_in_dir_name4 = project.offshore_in_dir_name496 offshore_in_dir_name5 = project.offshore_in_dir_name597 98 # output elevation directory filenames99 onshore_dir_name = project.onshore_dir_name100 coast_dir_name = project.coast_dir_name101 coast_dir_name1 = project.coast_dir_name1102 offshore_dir_name = project.offshore_dir_name103 offshore_dir_name1 = project.offshore_dir_name1104 offshore_dir_name2 = project.offshore_dir_name2105 offshore_dir_name3 = project.offshore_dir_name3106 offshore_dir_name4 = project.offshore_dir_name4107 offshore_dir_name5 = project.offshore_dir_name5108 # creates DEM from asc data109 print "creates DEMs from asc data"110 convert_dem_from_ascii2netcdf(onshore_in_dir_name, basename_out=onshore_dir_name, use_cache=True, verbose=True)111 convert_dem_from_ascii2netcdf(offshore_in_dir_name5, basename_out=offshore_dir_name5, use_cache=True, verbose=True)112 113 101 # creates pts file for onshore DEM 114 print "creates pts file for onshore DEM"115 dem2pts(onshore_dir_name ,use_cache=True,verbose=True)116 dem2pts(offshore_dir_name5 ,use_cache=True,verbose=True)102 #print "creates pts file for onshore DEM" 103 #dem2pts(onshore_dir_name ,use_cache=True,verbose=True) 104 #dem2pts(offshore_dir_name5 ,use_cache=True,verbose=True) 117 105 118 106 # create onshore pts files 119 print'create Geospatial data1 objects from topographies'120 G1 = Geospatial_data(file_name = onshore_dir_name + '.pts')107 #print'create Geospatial data1 objects from topographies' 108 #G1 = Geospatial_data(file_name = onshore_dir_name + '.pts') 121 109 122 110 # create coastal and offshore pts files 123 print'create Geospatial data2 objects from topographies'124 G2 = Geospatial_data(file_name = coast_in_dir_name)125 print'create Geospatial data3 objects from topographies'126 G3 = Geospatial_data(file_name = coast_in_dir_name1)127 print'create Geospatial data4 objects from topographies'128 G_off = Geospatial_data(file_name = offshore_in_dir_name)129 print'create Geospatial data5 objects from topographies'130 G_off1 = Geospatial_data(file_name = offshore_in_dir_name1)131 print'create Geospatial data6 objects from topographies'132 G_off2 = Geospatial_data(file_name = offshore_in_dir_name2)133 print'create Geospatial data7 objects from topographies'134 G_off3 = Geospatial_data(file_name = offshore_in_dir_name3)135 print'create Geospatial data8 objects from topographies'136 G_off4 = Geospatial_data(file_name = offshore_in_dir_name4)137 print'create Geospatial data9 objects from topographies'138 G_off5 = Geospatial_data(file_name = offshore_dir_name5 + '.pts')111 #print'create Geospatial data2 objects from topographies' 112 #G2 = Geospatial_data(file_name = coast_in_dir_name) 113 #print'create Geospatial data3 objects from topographies' 114 #G3 = Geospatial_data(file_name = coast_in_dir_name1) 115 #print'create Geospatial data4 objects from topographies' 116 #G_off = Geospatial_data(file_name = offshore_in_dir_name) 117 #print'create Geospatial data5 objects from topographies' 118 #G_off1 = Geospatial_data(file_name = offshore_in_dir_name1) 119 #print'create Geospatial data6 objects from topographies' 120 #G_off2 = Geospatial_data(file_name = offshore_in_dir_name2) 121 #print'create Geospatial data7 objects from topographies' 122 #G_off3 = Geospatial_data(file_name = offshore_in_dir_name3) 123 #print'create Geospatial data8 objects from topographies' 124 #G_off4 = Geospatial_data(file_name = offshore_in_dir_name4) 125 #print'create Geospatial data9 objects from topographies' 126 #G_off5 = Geospatial_data(file_name = offshore_dir_name5 + '.pts') 139 127 140 128 … … 143 131 #------------------------------------------------------------------------------- 144 132 145 print'add all geospatial objects'146 G = G1 + G2 + G3 + G_off + G_off1 + G_off2 + G_off3 + G_off4133 #print'add all geospatial objects' 134 #G = G1 + G2 + G3 + G_off + G_off1 + G_off2 + G_off3 + G_off4 147 135 148 print'clip combined geospatial object by bounding polygon' 136 print 'Add geospatial objects except', project.offshore_name5 137 print geospatial_data.keys() 138 G = None 139 for key in geospatial_data: 140 if key != project.offshore_name5: 141 G += geospatial_data[key] 142 143 print 'Clip (outside) combined geospatial object except %s by area of interest.' 149 144 G_clip = G.clip_outside(project.poly_aoi1) 150 G_all = G_clip + G_off5 145 146 print 'Clip combined geospatial object by bounding polygon' 147 G_all = G_clip + geospatial_data[project.offshore_name5] # G_off5 151 148 G_clipped = G_all.clip(project.poly_all) 152 149 153 print 'export combined DEM file'154 if access(project.topographies_dir,F_OK) == 0:155 mkdir (project.topographies_dir)150 print 'Export combined DEM file' 151 #if access(project.topographies_dir,F_OK) == 0: 152 # mkdir (project.topographies_dir) 156 153 G_clipped.export_points_file(project.combined_dir_name + '.pts') 157 G_clipped.export_points_file(project.combined_dir_name + '.txt') #Use for comparision in ARC 154 print 'Do txt version too' 155 G_clipped.export_points_file(project.combined_dir_name + '.txt') # Use for comparision in ARC 158 156 -
anuga_work/production/busselton/standardised_version/project.py
r6256 r6261 6 6 #------------------------------------------------------------------------------ 7 7 8 import os 8 9 from os import sep, environ, getenv, getcwd 9 10 from os.path import expanduser … … 52 53 finaltime=80000 # final time for simulation 53 54 54 setup=' final' # Final can be replaced with trial or basic.55 setup='trial' # Final can be replaced with trial or basic. 55 56 # Either will result in a coarser mesh that will allow a 56 57 # faster, but less accurate, simulation. … … 58 59 if setup =='trial': 59 60 print'trial' 60 res_factor=10 61 time_thinning= 4861 res_factor=100 62 time_thinning=96 62 63 yieldstep=240 63 64 if setup =='basic': … … 102 103 #------------------------------------------------------------------------------ 103 104 104 # FIXME(Ole): Use lists of elevation data files as in Shark Bay study:105 ## elevation data filenames106 #ascii_grid_filenames = ['10m_dem_without_survey', '50m_dem_without_10m_dem',107 # 'bathysteeppt', 'bathyleft', 'bathyright']108 #point_filenames = ['field_survey_north', 'field_survey_south',109 # 'clipped_bathymetry_final', 'coast_points_final']110 111 112 105 113 106 # elevation data used in build_busselton.py … … 140 133 landward = 'landward_bounding_polygon.csv' 141 134 135 142 136 #------------------------------------------------------------------------------ 143 137 # Output Elevation Data … … 164 158 # Location of input and output data 165 159 #------------------------------------------------------------------------------ 166 # where the input data sits 167 onshore_in_dir_name = topographies_in_dir + onshore_name #topo 168 coast_in_dir_name = topographies_in_dir + coast_name #coastline 169 coast_in_dir_name1 = topographies_in_dir + coast_name1 #beach survey 170 offshore_in_dir_name = topographies_in_dir + offshore_name #bathymetry 171 offshore_in_dir_name1 = topographies_in_dir + offshore_name1 #bathymetry Charts 172 offshore_in_dir_name2 = topographies_in_dir + offshore_name2 #Digitised Fairsheet 173 offshore_in_dir_name3 = topographies_in_dir + offshore_name3 #250m 174 offshore_in_dir_name4 = topographies_in_dir + offshore_name4 #Bunbury DPI 175 offshore_in_dir_name5 = topographies_in_dir + offshore_name5 #Busselton Topo 176 177 # where the output data sits 178 onshore_dir_name = topographies_dir + onshore_name 179 180 coast_dir_name = topographies_dir + coast_name 181 coast_dir_name1 = topographies_dir + coast_name1 182 183 offshore_dir_name = topographies_dir + offshore_name 184 offshore_dir_name1 = topographies_dir + offshore_name1 185 offshore_dir_name2 = topographies_dir + offshore_name2 186 offshore_dir_name3 = topographies_dir + offshore_name3 187 offshore_dir_name4 = topographies_dir + offshore_name4 188 offshore_dir_name5 = topographies_dir + offshore_name5 189 190 # where the combined elevation file sits 160 161 ascii_grid_filenames = [onshore_name, # Topo 162 offshore_name5] # Busselton Topo 163 164 point_filenames = [coast_name, # Coastline 165 coast_name1, # Beach survey 166 offshore_name, # Bathymetry 167 offshore_name1, # Bathymetry Charts 168 offshore_name2, # Digitised Fairsheet 169 offshore_name3, # 250m 170 offshore_name4] # Bunbury DPI 171 172 173 # Where the combined elevation file sits 191 174 combined_dir_name = topographies_dir + combined_name 192 175 combined_smaller_name_dir = topographies_dir + combined_smaller_name 193 176 194 # where the mesh sits (this is created during the run_busselton.py)177 # Where the mesh sits (this is created during the run_busselton.py) 195 178 meshes_dir_name = meshes_dir + scenario_name+'.msh' 196 179 197 # where the boundary ordering files sit (this is used within build_boundary.py)180 # Where the boundary ordering files sit (this is used within build_boundary.py) 198 181 order_filename_dir = boundaries_dir + order_filename 199 182 200 # where the landward points of boundary extent sit (this is used within run_busselton.py)183 # Where the landward points of boundary extent sit (this is used within run_busselton.py) 201 184 landward_dir = boundaries_dir + landward 202 185 203 # where the event sts files sits (this is created during the build_boundary.py)186 # Where the event sts files sits (this is created during the build_boundary.py) 204 187 boundaries_dir_event = boundaries_dir + str(event_number) + sep 205 188 boundaries_dir_mux = muxhome 206 207 # where the directory of the output filename sits 189 urs_boundary_name = os.path.join(boundaries_dir_event, 190 scenario_name) 191 192 193 # Where the directory of the output filename sits 208 194 output_build_time_dir = output_dir+build_time+dir_comment+sep #used for build_busselton.py 209 195 output_run_time_dir = output_dir+run_time+dir_comment+sep #used for run_busselton.py 210 196 output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing 211 197 212 # where the directory of the gauges sit198 # Where the directory of the gauges sit 213 199 gauges_dir_name = gauges_dir + gauge_name #used for get_timeseries.py 214 200 building_in_dir_name = gauges_dir + building + '.csv' #used for run_building_inundation.py … … 218 204 #------------------------------------------------------------------------------ 219 205 220 # Land, to set the initial stage/water to be offcoast only206 # Land, to set the initial stage/water to be offcoast only 221 207 poly_mainland = read_polygon(polygons_dir+'initial_condition.csv') 222 208 223 # Land, to set the initial stage/water to be offcoast only209 # Land, to set the initial stage/water to be offcoast only 224 210 poly_marina = read_polygon(polygons_dir+'initial_condition_marina.csv') 225 211 … … 262 248 263 249 264 trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) 250 trigs_min = number_mesh_triangles(interior_regions, poly_all, 251 res_poly_all) 265 252 print 'min estimated number of triangles', trigs_min 266 253 … … 270 257 #------------------------------------------------------------------------------ 271 258 272 # exporting ascgrid for Busselton259 # ASCII export grid for Busselton 273 260 xminBusselton = 340000 274 261 xmaxBusselton = 352000 … … 276 263 ymaxBusselton = 6280000 277 264 278 # exporting ascgrid for Bunbury265 # ASCII export grid for Bunbury 279 266 xminBunbury = 369000 280 267 xmaxBunbury = 381000 -
anuga_work/production/busselton/standardised_version/run_busselton.py
r6259 r6261 25 25 26 26 # Standard modules 27 from os import sep28 27 import os 29 from os.path import dirname, basename 30 from os import mkdir, access, F_OK 31 from shutil import copy 28 from os.path import dirname 32 29 import time 33 import sys34 30 35 31 # Related major packages … … 48 44 import project # Definition of file names and polygons 49 45 50 46 51 47 #----------------------------------------------------------------------- 52 48 # Copy scripts to time stamped output directory and capture screen … … 56 52 #copy script must be before screen_catcher 57 53 #copy_code_files(project.output_run_time_dir, __file__, 58 # dirname(project.__file__)+ sep+ project.__name__+'.py' )54 # dirname(project.__file__)+os.sep+ project.__name__+'.py' ) 59 55 #start_screen_catcher(project.output_run_time_dir, myid, numprocs) 60 56 … … 95 91 print domain.statistics() 96 92 97 98 93 domain.set_name(project.scenario_name) 99 94 domain.set_datadir(project.output_run_time_dir) … … 111 106 geo_reference=domain.geo_reference) 112 107 domain.set_quantity('stage', IC, use_cache=True, verbose=True) 113 114 108 domain.set_quantity('friction', project.friction) 115 116 109 domain.set_quantity('elevation', 117 110 filename=project.combined_dir_name+'.pts', … … 124 117 # Setup boundary conditions 125 118 #------------------------------------------------------------------------- 126 127 119 print 'Set boundary - available tags:', domain.get_boundary_tags() 128 129 boundary_urs_out=project.boundaries_dir_event + sep + project.scenario_name130 120 131 121 Br = Reflective_boundary(domain) 132 122 Bd = Dirichlet_boundary([project.tide,0,0]) 133 134 135 Bf = Field_boundary(boundary_urs_out+'.sts', 123 Bf = Field_boundary(project.urs_boundary_name+'.sts', 136 124 domain, mean_stage=project.tide, 137 125 time_thinning=1, … … 140 128 use_cache=True, 141 129 verbose=True) 142 143 130 144 131 domain.set_boundary({'back': Br,
Note: See TracChangeset
for help on using the changeset viewer.