[4547] | 1 | # -*- coding: cp1252 -*- |
---|
| 2 | """Common filenames and locations for topographic data, meshes and outputs. |
---|
| 3 | """ |
---|
| 4 | |
---|
| 5 | |
---|
| 6 | from os import sep, environ, getenv, getcwd,umask |
---|
| 7 | from os.path import expanduser |
---|
| 8 | import sys |
---|
| 9 | from time import localtime, strftime, gmtime |
---|
[4856] | 10 | from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, \ |
---|
[4547] | 11 | number_mesh_triangles, polygon_area |
---|
| 12 | from anuga.utilities.system_tools import get_user_name |
---|
| 13 | |
---|
| 14 | |
---|
| 15 | # file and system info |
---|
| 16 | #--------------------------------- |
---|
| 17 | codename = 'project.py' #used in copy_code_files |
---|
| 18 | |
---|
| 19 | home = getenv('INUNDATIONHOME') #Sandpit's parent dir |
---|
| 20 | user = get_user_name() |
---|
| 21 | #needed when running using mpirun, mpirun doesn't inherit umask from .bashrc |
---|
| 22 | umask(002) |
---|
| 23 | |
---|
| 24 | print home |
---|
| 25 | |
---|
| 26 | # INUNDATIONHOME is the inundation directory, not the data directory. |
---|
| 27 | home =home + sep +'data' |
---|
| 28 | |
---|
| 29 | |
---|
| 30 | time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir |
---|
| 31 | build_time = time+'_build' |
---|
| 32 | run_time = time+'_run' |
---|
| 33 | print 'time: ', time |
---|
| 34 | |
---|
| 35 | tide = 0.0 |
---|
| 36 | |
---|
| 37 | #Making assumptions about the location of scenario data |
---|
| 38 | state = 'sri_lanka' |
---|
| 39 | scenario_name = 'galle' |
---|
| 40 | scenario = 'scenario_galle' |
---|
| 41 | ''' |
---|
| 42 | # onshore data provided by WA DLI |
---|
| 43 | onshore_name = 'DLI_DTED_raster_clipped' # original |
---|
| 44 | |
---|
| 45 | # AHO + DPI data + colin French coastline |
---|
| 46 | coast_name = 'coastline_edited_w_DEM' |
---|
| 47 | offshore_name = 'clipped_bathy' |
---|
| 48 | offshore1_name = 'elev_501' |
---|
| 49 | offshore2_name = 'inferrec_e' |
---|
| 50 | |
---|
| 51 | #final topo name |
---|
| 52 | combined_name ='dampier_combined_elevation' |
---|
| 53 | combined_smaller_name = 'dampier_combined_elevation_small' |
---|
| 54 | combined_smallest_name = 'dampier_combined_elevation_smallest' |
---|
| 55 | ''' |
---|
| 56 | anuga_dir = home+sep+state+sep+scenario+sep+'anuga'+sep |
---|
| 57 | |
---|
| 58 | #topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+ |
---|
| 59 | topographies_dir = anuga_dir+'topographies'+sep |
---|
| 60 | |
---|
| 61 | # Filenames |
---|
| 62 | #data_dir = 'deliverables' + sep + 'points' + sep |
---|
| 63 | galle_dem_name = topographies_dir + 'galle' |
---|
| 64 | hikka_dem_name = topographies_dir + 'hikka' |
---|
| 65 | coast_name = topographies_dir + 'Coast' |
---|
| 66 | topo_dem_name = topographies_dir + 'topo' |
---|
| 67 | bathycoa_dem_name = topographies_dir + 'bathycoa' |
---|
| 68 | bathyfine_dem_name = topographies_dir + 'bathyfine' |
---|
| 69 | canal_dem_name = topographies_dir + 'canal' |
---|
| 70 | fort_dem_name = topographies_dir + 'gallefort' |
---|
| 71 | |
---|
| 72 | combined_dem_name = topographies_dir + 'combined' |
---|
| 73 | combined_canal_dem_name = topographies_dir + 'combined_canal' |
---|
| 74 | combined_small_dem_name = topographies_dir + 'combined_small' |
---|
| 75 | combined_canal_fort_dem_name = topographies_dir + 'combined_canal_fort' |
---|
| 76 | |
---|
| 77 | |
---|
| 78 | polygons_dir = anuga_dir+'polygons'+sep |
---|
| 79 | |
---|
| 80 | meshes_dir = anuga_dir+'meshes'+sep |
---|
| 81 | meshes_dir_name = meshes_dir + scenario_name |
---|
| 82 | |
---|
| 83 | #boundaries locations |
---|
| 84 | boundaries_name = 'Sumatra2004_crop' |
---|
| 85 | |
---|
| 86 | boundaries_in_dir = anuga_dir+'boundaries'+sep+'most'+sep |
---|
| 87 | boundaries_in_dir_name = boundaries_in_dir + boundaries_name |
---|
| 88 | boundaries_dir = anuga_dir+'boundaries'+sep |
---|
| 89 | boundaries_dir_name = boundaries_dir + boundaries_name |
---|
| 90 | |
---|
| 91 | #output locations |
---|
| 92 | output_dir = anuga_dir+'outputs'+sep |
---|
| 93 | output_build_time_dir = output_dir+build_time+sep |
---|
| 94 | output_run_time_dir = output_dir +run_time+sep |
---|
| 95 | output_run_time_dir_name = output_run_time_dir + scenario_name #Used by post processing |
---|
| 96 | |
---|
| 97 | |
---|
| 98 | ############################### |
---|
| 99 | # Domain definitions |
---|
| 100 | ############################### |
---|
| 101 | |
---|
| 102 | # poly_clip is used to remove small part from the large coarse 100m data set, |
---|
| 103 | # this hole is then filled with the high res 5m data |
---|
| 104 | print 'poly dir',polygons_dir |
---|
| 105 | poly_clip = read_polygon(polygons_dir+ 'poly.csv') |
---|
| 106 | |
---|
| 107 | # bounding polygon for study area |
---|
| 108 | bounding_polygon = read_polygon(polygons_dir+'regional.csv') |
---|
| 109 | res_factor=1 |
---|
| 110 | regional_res = 100000*res_factor |
---|
| 111 | print 'Area of bounding polygon', polygon_area(bounding_polygon)/1000000.0 |
---|
| 112 | |
---|
| 113 | ############################### |
---|
| 114 | # Interior region definitions |
---|
| 115 | ############################### |
---|
| 116 | |
---|
| 117 | # interior polygons |
---|
| 118 | #poly_shallow1 = read_polygon(polygons_dir+'hikkaduwa.csv') |
---|
| 119 | #poly_shallow2 = read_polygon(polygons_dir+'galle.csv') |
---|
| 120 | |
---|
| 121 | poly_intermediate = read_polygon(polygons_dir+'intermediate.csv') |
---|
| 122 | poly_shallow = read_polygon(polygons_dir+'shallow.csv') |
---|
| 123 | poly_coast = read_polygon(polygons_dir+'coastmesh.csv') |
---|
| 124 | poly_canal = read_polygon(polygons_dir+'canalmesh.csv') |
---|
| 125 | |
---|
| 126 | intermediate_res = 20000*res_factor |
---|
| 127 | shallow_res = 2000*res_factor |
---|
| 128 | coast_res = 250*res_factor |
---|
| 129 | canal_res = 10*res_factor |
---|
| 130 | interior_regions = [[poly_intermediate, intermediate_res], |
---|
| 131 | [poly_shallow, shallow_res], |
---|
| 132 | [poly_coast, coast_res], |
---|
| 133 | [poly_canal, canal_res]] |
---|
| 134 | |
---|
[4856] | 135 | #plot_polygons([bounding_polygon,poly_intermediate,\ |
---|
[4547] | 136 | # poly_shallow,poly_coast,poly_canal],\ |
---|
[4853] | 137 | # figname='boundingpoly',verbose=False) |
---|
[4547] | 138 | |
---|
| 139 | trigs_min = number_mesh_triangles(interior_regions, bounding_polygon, regional_res) |
---|
| 140 | |
---|
| 141 | print 'min number triangles', trigs_min |
---|
| 142 | |
---|
| 143 | poly_mainland = read_polygon(polygons_dir+'Initial_Condition.csv') |
---|
| 144 | |
---|
| 145 | |
---|
| 146 | ################################################################### |
---|
| 147 | # Clipping regions for export to asc and regions for clipping data |
---|
| 148 | ################################################################### |
---|
| 149 | |
---|
| 150 | # exporting asc grid |
---|
| 151 | #eastingmin = 363000 |
---|
| 152 | #eastingmax = 418000 |
---|
| 153 | #northingmin = 8026600 |
---|
| 154 | #northingmax = 8145700 |
---|
| 155 | |
---|
| 156 | #for clipping (most) boundary file |
---|
| 157 | #south_source = |
---|
| 158 | #north_source = |
---|
| 159 | #west_source = |
---|
| 160 | #east_source = |
---|
| 161 | |
---|
| 162 | |
---|
| 163 | #gauge_filename = 'gauges.csv' |
---|