Changeset 5386
- Timestamp:
- May 30, 2008, 3:34:13 PM (15 years ago)
- Location:
- anuga_work/production/perth
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/perth/build_perth.py
r5360 r5386 117 117 118 118 print'add all geospatial objects' 119 G = G1 + G2 + G3 + G4 + G5 + G6 + G_off + G_off1119 G = G1 + G2 + G3 + G4 + G5 + G6 + G_off 120 120 121 121 print'clip combined geospatial object by bounding polygon' 122 G_clipped = G.clip(project.bounding_polygon) 123 #FIXME: add a clip function to pts 124 #print'shape of clipped data', G_clipped.get_data_points().shape 122 G_clipped = G.clip(project.poly_all) 125 123 126 124 print'export combined DEM file' … … 128 126 mkdir (project.topographies_dir) 129 127 G_clipped.export_points_file(project.combined_dir_name + '.pts') 130 #G_clipped.export_points_file(project.combined_dir_name + '.xya') 131 132 ''' 133 print'project.combined_dir_name + 1.xya',project.combined_dir_name + '1.xya' 134 G_all=Geospatial_data(file_name = project.combined_dir_name + '1.xya') 135 print'split' 136 G_all_1, G_all_2 = G_all.split(.10) 137 print'export 1' 138 G_all_1.export_points_file(project.combined_dir_name+'_small1' + '.xya') 139 print'export 2' 140 G_all_2.export_points_file(project.combined_dir_name+'_other1' + '.xya') 141 128 #G_clipped.export_points_file(project.combined_dir_name + '.xya') - use for comparision in ARC 142 129 143 130 #------------------------------------------------------------------------- … … 145 132 #------------------------------------------------------------------------- 146 133 print 'starting to create boundary conditions' 134 from anuga.shallow_water.data_manager import urs2sww, urs_ungridded2sww 135 147 136 boundaries_in_dir_name = project.boundaries_in_dir_name 137 print 'boundaries_in_dir_name',project.boundaries_in_dir_name 148 138 149 from anuga.shallow_water.data_manager import urs2sww150 151 print 'minlat=project.north_boundary, maxlat=project.south_boundary',project.north_boundary, project.south_boundary152 print 'minlon= project.west_boundary, maxlon=project.east_boundary',project.west_boundary, project.east_boundary153 139 154 140 #import sys; sys.exit() 155 141 156 #if access(project.boundaries_dir,F_OK) == 0: 157 # mkdir (project.boundaries_dir) 158 159 from caching import cache 160 cache(urs2sww, 161 (boundaries_in_dir_name, 162 project.boundaries_dir_name1), 163 {'verbose': True, 164 'minlat': project.south_boundary, 165 'maxlat': project.north_boundary, 166 'minlon': project.west_boundary, 167 'maxlon': project.east_boundary, 168 # 'minlat': project.south, 169 # 'maxlat': project.north, 170 # 'minlon': project.west, 171 # 'maxlon': project.east, 172 'mint': 0, 'maxt': 40000, 173 # 'origin': domain.geo_reference.get_origin(), 174 'mean_stage': project.tide, 175 # 'zscale': 1, #Enhance tsunami 176 'fail_on_NaN': False}, 177 verbose = True, 178 ) 179 # dependencies = source_dir + project.boundary_basename + '.sww') 180 181 ''' 142 urs_ungridded2sww(project.boundaries_in_dir_name, project.boundaries_in_dir_name, 143 verbose=True, mint=4000, maxt=10000, zscale=1) 182 144 183 145 … … 187 149 188 150 151 152 153 -
anuga_work/production/perth/project.py
r5381 r5386 42 42 export_cellsize=50 43 43 setup='final' 44 source=' test'44 source='exmouth' 45 45 46 46 if setup =='trial': … … 119 119 120 120 #boundaries_source = '1' 121 122 if source =='dampier':123 boundaries_name = 'broome_3854_17042007' #Dampier gun124 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'dampier'+sep+'1_10000'+sep125 126 if source=='onslow':127 boundaries_name = 'broome_3859_16052007' #onslow_hedland_broome gun128 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'onslow_hedland_broome'+sep+'1_10000'+sep129 121 130 122 if source=='exmouth': 131 boundaries_name = ' broome_3103_18052007' #exmouth gun123 boundaries_name = 'perth_3103_28052008' #exmouth gun 132 124 boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'exmouth'+sep+'1_10000'+sep 133 125 … … 209 201 ,[poly_rottnest_ex, res_rottnest_ex]] 210 202 211 boundary_tags={'back': [0,1,2], 'side': [3, 6],'ocean': [4, 5]}203 boundary_tags={'back': [0,1,2], 'side': [3,7],'ocean': [4, 5, 6]} 212 204 213 205 trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) 214 206 215 207 print 'min number triangles', trigs_min 208 209 poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') 216 210 217 211 ################################################################### -
anuga_work/production/perth/run_perth.py
r5360 r5386 103 103 print 'Setup computational domain' 104 104 105 #domain = cache(Domain, (meshes_dir_name), {'use_cache':True, 'verbose':True}, verbose=True)106 #above don't work107 105 domain = Domain(project.meshes_dir_name+'.msh', use_cache=False, verbose=True) 108 106 print 'memory usage before del domain',mem_usage() … … 123 121 from polygon import Polygon_function 124 122 #following sets the stage/water to be offcoast only 125 # IC = Polygon_function( [(project.poly_mainland, -1.0)], default = kwargs['tide'], 126 # geo_reference = domain.geo_reference) 127 # domain.set_quantity('stage', IC) 128 domain.set_quantity('stage',kwargs['tide'] ) 129 # domain.set_quantity('stage', kwargs['tide']) 123 IC = Polygon_function( [(project.poly_mainland, 0)], default = kwargs['tide'], 124 geo_reference = domain.geo_reference) 125 domain.set_quantity('stage', IC) 126 #domain.set_quantity('stage',kwargs['tide'] ) 130 127 domain.set_quantity('friction', kwargs['friction']) 131 128 132 print 'Start Set quantity',kwargs[' bathy_file']129 print 'Start Set quantity',kwargs['elevation_file'] 133 130 134 131 domain.set_quantity('elevation', 135 filename = kwargs[' bathy_file'],132 filename = kwargs['elevation_file'], 136 133 use_cache = False, 137 134 verbose = True, … … 172 169 Br = Reflective_boundary(domain) 173 170 Bd = Dirichlet_boundary([kwargs['tide'],0,0]) 174 Bo = Dirichlet_boundary([kwargs['tide']+5.0,0,0]) 175 176 if project.source != 'test': 177 print 'start reading boundary file' 178 179 Bf = Field_boundary(kwargs['boundary_file'], 180 domain, time_thinning=kwargs['time_thinning'], mean_stage=kwargs['tide'], 181 use_cache=False, verbose=True) 182 domain.set_boundary({'back': Br, 183 'side': Bd, 184 'ocean': Bf}) 185 else: 186 domain.set_boundary({'back': Br, 187 'side': Bd, 188 'ocean': Bd}) 171 172 print 'start reading boundary file' 173 174 Bf = Field_boundary(kwargs['boundary_file'], 175 domain, time_thinning=kwargs['time_thinning'], mean_stage=kwargs['tide'], 176 use_cache=False, verbose=True) 177 domain.set_boundary({'back': Br, 178 'side': Bd, 179 'ocean': Bf}) 180 181 ## if project.source != 'test': 182 ## domain.set_boundary({'back': Br, 183 ## 'side': Bd, 184 ## 'ocean': Bd}) 189 185 190 186 kwargs['input_start_time']=domain.starttime … … 197 193 t0 = time.time() 198 194 199 for t in domain.evolve(yieldstep = 240, finaltime = kwargs['starttime']): 195 for t in domain.evolve(yieldstep = 240, finaltime = kwargs['finaltime'] 196 ,skip_initial_step = True): 200 197 domain.write_time() 201 domain.write_boundary_statistics(tags = 'ocean') 202 203 if allclose(t, 120): 204 domain.set_boundary({'back': Br, 'side': Bd, 'ocean': Bo}) 205 206 if allclose(t, 720): 207 domain.set_boundary({'back': Br, 'side': Bd, 'ocean': Bd}) 208 209 # for t in domain.evolve(yieldstep = kwargs['yieldstep'], finaltime = kwargs['midtime'] 210 # ,skip_initial_step = True): 211 # domain.write_time() 212 # domain.write_boundary_statistics(tags = 'ocean') 213 # 214 # for t in domain.evolve(yieldstep = 240, finaltime = kwargs['finaltime'] 215 # ,skip_initial_step = True): 216 # domain.write_time() 217 # domain.write_boundary_statistics(tags = 'ocean') 198 domain.write_boundary_statistics(tags = 'ocean') 218 199 219 200 x, y = domain.get_maximum_inundation_location() … … 233 214 print 'memory usage before del domain1',mem_usage() 234 215 235 def export_model(**kwargs):236 #store_parameters(**kwargs)237 238 # print 'memory usage before del domain',mem_usage()239 #del domain240 print 'memory usage after del domain',mem_usage()241 242 swwfile = kwargs['output_dir']+kwargs['aa_scenario_name']243 print'swwfile',swwfile244 245 export_grid(swwfile, extra_name_out = 'town',246 quantities = ['speed','depth','elevation','stage'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation247 #quantities = ['speed','depth'], # '(xmomentum**2 + ymomentum**2)**0.5' defaults to elevation248 timestep = None,249 reduction = max,250 cellsize = kwargs['export_cellsize'],251 NODATA_value = -9999,252 easting_min = project.eastingmin,253 easting_max = project.eastingmax,254 northing_min = project.northingmin,255 northing_max = project.northingmax,256 verbose = False,257 origin = None,258 datum = 'GDA94',259 format = 'asc')260 261 inundation_damage(swwfile+'.sww', project.buildings_filename,262 project.buildings_filename_out)263 216 264 217 #------------------------------------------------------------- … … 276 229 277 230 kwargs['output_dir']=project.output_run_time_dir 278 kwargs[' bathy_file']=project.combined_dir_name+'.txt'279 # kwargs[' bathy_file']=project.combined_small_dir_name + '.pts'231 kwargs['elevation_file']=project.combined_dir_name+'.txt' 232 # kwargs['elevation_file']=project.combined_small_dir_name + '.pts' 280 233 kwargs['boundary_file']=project.boundaries_in_dir_name + '.sww' 281 234 kwargs['file_name']=project.home+'detail.csv'
Note: See TracChangeset
for help on using the changeset viewer.