[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 |
---|
[4132] | 9 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles |
---|
[4094] | 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 |
---|
[3908] | 12 | |
---|
[4094] | 13 | # file and system info |
---|
| 14 | #--------------------------------- |
---|
| 15 | codename = 'project.py' |
---|
[3908] | 16 | |
---|
[4094] | 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 | |
---|
[4094] | 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' |
---|
[4132] | 28 | #print 'gtime: ', gtime |
---|
[4094] | 29 | |
---|
| 30 | tide = 0.6 |
---|
| 31 | |
---|
[3908] | 32 | #Making assumptions about the location of scenario data |
---|
| 33 | state = 'western_australia' |
---|
[4094] | 34 | scenario_name = 'busselton' |
---|
| 35 | scenario = 'busselton_tsunami_scenario_2006' |
---|
[3908] | 36 | |
---|
| 37 | # onshore data provided by WA DLI |
---|
[4094] | 38 | onshore_name = 'DLI_orthophoto_DEM' # original |
---|
| 39 | #islands |
---|
[3908] | 40 | |
---|
| 41 | # AHO + DPI data |
---|
[4094] | 42 | coast_name = '100k_coastline' |
---|
| 43 | offshore_name = 'Bathymetry' |
---|
[3908] | 44 | |
---|
[4094] | 45 | #final topo name |
---|
| 46 | combined_name ='busselton_combined_elevation' |
---|
| 47 | combined_smaller_name = 'busselton_combined_elevation_smaller' |
---|
[3908] | 48 | |
---|
| 49 | |
---|
[4094] | 50 | topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep |
---|
| 51 | topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep |
---|
| 52 | topographies_time_dir = topographies_dir+build_time+sep |
---|
[3908] | 53 | |
---|
[4094] | 54 | #input topo file location |
---|
| 55 | onshore_in_dir_name = topographies_in_dir + onshore_name |
---|
| 56 | #island_in_dir_name = topographies_in_dir + island_name |
---|
[3908] | 57 | |
---|
[4094] | 58 | coast_in_dir_name = topographies_in_dir + coast_name |
---|
| 59 | offshore_in_dir_name = topographies_in_dir + offshore_name |
---|
[3908] | 60 | |
---|
[4094] | 61 | onshore_dir_name = topographies_dir + onshore_name |
---|
| 62 | #island_dir_name = topographies_dir + island_name |
---|
[3908] | 63 | |
---|
[4094] | 64 | coast_dir_name = topographies_dir + coast_name |
---|
| 65 | offshore_dir_name = topographies_dir + offshore_name |
---|
[3908] | 66 | |
---|
[4094] | 67 | #final topo files |
---|
| 68 | combined_dir_name = topographies_dir + combined_name |
---|
| 69 | combined_time_dir_name = topographies_time_dir + combined_name |
---|
| 70 | combined_smaller_dir_name = topographies_dir + combined_smaller_name |
---|
[3908] | 71 | |
---|
[4094] | 72 | meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep |
---|
| 73 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 74 | |
---|
| 75 | polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep |
---|
| 76 | tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep |
---|
| 77 | |
---|
| 78 | boundaries_source = '????' |
---|
| 79 | #boundaries locations |
---|
| 80 | boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep |
---|
| 81 | boundaries_in_dir_name = boundaries_in_dir + scenario_name |
---|
| 82 | boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep |
---|
| 83 | boundaries_dir_name = boundaries_dir + scenario_name |
---|
| 84 | #boundaries_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+build_time+sep |
---|
| 85 | #boundaries_time_dir_name = boundaries_time_dir + boundaries_name #Used by post processing |
---|
| 86 | |
---|
| 87 | #output locations |
---|
| 88 | output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep |
---|
| 89 | output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep |
---|
| 90 | output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep |
---|
| 91 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 92 | |
---|
| 93 | #gauges |
---|
| 94 | gauge_name = '???.csv' |
---|
| 95 | gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep |
---|
| 96 | gauges_dir_name = gauges_dir + gauge_name |
---|
| 97 | |
---|
[4228] | 98 | #buildings_filename = gauges_dir + 'busselton_res_nexis.csv' |
---|
| 99 | buildings_filename_damage_out = 'busselton_res_nexis_modified.csv' |
---|
[4094] | 100 | |
---|
[3908] | 101 | ############################### |
---|
| 102 | # Domain definitions |
---|
| 103 | ############################### |
---|
| 104 | |
---|
| 105 | # bounding box for clipping MOST/URS output (much bigger than study area) |
---|
| 106 | |
---|
| 107 | # bounding polygon for study area |
---|
[4094] | 108 | poly_all = read_polygon(polygons_dir+'poly_all.csv') |
---|
[4143] | 109 | res_poly_all = 100000 |
---|
[3908] | 110 | |
---|
| 111 | ################################################################### |
---|
| 112 | # Clipping regions for export to asc and regions for clipping data |
---|
| 113 | ################################################################### |
---|
| 114 | |
---|
| 115 | # exporting asc grid |
---|
| 116 | eastingmin = 406215.87 |
---|
| 117 | eastingmax = 440208.78 |
---|
| 118 | northingmin = 7983427.73 |
---|
| 119 | northingmax = 8032834.52 |
---|
| 120 | |
---|
| 121 | ############################### |
---|
| 122 | # Interior region definitions |
---|
| 123 | ############################### |
---|
| 124 | |
---|
[4132] | 125 | #digitized polygons |
---|
| 126 | poly_busselton1 = read_polygon(polygons_dir+'neg20_pos10_polygon.csv') |
---|
[4143] | 127 | res_busselton1 = 10000 |
---|
[4132] | 128 | poly_busselton2 = read_polygon(polygons_dir+'neg5_pos5_poly_.csv') |
---|
[4143] | 129 | res_busselton2 = 500 |
---|
[3908] | 130 | |
---|
[4094] | 131 | #plot_polygons([polyAll,poly_broome1,poly_broome2,poly_broome3],'boundingpoly2',verbose=False) |
---|
[3908] | 132 | |
---|
[4132] | 133 | interior_regions = [[poly_busselton1,res_busselton1],[poly_busselton2,res_busselton2]] |
---|
[3908] | 134 | |
---|
[4094] | 135 | trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all) |
---|
| 136 | |
---|
| 137 | print 'min number triangles', trigs_min |
---|
| 138 | |
---|
| 139 | |
---|