Changeset 3671
- Timestamp:
- Sep 27, 2006, 5:55:02 PM (18 years ago)
- Location:
- anuga_work/production/hobart_2006
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_work/production/hobart_2006/export_results.py
r3668 r3671 3 3 4 4 from anuga.shallow_water.data_manager import sww2dem 5 #from anuga.pyvolution.ermapper_grids import read_ermapper_grid6 5 from anuga.abstract_2d_finite_volumes.util import Screen_Catcher 7 6 from os import sep 8 7 9 time_dir = '2006092 5_115139' #MSL8 time_dir = '20060927_054931' #MSL 10 9 directory = project.outputdir 11 10 name = directory + time_dir +sep + 'source' … … 15 14 #which_var = int(raw_input('Stage = 0, Absolute Momentum = 1, Depth = 2, Speed = 3 ' )) 16 15 which_var = 4 17 #sys.stderr.write(sys.stdout.data)18 16 if which_var == 0: # Stage 19 17 outname = name + '_stage' … … 30 28 if which_var == 3: # Speed 31 29 outname = name + '_speed' 32 #quantityname = '((xmomentum/(stage-elevation))**2 + (ymomentum/(stage-elevation))**2)**0.5' #Speed33 #quantityname = 'xmomentum/(stage-elevation)' #Speed34 30 quantityname = '(xmomentum**2 + ymomentum**2)**0.5/(stage-elevation+1.e-30)' #Speed 35 31 36 32 if which_var == 4: # Elevation 37 outname = name + '_elevation _node3'33 outname = name + '_elevation' 38 34 quantityname = 'elevation' #Elevation 39 35 40 36 print 'start sww2dem' 41 #sys.stderr.write(sys.stdout.data)42 37 sww2dem(name, basename_out = outname, 43 38 quantity = quantityname, 44 cellsize = 30, # would prefer this at 2539 cellsize = 25, # would prefer this at 25 45 40 # define region for viz purposes 46 41 #easting_min = project.e_min_area, … … 52 47 format = 'asc') 53 48 54 #sys.stderr.write(sys.stdout.data)55 56 #Check57 58 #data = read_ermapper_grid(name)59 #print 'Values from %s are in [%f, %f]' %(name, min(data.flat), max(data.flat)) -
anuga_work/production/hobart_2006/project.py
r3669 r3671 7 7 import sys 8 8 from time import localtime, strftime, gmtime 9 9 from anuga.utilities.polygon import read_polygon, plot_polygons 10 from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm 11 12 if sys.platform == 'win32': 13 home = getenv('INUNDATIONHOME') 14 user = getenv('USERPROFILE') 15 16 else: 17 home = getenv('INUNDATIONHOME', sep+'d'+sep+'xrd'+sep+'gem'+sep+'2'+sep+'ramp'+sep+'risk_assessment_methods_project'+sep+'inundation') 18 user = getenv('LOGNAME') 19 print 'USER:', user 20 21 # INUNDATIONHOME is the inundation directory, not the data directory. 22 home += sep +'data' 23 10 24 #Making assumptions about the location of scenario data 11 25 state = 'tasmania' … … 50 64 codename = 'project.py' 51 65 52 if sys.platform == 'win32':53 home = getenv('INUNDATIONHOME')54 user = getenv('USERPROFILE')55 56 else:57 home = getenv('INUNDATIONHOME', sep+'d'+sep+'xrd'+sep+'gem'+sep+'2'+sep+'ramp'+sep+'risk_assessment_methods_project'+sep+'inundation')58 user = getenv('LOGNAME')59 print 'USER:', user60 61 # INUNDATIONHOME is the inundation directory, not the data directory.62 home += sep +'data'63 64 66 #Derive subdirectories and filenames 65 67 #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir 66 68 local_time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir 67 print 'home', home68 69 meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep 69 70 datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep … … 71 72 polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep 72 73 boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep 73 #output dir without time74 74 outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep 75 75 outputtimedir = outputdir + local_time + sep … … 79 79 buildings_filename = gaugedir + 'hobart_res.csv' 80 80 buildings_filename_damage_out = 'hobart_res_modified.csv' 81 82 81 gaugetimeseries = gaugedir + 'hobart' 83 82 … … 85 84 #MOST_dir = 'f:'+sep+'3'+sep+'ehn'+sep+'users'+sep+'davidb'+sep+'tsunami'+sep+'WA_project'+sep+'SU-AU_90'+sep+'most_2'+sep+'detailed'+sep 86 85 87 codedir = getcwd()+sep 88 86 codedir = getcwd()+sep 89 87 codedirname = codedir + 'project.py' 90 91 88 meshname = outputtimedir + 'mesh_' + basename 92 89 … … 115 112 offshore_dem_name_aho16 = datadir + offshore_name16 116 113 coast_dem_name = datadir + coast_name 114 # addition once total grid delivered 115 #onshore_offshore_dem_name = datadir + '25m_se_tas' #25m grid 116 onshore_offshore_dem_name = datadir + '50m_se_tas' #50m grid 117 117 118 combined_dem_name = datadir + 'hobart_combined_elevation' 119 combined_dem_name2 = datadir + 'hobart_combined_elevation2' # for alpha checking 118 120 119 121 outputname = outputtimedir + basename #Used by post processing 122 123 ############################### 124 # Domain definitions 125 ############################### 126 127 # bounding box 128 south = degminsec2decimal_degrees(-43,45,0) 129 north = degminsec2decimal_degrees(-42,30,0) 130 west = degminsec2decimal_degrees(146,45,0) 131 east = degminsec2decimal_degrees(148,0,0)#degminsec2decimal_degrees(148,15,0) 132 133 #Main Domain of Hobart: first run JS 18/9/06 134 d0 = [south, west] 135 d1 = [south, east] 136 d2 = [north, east] 137 d3 = [north, west] 138 polyAll, zone = convert_points_from_latlon_to_utm([d0, d1, d2, d3]) 139 refzone = zone 140 141 # Second run - bottom bright, topr, top, left 142 polyAll = [[520000, 5170000],[580000, 5170000],[580000, 5200000],[590000,5240000],[520000,5260000]] 143 144 # Third run - afternoon Wed 27 Sep; surrounds -100m and 20mish elevation 145 polyAll = read_polygon(polygondir+'new_extent.csv') 146 plot_polygons([polyAll],'boundingpoly',verbose=False) 147 148 ################################################################### 149 # Clipping regions for export to asc and regions for clipping data 150 ################################################################### 151 152 # region to export for inundation map 153 e_min_area = 521000#490000 154 e_max_area = 522000#580000 155 n_min_area = 5190000#5160000 156 n_max_area = 5200000#5275000 120 157 121 158 # clipping 12.5m onshore data set … … 130 167 northingmax25 = 5260000 131 168 132 # region to export for inundation map 133 e_min_area = 521000#490000 134 e_max_area = 522000#580000 135 n_min_area = 5190000#5160000 136 n_max_area = 5200000#5275000 137 138 from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm 139 140 # bounding box 141 south = degminsec2decimal_degrees(-43,45,0) 142 north = degminsec2decimal_degrees(-42,30,0) 143 west = degminsec2decimal_degrees(146,45,0) 144 east = degminsec2decimal_degrees(148,0,0)#degminsec2decimal_degrees(148,15,0) 145 146 #Main Domain of Hobart: first run JS 18/9/06 147 d0 = [south, west] 148 d1 = [south, east] 149 d2 = [north, east] 150 d3 = [north, west] 151 152 polyAll, zone = convert_points_from_latlon_to_utm([d0, d1, d2, d3]) 153 refzone = zone 154 #polyAll = [[500000, 5200000],[580000, 5200000],[580000, 5270000],[500000,5270000]] #073937 155 #polyAll = [[500000, 5160000],[580000, 5160000],[580000, 5270000],[500000,5270000]] # try this is the above works 156 #polyAll = [[510000, 5170000],[570000, 5170000],[570000, 5250000],[510000,5250000]] # try this is the above works 157 #polyAll = [[520000, 5160000],[580000, 5170000],[580000, 5200000],[600000,5260000],[510000,5280000]] # try this is the above works 158 polyAll = [[520000, 5170000],[580000, 5170000],[580000, 5200000],[590000,5240000],[520000,5260000]] # try this is the above works 159 # bottom bright, topr, top, left 160 161 # region to export for Alex to make bathymetry map 162 e_min_area = 560000#500000 #490000 163 e_max_area = 570000#560000 #580000 164 n_min_area = 5200000#5240000#5160000 165 n_max_area = 5230000#5260000#5270000 169 ############################### 170 # Interior region definitions 171 ############################### 166 172 167 173 #Interior region - Hobart city area + Glenorchy, Kingston … … 188 194 189 195 # Bruny Island 190 from anuga.utilities.polygon import read_polygon191 196 poly_bruny = read_polygon(polygondir+'bruny.csv') -
anuga_work/production/hobart_2006/run_hobart.py
r3669 r3671 61 61 62 62 # filenames 63 onshore_dem_name = project.onshore_dem_name 64 onshore_dem_name_25 = project.onshore_dem_name_25 63 onshore_offshore_dem_name = project.onshore_offshore_dem_name 65 64 meshname = project.meshname+'.msh' 66 65 source_dir = project.boundarydir … … 68 67 copied_files = False 69 68 70 # creates DEM from asc data - 12.5m71 #convert_dem_from_ascii2netcdf(onshore_dem_name, use_cache=True, verbose=True)72 73 #creates pts file for onshore DEM - 12.574 #dem2pts(onshore_dem_name,75 # easting_min=project.eastingmin,76 # easting_max=project.eastingmax,77 # northing_min=project.northingmin,78 # northing_max= project.northingmax,79 # use_cache=True, verbose=True)80 81 69 # create DEM from asc data - 25m data 82 convert_dem_from_ascii2netcdf(onshore_dem_name_25, use_cache=True, verbose=True) 83 84 #creates pts file for onshore DEM - 25 85 dem2pts(onshore_dem_name_25, 86 easting_min=project.eastingmin25, 87 easting_max=project.eastingmax25, 88 northing_min=project.northingmin25, 89 northing_max= project.northingmax25, 90 use_cache=True, verbose=True) 91 92 #combine_rectangular_points_files(project.onshore_dem_name + '.pts', 93 # project.onshore_dem_name_25 + '.pts', 94 # project.all_onshore_dem_name + '.pts') 95 96 print 'adding data sets' 97 G = Geospatial_data(file_name = project.offshore_dem_name_local1 + '.xya')+\ 98 Geospatial_data(file_name = project.offshore_dem_name_local2 + '.xya')+\ 99 Geospatial_data(file_name = project.offshore_dem_name_local3 + '.xya')+\ 100 Geospatial_data(file_name = project.offshore_dem_name_local4 + '.xya')+\ 101 Geospatial_data(file_name = project.offshore_dem_name_aho1 + '.xya')+\ 102 Geospatial_data(file_name = project.offshore_dem_name_aho2 + '.xya')+\ 103 Geospatial_data(file_name = project.offshore_dem_name_aho3 + '.xya')+\ 104 Geospatial_data(file_name = project.offshore_dem_name_aho4 + '.xya')+\ 105 Geospatial_data(file_name = project.offshore_dem_name_aho5 + '.xya')+\ 106 Geospatial_data(file_name = project.offshore_dem_name_aho6 + '.xya')+\ 107 Geospatial_data(file_name = project.offshore_dem_name_aho7 + '.xya')+\ 108 Geospatial_data(file_name = project.offshore_dem_name_aho8 + '.xya')+\ 109 Geospatial_data(file_name = project.offshore_dem_name_aho9 + '.xya')+\ 110 Geospatial_data(file_name = project.offshore_dem_name_aho10 + '.xya')+\ 111 Geospatial_data(file_name = project.offshore_dem_name_aho11 + '.xya')+\ 112 Geospatial_data(file_name = project.offshore_dem_name_aho12 + '.xya')+\ 113 Geospatial_data(file_name = project.offshore_dem_name_aho13 + '.xya')+\ 114 Geospatial_data(file_name = project.offshore_dem_name_aho14 + '.xya')+\ 115 Geospatial_data(file_name = project.offshore_dem_name_aho15 + '.xya')+\ 116 Geospatial_data(file_name = project.offshore_dem_name_aho16 + '.xya')+\ 117 Geospatial_data(file_name = project.onshore_dem_name_25 + '.pts') 70 convert_dem_from_ascii2netcdf(onshore_offshore_dem_name, use_cache=True, verbose=True) 71 72 #creates pts file for combined DEM - 25 73 dem2pts(onshore_offshore_dem_name, use_cache=True, verbose=True) 74 75 # create geospatial data set and export 76 G = Geospatial_data(file_name = project.onshore_offshore_dem_name + '.pts') 118 77 G.export_points_file(project.combined_dem_name + '.pts') 119 #Geospatial_data(file_name = project.all_onshore_dem_name + '.pts') 78 120 79 #---------------------------------------------------------------------------- 121 80 # Create the triangular mesh based on overall clipping polygon with a tagged … … 228 187 # 7 min square wave starting at 1 min, 6m high 229 188 Bw = Time_boundary(domain = domain, 230 f=lambda t: [(60<t<480)* 6, 0, 0])189 f=lambda t: [(60<t<480)*10, 0, 0]) 231 190 232 191 # for MOST BC … … 236 195 # for testing 237 196 domain.set_boundary( {'topr': Bd, 'left': Bd, 'top': Bd, 238 'bottom': B d, 'bright': Bw} )197 'bottom': Bw, 'bright': Bd} ) 239 198 240 199 #-------------------------------------------------------------------------------
Note: See TracChangeset
for help on using the changeset viewer.