Changeset 5785
- Timestamp:
- Sep 25, 2008, 1:34:14 PM (15 years ago)
- Location:
- anuga_work/production/perth
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/perth/build_perth_250m.py
r5782 r5785 1 1 """ 2 Script for building the elevation data to run tsunami inundation scenario2 Script for building the elevation data to run a tsunami inundation scenario 3 3 for Perth, WA, Australia. 4 4 … … 7 7 The run_perth.py is reliant on the output of this script. 8 8 9 Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 200610 9 """ 11 10 … … 29 28 30 29 # Application specific imports 31 import project _250m# Definition of file names and polygons30 import project # Definition of file names and polygons 32 31 33 32 #------------------------------------------------------------------------------ … … 50 49 # Fine pts file to be clipped to area of interest 51 50 #------------------------------------------------------------------------------- 52 print "project_250m.poly_all",project_250m.poly_all53 print "project_250m.combined_dir_name",project_250m.combined_dir_name51 print "project_250m.poly_all", project_250m.poly_all 52 print "project_250m.combined_dir_name", project_250m.combined_dir_name 54 53 55 54 # input elevation directory filenames … … 63 62 convert_dem_from_ascii2netcdf(onshore_in_dir_name, basename_out=onshore_dir_name, use_cache=True, verbose=True) 64 63 65 # creates pts file for onshore DEM64 # creates pts file for onshore DEM 66 65 print "creates pts file for onshore DEM" 67 66 dem2pts(onshore_dir_name ,use_cache=True,verbose=True) 68 67 69 #------------------------------------------------------------------------------- 70 # Combine datasets into project_250m.combined_dir_name 71 #------------------------------------------------------------------------------- 72 68 # create onshore pts files 73 69 print'create Geospatial data1 objects from topographies' 74 70 G = Geospatial_data(file_name = onshore_dir_name + '.pts') 71 72 #------------------------------------------------------------------------------- 73 # Combine, clip and export dataset 74 #------------------------------------------------------------------------------- 75 75 76 76 print'clip combined geospatial object by bounding polygon' … … 83 83 #G_clipped.export_points_file(project_250m.combined_dir_name + '.txt') #Use for comparision in ARC 84 84 85 import sys86 sys.exit() -
anuga_work/production/perth/export_results_all.py
r5781 r5785 11 11 """ 12 12 13 import project , os13 import project_250m, os 14 14 import sys 15 15 from anuga.shallow_water.data_manager import convert_dem_from_ascii2netcdf, dem2pts … … 18 18 from os import sep 19 19 20 directory = project .output_dir20 directory = project_250m.output_dir 21 21 22 22 #time_dir = '20080526_104946_run_final_0.6_test_kvanputt' 23 23 #time_dir = '20080530_170833_run_final_0.6_exmouth_kvanputt' 24 24 #time_dir1 = '20080815_103442_run_final_0.0_polyline_alpha0.1_kvanputt' 25 time_dir 1 = '20080912_154439_run_final_0.6_27255_alpha0.1_kvanputt'25 time_dir = '20080924_123601_run_final_0_27283_250m_none_kvanputt' 26 26 27 27 #cellsize = 20 28 28 cellsize = 30 29 #timestep = 029 timestep = 0 30 30 #area = ['Geordie', 'Sorrento', 'Fremantle', 'Rockingham'] 31 area = 'All' 32 which_area = area33 var = [1,2] # Absolute momentum and depth31 #area = ['All'] 32 which_area = 'all' 33 #var = [1,2] # Absolute momentum and depth 34 34 #var = [2] # depth 35 #var = [0,4] #stage and elevation35 var = [4] #stage and elevation 36 36 37 time_dirs = [time_dir1] 38 for time_dir in time_dirs: 37 name1 = directory+time_dir+sep+project_250m.scenario_name 38 #name2 = directory+time_dir+sep+'sww2'+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything 39 39 40 name1 = directory+time_dir+sep+project.scenario_name 41 #name2 = directory+time_dir+sep+'sww2'+sep+project.scenario_name+'_time_39900_0' #need to get assistance on how to make this into anything 42 43 names = [name1] 44 for name in names: 40 names = [name1] 41 for name in names: 45 42 46 43 ## for which_area in area: … … 71 68 ## northing_max = project.ymaxRockingham 72 69 73 74 75 76 77 70 71 for which_var in var: 72 if which_var == 0: # Stage 73 outname = name + which_area + '_stage' 74 quantityname = 'stage' 78 75 79 80 81 76 if which_var == 1: # Absolute Momentum 77 outname = name + which_area + '_momentum' 78 quantityname = '(xmomentum**2 + ymomentum**2)**0.5' 82 79 83 84 85 80 if which_var == 2: # Depth 81 outname = name + which_area + '_depth' 82 quantityname = 'stage-elevation' 86 83 87 88 89 90 91 92 93 94 84 if which_var == 3: # Speed 85 outname = name + which_area + '_speed' 86 #quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6/(stage-elevation))' #Speed 87 quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-6)' #Speed 88 89 if which_var == 4: # Elevation 90 outname = name + which_area + '_elevation' 91 quantityname = 'elevation' #Elevation 95 92 96 97 print 'start sww2dem',area98 99 100 #timestep = timestep,101 102 103 104 93 else: 94 print 'start sww2dem',which_area 95 sww2dem(name, basename_out = outname, 96 quantity = quantityname, 97 timestep = timestep, 98 cellsize = cellsize, 99 reduction = max, 100 verbose = True, 101 format = 'asc') 105 102 ## 106 103 ## else: -
anuga_work/production/perth/project_250m.py
r5782 r5785 1 1 """Common filenames and locations for elevation, meshes and outputs. 2 This script is the heart of all scripts in folder2 This script is the heart of all scripts in the folder 3 3 """ 4 4 #------------------------------------------------------------------------------ … … 18 18 # Directory setup 19 19 #------------------------------------------------------------------------------ 20 # #Note: INUNDATIONHOME is the inundation directory, not the data directory.20 # Note: INUNDATIONHOME is the inundation directory, not the data directory. 21 21 22 22 home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name() … … 25 25 host = get_host_name() 26 26 27 # #time stuff28 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir29 gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir27 # determines time for setting up output directories 28 time = strftime('%Y%m%d_%H%M%S',localtime()) 29 gtime = strftime('%Y%m%d_%H%M%S',gmtime()) 30 30 build_time = time+'_build' 31 31 run_time = time+'_run' 32 print 'gtime: ', gtime33 32 34 33 #------------------------------------------------------------------------------ … … 36 35 #------------------------------------------------------------------------------ 37 36 38 ##Changed to reflect the modeled community (also sets up the directory system) 37 # this section needs to be updated to reflect the modelled community. 38 # Note, the user needs to set up the directory system accordingly 39 39 state = 'western_australia' 40 40 scenario_name = 'perth' 41 41 scenario = 'perth_tsunami_scenario' 42 ##One or all can be changed each time the run_scenario script is excuted 43 tide = 0 #0.6 44 #event_number = 27255 42 43 # Model specific parameters. One or all can be changed each time the 44 # run_scenario script is executed 45 tide = 0 #0.6 46 #event_number = 27255 # linked to hazard map 45 47 event_number = 27283 46 alpha = 0.1 47 friction=0.01 48 starttime=0 49 finaltime=80000 48 alpha = 0.1 # smoothing parameter for mesh 49 friction=0.01 # manning's friction coefficient 50 starttime=0 51 finaltime=80000 # final time for simulation 50 52 51 53 interior_mesh = 'all' # Can have 'all' or 'none' for Phase 2 study 52 54 53 setup='final' ## Can replace with trial or basic, this action will thin the mesh 54 ## so that the run script will take less time (hence less acurate) 55 setup='final' # Final can be replaced with trial or basic. 56 # Either will result in a coarser mesh that will allow a 57 # faster, but less accurate, simulation. 55 58 56 59 if setup =='trial': … … 73 76 # Output Filename 74 77 #------------------------------------------------------------------------------ 75 ##Important to distiquish each run 78 # Important to distinguish each run - ensure str(user) is included! 79 # Note, the user is free to include as many parameters as desired 76 80 dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_250m_' + str(interior_mesh) +'_'+str(user) 77 81 78 82 #------------------------------------------------------------------------------ 79 # I NPUT DATA80 #------------------------------------------------------------------------------ 81 82 # #ELEVATION DATA## -used in build_perth.py83 # # onshore data: format ascii grid with accompaning projection file84 grid_250m_2005= 'grid'85 86 # #GAUGES##- used in get_timeseries.py83 # Input Data 84 #------------------------------------------------------------------------------ 85 86 # elevation data used in build_perth.py 87 # onshore data: format ascii grid with accompanying projection file 88 onshore_name = 'grid' 89 90 # gauges - used in get_timeseries.py 87 91 gauge_name = 'perth.csv' 88 92 gauge_name2 = 'thinned_MGA50.csv' 89 93 90 # #BOUNDING POLYGON## -used in build_boundary.py and run_perth.py respectively91 # NOTE: when files are put togethermust be in sequence - for ease go clockwise!92 # Check the run_perth.py for boundary_tags93 # #thinned ordering file from Hazard Map: formatindex,latitude,longitude (with title)94 # BOUNDING POLYGON - used in build_boundary.py and run_perth.py respectively 95 # NOTE: when files are put together the points must be in sequence - for ease go clockwise! 96 # Check the run_perth.py for boundary_tags 97 # thinned ordering file from Hazard Map: format is index,latitude,longitude (with title) 94 98 order_filename = 'thinned_boundary_ordering.txt' 95 # #landward bounding points99 #landward bounding points 96 100 landward = 'landward_bounding_polygon.txt' 97 101 98 102 #------------------------------------------------------------------------------ 99 # O UTPUT ELEVATION DATA100 #------------------------------------------------------------------------------ 101 # #Output filename for elevation102 # # its a combination of all the data put together(utilisied in build_boundary)103 # Output Elevation Data 104 #------------------------------------------------------------------------------ 105 # Output filename for elevation 106 # this is a combination of all the data (utilisied in build_boundary) 103 107 combined_name ='perth_combined_elevation_250m' 104 108 … … 117 121 118 122 #------------------------------------------------------------------------------ 119 # Location of input and output Data120 #------------------------------------------------------------------------------ 121 # #where the input data sits122 onshore_in_dir_name = topographies_in_dir + grid_250m_2005123 124 # #where the output data sits125 onshore_dir_name = topographies_dir + grid_250m_2005126 127 # #where the combinedfile sits123 # Location of input and output data 124 #------------------------------------------------------------------------------ 125 # where the input data sits 126 onshore_in_dir_name = topographies_in_dir + onshore_name 127 128 # where the output data sits 129 onshore_dir_name = topographies_dir + onshore_name 130 131 # where the combined elevation file sits 128 132 combined_dir_name = topographies_dir + combined_name 129 133 130 # #where the mesh sits (this is created during the run_perth.py)131 meshes_dir_name = meshes_dir + scenario_name + interior_mesh +'.msh'132 133 # where the boundary orderfiles sit (this is used within build_boundary.py)134 # where the mesh sits (this is created during the run_perth.py) 135 meshes_dir_name = meshes_dir + scenario_name+ interior_mesh +'.msh' 136 137 # where the boundary ordering files sit (this is used within build_boundary.py) 134 138 order_filename_dir = boundaries_dir + order_filename 135 139 136 # where the landward points of boundary extent sit (this is used within run_perth.py)140 # where the landward points of boundary extent sit (this is used within run_perth.py) 137 141 landward_dir = boundaries_dir + landward 138 142 139 # where the event sts files sits (this is created during the build_boundary.py)143 # where the event sts files sits (this is created during the build_boundary.py) 140 144 boundaries_dir_event = boundaries_dir + str(event_number) + sep 141 145 boundaries_dir_mux = muxhome 142 146 143 # where the directory of the output filename sits144 output_build_time_dir = output_dir+build_time+dir_comment+sep #used for build_perth.py145 output_run_time_dir = output_dir+run_time+dir_comment+sep #used for run_perth.py147 # where the directory of the output filename sits 148 output_build_time_dir = output_dir+build_time+dir_comment+sep #used for build_perth.py 149 output_run_time_dir = output_dir+run_time+dir_comment+sep #used for run_perth.py 146 150 output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing 147 151 148 #w here the directory of the gauges sit149 gauges_dir_name = gauges_dir + gauge_name #used for get_timeseries.py150 gauges_dir_name2 = gauges_dir + gauge_name2 #used for get_timeseries.py152 #w here the directory of the gauges sit 153 gauges_dir_name = gauges_dir + gauge_name #used for get_timeseries.py 154 gauges_dir_name2 = gauges_dir + gauge_name2 #used for get_timeseries.py 151 155 152 156 #------------------------------------------------------------------------------ … … 154 158 #------------------------------------------------------------------------------ 155 159 156 #Land, to set the stage/water to be offcoast only160 #Land, to set the initial stage/water to be offcoast only 157 161 poly_mainland = read_polygon(polygons_dir+'initial_condition.csv') 158 162 159 # Initial bounding polygon for data clipping163 # Initial bounding polygon for data clipping 160 164 poly_all = read_polygon(polygons_dir+'poly_all.csv') 161 165 res_poly_all = 100000*res_factor 162 166 163 # Area of Interest 1 (Fremantle)167 # Area of Interest 1 (Fremantle) 164 168 poly_aoi1 = read_polygon(polygons_dir+'CBD_coastal.csv') 165 169 res_aoi1 = 500*res_factor 166 170 167 # Area of Interest 2 (Rockingham)171 # Area of Interest 2 (Rockingham) 168 172 poly_aoi2 = read_polygon(polygons_dir+'rockingham_penguin.csv') 169 173 res_aoi2 = 500*res_factor 170 174 171 # Area of Interest 2 (garden Island)175 # Area of Interest 2 (garden Island) 172 176 poly_aoi2a = read_polygon(polygons_dir+'garden.csv') 173 177 res_aoi2a= 500*res_factor 174 178 175 # Area of Interest 3 (geordie bay - record of tsunami impact)179 # Area of Interest 3 (geordie bay - record of tsunami impact) 176 180 poly_aoi3 = read_polygon(polygons_dir+'geordie_bay.csv') 177 181 res_aoi3 = 500*res_factor 178 182 179 # Area of Interest 4 (sorrento - record of tsunami impact)183 # Area of Interest 4 (sorrento - record of tsunami impact) 180 184 poly_aoi4 = read_polygon(polygons_dir+'sorrento_gauge.csv') 181 185 res_aoi4 = 500*res_factor 182 186 183 # Area of Significance 1 (Garden Island and sand bank infront of Rockingham)187 # Area of Significance 1 (Garden Island and sand bank infront of Rockingham) 184 188 poly_aos1 = read_polygon(polygons_dir+'garden_rockingham.csv') 185 189 res_aos1 = 1000*res_factor 186 190 187 # Area of Significance 2 (incorporate coastline of rottnest)191 # Area of Significance 2 (incorporate coastline of rottnest) 188 192 poly_aos2 = read_polygon(polygons_dir+'rottnest_external.csv') 189 193 res_aos2 = 1000*res_factor 190 194 191 # Refined areas192 # Polygon designed to incorporate Dredge Area from Fremantle to193 # Rockingham the steep incline was making the meshgo to 0195 # Refined areas 196 # Polygon designed to incorporate dredged area from Fremantle to 197 # Rockingham as the steep incline was making the elevation go to 0 194 198 poly_aos3 = read_polygon(polygons_dir+'DredgeArea.csv') 195 199 res_aos3 = 1000*res_factor 196 200 197 # Shallow water 1201 # Shallow water 1 198 202 poly_sw1 = read_polygon(polygons_dir+'internal_h20mORd3km.csv') 199 203 res_sw1 = 25000*res_factor 200 204 201 # Deep water (land of Rottnest, ANUGA does not do donuts!)205 # Deep water (land of Rottnest, ANUGA does not do donuts!) 202 206 poly_dw1 = read_polygon(polygons_dir+'rottnest_internal.csv') 203 207 res_dw1 = 100000*res_factor … … 215 219 print'Mesh = none' 216 220 interior_regions = [] 217 221 218 222 trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) 219 223 print 'min estimated number of triangles', trigs_min 220 224 221 222 225 #------------------------------------------------------------------------------ 223 226 # Clipping regions for export to asc and regions for clipping data 227 # Final inundation maps should only be created in regions of the finest mesh 224 228 #------------------------------------------------------------------------------ 225 229 -
anuga_work/production/perth/run_perth_250m.py
r5782 r5785 1 """Script for running tsunami inundation scenario for Perth, WA, Australia.1 """Script for running a tsunami inundation scenario for Perth, WA, Australia. 2 2 3 3 The scenario is defined by a triangular mesh created from project_250m.polygon, 4 the elevation data is com biled into a pts file through build_perth.py5 and a simulated tsunami is generated through an sts file from build_boundary.py 6 7 Input: sts file (build_boundary.py for res epective event)4 the elevation data is compiled into a pts file through build_perth.py 5 and a simulated tsunami is generated through an sts file from build_boundary.py. 6 7 Input: sts file (build_boundary.py for respective event) 8 8 pts file (build_perth.py) 9 information from project _250mfile9 information from project file 10 10 Outputs: sww file stored in project_250m.output_run_time_dir 11 11 The export_results_all.py and get_timeseries.py is reliant … … 48 48 49 49 # Application specific imports 50 import project _250m# Definition of file names and polygons50 import project # Definition of file names and polygons 51 51 numprocs = 1 52 52 myid = 0 … … 90 90 N = len(urs_bounding_polygon)-1 91 91 92 # boundary tags refer to project_250m.landward 4 points equals 5 segments start at N92 # boundary tags refer to project_250m.landward 4 points equals 5 segments start at N 93 93 boundary_tags={'back': [N+1,N+2,N+3], 'side': [N,N+4], 'ocean': range(N)} 94 94 95 96 95 #-------------------------------------------------------------------------- 97 96 # Create the triangular mesh based on overall clipping polygon with a tagged … … 100 99 #-------------------------------------------------------------------------- 101 100 102 # IMPORTANT don't cache create_mesh_from_region and Domain(mesh....) as it101 # IMPORTANT don't cache create_mesh_from_region and Domain(mesh....) as it 103 102 # causes problems with the ability to cache set quantity which takes alot of times 104 103 … … 132 131 print 'Setup initial conditions' 133 132 134 # following sets the stage/water to be offcoastonly133 # sets the initial stage in the offcoast region only 135 134 IC = Polygon_function( [(project_250m.poly_mainland, 0)], default = kwargs['tide'], 136 135 geo_reference = domain.geo_reference) … … 161 160 domain.set_name(kwargs['scenario_name']) 162 161 domain.set_datadir(kwargs['output_dir']) 163 domain.set_default_order(2) # Apply second order scheme164 domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm162 domain.set_default_order(2) # Apply second order scheme 163 domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm 165 164 domain.set_store_vertices_uniquely(False) 166 165 domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum']) … … 206 205 domain.write_boundary_statistics(tags = 'ocean') 207 206 207 # these outputs should be checked with the resultant inundation map 208 208 x, y = domain.get_maximum_inundation_location() 209 209 q = domain.get_maximum_inundation_elevation() 210 211 210 print 'Maximum runup observed at (%.2f, %.2f) with elevation %.2f' %(x,y,q) 212 211 213 print ' Thattook %.2f seconds' %(time.time()-t0)212 print 'Simulation took %.2f seconds' %(time.time()-t0) 214 213 215 214 #kwargs 'completed' must be added to write the final parameters to file … … 232 231 kwargs['alpha'] = project_250m.alpha 233 232 kwargs['friction']=project_250m.friction 234 235 233 236 234 run_model(**kwargs) 237 235
Note: See TracChangeset
for help on using the changeset viewer.