[3908] | 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 |
---|
[4133] | 9 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles |
---|
[3908] | 10 | #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm |
---|
[4080] | 11 | from anuga.utilities.system_tools import get_user_name |
---|
[3908] | 12 | |
---|
[4077] | 13 | # file and system info |
---|
| 14 | #--------------------------------- |
---|
| 15 | codename = 'project.py' |
---|
[3908] | 16 | |
---|
[4077] | 17 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
| 18 | user = get_user_name() |
---|
[3908] | 19 | |
---|
| 20 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 21 | home += sep +'data' |
---|
| 22 | |
---|
[4080] | 23 | #time stuff |
---|
| 24 | time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir |
---|
| 25 | gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 26 | build_time = time+'_build' |
---|
| 27 | run_time = time+'_run' |
---|
| 28 | print 'gtime: ', gtime |
---|
| 29 | |
---|
[4081] | 30 | tide = 0.6 |
---|
| 31 | |
---|
[3908] | 32 | #Making assumptions about the location of scenario data |
---|
| 33 | state = 'western_australia' |
---|
[4077] | 34 | scenario_name = 'perth' |
---|
[4080] | 35 | scenario = 'perth_tsunami_scenario_2006' |
---|
[3908] | 36 | |
---|
| 37 | # onshore data provided by WA DLI |
---|
[4077] | 38 | onshore_name = 'perth_dli_ext' # original |
---|
| 39 | #island |
---|
| 40 | island_name = 'rott_dli_ext' # original |
---|
| 41 | island_name1 = 'gard_dli_ext' |
---|
| 42 | island_name2 = 'carnac_island_dted' |
---|
[4080] | 43 | island_name3 = 'penguin_dted' |
---|
[3908] | 44 | |
---|
[4147] | 45 | # AHO + DPI data + colin French coastline |
---|
[4077] | 46 | coast_name = 'waterline' |
---|
| 47 | offshore_name = 'perth_bathymetry' |
---|
[4091] | 48 | offshore1_name = 'missing_fairsheets' |
---|
[3908] | 49 | |
---|
[4077] | 50 | #final topo name |
---|
| 51 | combined_name ='perth_combined_elevation' |
---|
[4091] | 52 | combined_smaller_name = 'perth_combined_elevation_smaller' |
---|
[3908] | 53 | |
---|
[4091] | 54 | |
---|
[4080] | 55 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
| 56 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
[4077] | 57 | topographies_time_dir = topographies_dir+build_time+sep |
---|
[3908] | 58 | |
---|
[4147] | 59 | # input topo file location |
---|
[4080] | 60 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 61 | island_in_dir_name = topographies_in_dir + island_name |
---|
| 62 | island_in_dir_name1 = topographies_in_dir + island_name1 |
---|
| 63 | island_in_dir_name2 = topographies_in_dir + island_name2 |
---|
| 64 | island_in_dir_name3 = topographies_in_dir + island_name3 |
---|
| 65 | |
---|
| 66 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 67 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
[4091] | 68 | offshore1_in_dir_name = topographies_in_dir + offshore1_name |
---|
[4080] | 69 | |
---|
[4077] | 70 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 71 | island_dir_name = topographies_dir + island_name |
---|
| 72 | island_dir_name1 = topographies_dir + island_name1 |
---|
| 73 | island_dir_name2 = topographies_dir + island_name2 |
---|
[4080] | 74 | island_dir_name3 = topographies_dir + island_name3 |
---|
[3908] | 75 | |
---|
[4077] | 76 | coast_dir_name = topographies_dir + coast_name |
---|
| 77 | offshore_dir_name = topographies_dir + offshore_name |
---|
| 78 | |
---|
| 79 | #final topo files |
---|
| 80 | combined_dir_name = topographies_dir + combined_name |
---|
| 81 | combined_time_dir_name = topographies_time_dir + combined_name |
---|
[4091] | 82 | combined_smaller_name_dir = topographies_dir + combined_smaller_name |
---|
[4080] | 83 | #combined_time_dir_final_name = topographies_time_dir + combined_final_name |
---|
[4077] | 84 | |
---|
| 85 | |
---|
[3908] | 86 | |
---|
[4080] | 87 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
[4077] | 88 | meshes_dir_name = meshes_dir + scenario_name |
---|
[3908] | 89 | |
---|
[4080] | 90 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep |
---|
| 91 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
[3908] | 92 | |
---|
[4080] | 93 | |
---|
[4091] | 94 | boundaries_source = '????' |
---|
[4077] | 95 | #boundaries locations |
---|
[4080] | 96 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
| 97 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
| 98 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
| 99 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
| 100 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
[4077] | 101 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
[3908] | 102 | |
---|
[4077] | 103 | #output locations |
---|
[4080] | 104 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
| 105 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
| 106 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
[4077] | 107 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 108 | |
---|
| 109 | #gauges |
---|
| 110 | gauge_name = 'perth.csv' |
---|
[4080] | 111 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
[4077] | 112 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 113 | |
---|
| 114 | |
---|
[3908] | 115 | ############################### |
---|
| 116 | # Domain definitions |
---|
| 117 | ############################### |
---|
[4077] | 118 | from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon |
---|
[3908] | 119 | |
---|
[4133] | 120 | poly_all = read_polygon(polygons_dir+'bounding_poly.csv') |
---|
| 121 | res_poly_all = 100000 |
---|
[3908] | 122 | |
---|
[4077] | 123 | refzone = 50 |
---|
[3908] | 124 | |
---|
| 125 | |
---|
[4091] | 126 | ############################### |
---|
| 127 | # Interior region definitions |
---|
| 128 | ############################### |
---|
[4077] | 129 | |
---|
[4133] | 130 | #poly_pos20_neg20 = read_polygon(polygons_dir+'pos20_neg20pts.csv') |
---|
| 131 | poly_pos20_neg20 = read_polygon(polygons_dir+'pos20_neg20_new_pts.csv') |
---|
| 132 | res_pos20_neg20 = 20000 |
---|
[4077] | 133 | |
---|
[4133] | 134 | #poly_cbd = read_polygon(polygons_dir+'cbd_pts.csv') |
---|
| 135 | poly_cbd = read_polygon(polygons_dir+'cbd_new_pts.csv') |
---|
| 136 | res_cbd = 1000 |
---|
[4077] | 137 | |
---|
| 138 | poly_penguin = read_polygon(polygons_dir+'penguin_pts.csv') |
---|
[4133] | 139 | res_penguin = 1000 |
---|
[4080] | 140 | #assert zone == refzone |
---|
[4077] | 141 | |
---|
[4133] | 142 | interior_regions = [[poly_pos20_neg20,res_pos20_neg20],[poly_cbd,res_cbd] |
---|
| 143 | ,[poly_penguin,res_penguin]] |
---|
[4077] | 144 | |
---|
[4133] | 145 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 146 | |
---|
[4091] | 147 | print 'min number triangles', trigs_min |
---|
[4081] | 148 | |
---|
[3908] | 149 | ################################################################### |
---|
| 150 | # Clipping regions for export to asc and regions for clipping data |
---|
| 151 | ################################################################### |
---|
[4091] | 152 | |
---|
[3908] | 153 | # exporting asc grid |
---|
| 154 | eastingmin = 406215.87 |
---|
| 155 | eastingmax = 440208.78 |
---|
| 156 | northingmin = 7983427.73 |
---|
| 157 | northingmax = 8032834.52 |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | |
---|