[5001] | 1 | # -*- coding: cp1252 -*- |
---|
| 2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | from os import sep, environ, getenv, getcwd |
---|
| 6 | from os.path import expanduser |
---|
| 7 | import sys |
---|
| 8 | from time import localtime, strftime, gmtime |
---|
| 9 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles |
---|
| 10 | #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
| 11 | from anuga.utilities.system_tools import get_user_name |
---|
| 12 | |
---|
| 13 | # file and system info |
---|
| 14 | #--------------------------------- |
---|
| 15 | codename = 'project.py' |
---|
| 16 | |
---|
| 17 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
| 18 | user = get_user_name() |
---|
| 19 | |
---|
| 20 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 21 | home += sep +'data' |
---|
| 22 | |
---|
| 23 | #time stuff |
---|
| 24 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 25 | #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 26 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 27 | build_time = time+'_build' |
---|
| 28 | run_time = time+'_run' |
---|
| 29 | print 'gtime: ', gtime |
---|
| 30 | |
---|
| 31 | #tide = -5.3 |
---|
| 32 | tide = 0 |
---|
| 33 | #tide = 4.9 |
---|
| 34 | |
---|
| 35 | #Making assumptions about the location of scenario data |
---|
| 36 | state = 'western_australia' |
---|
| 37 | scenario_name = 'broome' |
---|
| 38 | scenario = 'broome_tsunami_scenario_2006' |
---|
| 39 | |
---|
| 40 | # onshore data provided by WA DLI |
---|
| 41 | onshore_name = 'Broome_topography_DLI' # original |
---|
| 42 | |
---|
| 43 | #island |
---|
| 44 | #island_name = 'rott_dli_ext' # original |
---|
| 45 | |
---|
| 46 | # offshore |
---|
| 47 | coast_name = 'Broome_coastline' |
---|
| 48 | |
---|
| 49 | offshore_name = 'Broome_Bathymetry' |
---|
| 50 | offshore_name1 = 'inferred_north' |
---|
| 51 | offshore_name2 = 'inferred_south' |
---|
| 52 | |
---|
| 53 | #final topo name |
---|
| 54 | combined_name ='broome_combined_elevation' |
---|
| 55 | combined_name1 ='broome_combined_elevation1' |
---|
| 56 | combined_name_unclipped1 ='broome_combined_elevation_unclipped1' |
---|
| 57 | combined_small_name = 'broome_combined_elevation_small' |
---|
| 58 | |
---|
| 59 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep+'Feb07'+sep |
---|
| 60 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
| 61 | topographies_time_dir = topographies_dir+build_time+sep |
---|
| 62 | |
---|
| 63 | #input topo file location |
---|
| 64 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 65 | #island_in_dir_name = topographies_in_dir + island_name |
---|
| 66 | |
---|
| 67 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 68 | |
---|
| 69 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
| 70 | offshore_in_dir_name1 = topographies_in_dir + offshore_name1 |
---|
| 71 | offshore_in_dir_name2 = topographies_in_dir + offshore_name2 |
---|
| 72 | |
---|
| 73 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 74 | |
---|
| 75 | #island_dir_name = topographies_dir + island_name |
---|
| 76 | |
---|
| 77 | coast_dir_name = topographies_dir + coast_name |
---|
| 78 | |
---|
| 79 | offshore_dir_name = topographies_dir + offshore_name |
---|
| 80 | offshore_dir_name1 = topographies_dir + offshore_name1 |
---|
| 81 | offshore_dir_name2 = topographies_dir + offshore_name2 |
---|
| 82 | |
---|
| 83 | #final topo files |
---|
| 84 | combined_dir_name = topographies_dir + combined_name |
---|
| 85 | combined_dir_name_unclipped1 = topographies_dir + combined_name_unclipped1 |
---|
| 86 | combined_dir_name1 = topographies_dir + combined_name1 |
---|
| 87 | combined_small_name_dir = topographies_dir + combined_small_name |
---|
| 88 | |
---|
| 89 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
| 90 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 91 | |
---|
| 92 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep |
---|
| 93 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | boundaries_source = 'broome_3854_17042007' |
---|
| 97 | #boundaries locations |
---|
| 98 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep |
---|
| 99 | #boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
| 100 | boundaries_in_dir_name = boundaries_in_dir + boundaries_source |
---|
| 101 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
| 102 | boundaries_dir_name = boundaries_dir + boundaries_source |
---|
| 103 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
| 104 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
| 105 | |
---|
| 106 | #output locations |
---|
| 107 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
| 108 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
| 109 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
| 110 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 111 | |
---|
| 112 | #gauges |
---|
| 113 | beach_gauges = 'beach_gauges.csv' |
---|
| 114 | gauge_name = 'broome_gauges.csv' |
---|
| 115 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
| 116 | beach_gauges = gauges_dir + 'beach_gauges.csv' |
---|
| 117 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 118 | |
---|
| 119 | community_filename = gauges_dir + 'CHINS_v2.csv' |
---|
| 120 | community_broome = gauges_dir + 'community_broome.csv' |
---|
| 121 | |
---|
| 122 | buildings_filename = gauges_dir + 'Broome_res_Project.csv' |
---|
| 123 | buildings_filename_out = 'Broome_res_Project_modified.csv' |
---|
| 124 | |
---|
| 125 | ############################### |
---|
| 126 | # Domain definitions |
---|
| 127 | ############################### |
---|
| 128 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
| 129 | |
---|
| 130 | poly_all = read_polygon(polygons_dir+'extent_small.csv') |
---|
| 131 | #poly_all = read_polygon(polygons_dir+'extent.csv') |
---|
| 132 | res_factor = 2 |
---|
| 133 | #res_poly_all = 500000 |
---|
| 134 | res_poly_all = 150000*res_factor |
---|
| 135 | |
---|
| 136 | ############################### |
---|
| 137 | # Interior region definitions |
---|
| 138 | ############################### |
---|
| 139 | |
---|
| 140 | poly_0 = read_polygon(polygons_dir+'neg20_coast_contour_pts.csv') |
---|
| 141 | #res_0 = 100000 |
---|
| 142 | res_0 = 20000*res_factor |
---|
| 143 | |
---|
| 144 | poly_1 = read_polygon(polygons_dir+'broome_north_coast_inside_extent.csv') |
---|
| 145 | #res_1 = 50000 |
---|
| 146 | res_1 = 5000*res_factor |
---|
| 147 | |
---|
| 148 | poly_2 = read_polygon(polygons_dir+'broome_south_coast_inside_extent.csv') |
---|
| 149 | #res_2 = 50000 |
---|
| 150 | res_2 = 5000*res_factor |
---|
| 151 | |
---|
| 152 | poly_3 = read_polygon(polygons_dir+'Broome_town_pts.csv') |
---|
| 153 | #res_3 = 20000 |
---|
| 154 | res_3 = 2000*res_factor |
---|
| 155 | |
---|
| 156 | #poly_4 = read_polygon(polygons_dir+'Broome_inner_town_pts.csv') |
---|
| 157 | #res_4 = 5000 |
---|
| 158 | #res_4 = 500*res_factor |
---|
| 159 | #assert zone == refzone |
---|
| 160 | |
---|
| 161 | #interior_regions = [[poly_0,res_0],[poly_1,res_1],[poly_2,res_2] |
---|
| 162 | #,[poly_3,res_3],[poly_4,res_4]] |
---|
| 163 | |
---|
| 164 | #trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 165 | |
---|
| 166 | #print 'min number triangles', trigs_min |
---|
| 167 | |
---|
| 168 | #poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
| 169 | |
---|
| 170 | ################################################################### |
---|
| 171 | # Clipping regions for export to asc and regions for clipping data |
---|
| 172 | ################################################################### |
---|
| 173 | |
---|
| 174 | # exporting asc grid |
---|
| 175 | e_min_area = 412900.0 |
---|
| 176 | e_max_area = 422700.0 |
---|
| 177 | n_min_area = 8008555.0 |
---|
| 178 | n_max_area = 8021350.0 |
---|
| 179 | |
---|
| 180 | |
---|
| 181 | |
---|