"""Common filenames and locations for topographic data, meshes and outputs. Also includes origin for slump scenario. """ from os import sep, environ, getenv, getcwd from os.path import expanduser from anuga.utilities.polygon import read_polygon, polygon_area import sys from anuga.coordinate_transforms.redfearn import convert_from_latlon_to_utm from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees from time import localtime, strftime, gmtime #Making assumptions about the location of scenario data state = 'western_australia' scenario_dir_name = 'onslow_tsunami_scenario_2006' scenario_name = 'onslow' # 250m data to be provided coarsename = 'onsl_bathydem250' # get from Neil/Ingo (DEM or topo data) # 30m data to be provided onshore_name_dted = 'onslow_onshore_30m_dted2' # get from Neil/Ingo (DEM or topo data) # 20m data to be provided onshore_name_dli = 'onslow_onshore_20m_dli' # get from Neil/Ingo (DEM or topo data) coast_name = 'onslow_coast' islands_name = 'onslow_islands_dted2' offshore_name = 'onslow_offshore_points' boundary_basename = 'SU-AU_clip' #swollen/ all data output basename = 'source' codename = 'project.py' if sys.platform == 'win32': home = getenv('INUNDATIONHOME') # python_home = getenv('PWD') # home = environ['INUNDATIONHOME'] #Sandpit's parent dir user = getenv('USERPROFILE') # user = basename(user_path) else: home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation') user = getenv('LOGNAME') print 'USER:', user # INUNDATIONHOME is the inundation directory, not the data directory. home += sep +'data' #Derive subdirectories and filenames #time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir local_time = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep boundarydir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep #output dir without time outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep tidedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'tide_data'+sep comparereportdir = '..'+sep+'..'+sep+'documentation'+sep+'experimentation'+sep+'boundary_ANUGA_MOST'+sep+'report' outputtimedir = outputdir + local_time + sep print'bound', boundarydir #gauge_filename = gaugedir + 'onslow_gauges.xya' #for MOST gauge_filename = gaugedir + 'gauge_location_onslow.csv' gauge_filename_bindi = gaugedir + 'gauge_location_bindi.csv' gauges50 = gaugedir + '50_gauges.xya' gauge_comparison = gaugedir + 'MOST_comparison_gauges.xya' gauge_comparison_3d = gaugedir + 'MOST_comparison_gauges_3d.xya' community_filename = gaugedir + 'CHINS_v2.csv' community_scenario = gaugedir + 'community_onslow.csv' #buildings_filename = gaugedir + 'onslow_res.csv' buildings_filename = gaugedir + 'extra_points_nbed.csv' #buildings_filename_out = gaugedir + 'onslow_res_modified.csv' buildings_filename_damage_out = 'extra_points_nbed_modified.csv' gaugetimeseries = gaugedir + 'onslow' tidal_filename = tidedir + 'onsl.txt' tidal_outname = tidedir + 'max_min.txt' # boundary source data #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 codedir = getcwd()+sep codedirname = codedir + 'project.py' #meshname = meshdir + basename meshname = outputtimedir + 'mesh_' + basename print 'meshname',meshname coarsedemname = datadir + coarsename onshore_dem_name = datadir + onshore_name_dli offshore_dem_name = datadir + offshore_name coast_dem_name = datadir + coast_name islands_dem_name = datadir + islands_name combined_dem_name = datadir + 'onslow_combined_elevation' outputname = outputtimedir + basename #Used by post processing #!gauge_filename = outputdir + 'onslow_gauges.xya' #!gauge_outname = outputdir + 'gauges_max_output.xya' # clipping region to make DEM (pts file) from fine elevation data eastingmin = 240000 eastingmax = 340000 northingmin = 7580000 northingmax = 7700000 south = degminsec2decimal_degrees(-22,15,0) north = degminsec2decimal_degrees(-20,30,0) west = degminsec2decimal_degrees(114,15,0) east = degminsec2decimal_degrees(115,50,0) ''' # region for visualisation eminviz = 260000 emaxviz = 320000 nminviz = 7590000 nmaxviz = 7630000 ''' # region to export e_min_area = 300000 e_max_area = 310000 n_min_area = 7600000 n_max_area = 7610000 # region to export to make elevation map: JS 22/9/06 - NOTE, this won't # work as region needs to be inside bounding box (polyAll)!! e_min_area = 240000 e_max_area = 340000 n_min_area = 7580000 n_max_area = 7690000 export_region = [[e_min_area, n_min_area], [e_min_area, n_max_area], [e_max_area, n_max_area], [e_max_area, n_min_area]] #Georeferencing from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees refzone = 50 #Updated Main Domain of Onslow: first run NB 6/4/06 d0 = [310000, 7690000] d1 = [280000, 7690000] d2 = [270000, 7645000] d3 = [240000, 7625000] d4 = [270000, 7580000] d5 = [300000, 7590000] d6 = [340000, 7610000] polyAll = [d0, d1, d2, d3, d4, d5, d6] print 'bounding polygon area', polygon_area(polyAll)/1000000.0 polygons = [polyAll, export_region] figname = 'checking.png' #from anuga.utilities.polygon import plot_polygons #plot_polygons(polygons, figname, verbose = False) #print figname #Interior region - Onslow town #first run! #i0 = [304000, 7608000] #i1 = [302000, 7605000] #i2 = [303000, 7602000] #i3 = [305000, 7601000] #i4 = [309000, 7603000] #i5 = [307000, 7606500] #refined run #i0 = [304000, 7607000] #i1 = [302000, 7605000] #i2 = [304000, 7603000] #i3 = [307000, 7602000] #i4 = [309000, 7603000] #i5 = [307000, 7606000] #for visualisation #i0 = [304000, 7609000] #i1 = [301500, 7605000] #i2 = [304000, 7603000] #i3 = [307000, 7602000] #i4 = [309000, 7603000] #i5 = [311000, 7607000] #i0 = [304000, 7608000] i0 = [304000, 7607000] i1 = [302000, 7605000] #i2 = [303000, 7602000] i2 = [304000, 7603000] #i3 = [305000, 7601000] i3 = [307000, 7602000] i4 = [309000, 7603000] #i5 = [307000, 7606500] i5 = [307000, 7606000] poly_onslow = [i0, i1, i2, i3, i4, i5] print 'onslow polygon area', polygon_area(poly_onslow)/1000000.0 #Thevenard Island j0 = [294000, 7629000] j1 = [285000, 7625000] j2 = [294000, 7621000] j3 = [299000, 7625000] poly_thevenard = [j0, j1, j2, j3] print 'thevenard polygon area', polygon_area(poly_thevenard)/1000000.0 ''' # Direction Is k0 = [309000, 7619000] k1 = [304000, 7619000] k2 = [304000, 7616500] k3 = [309000, 7616500] poly_direction = [k0, k1, k2, k3] ''' #med res around onslow l0 = [300000, 7610000] l1 = [285000, 7600000] l2 = [300000, 7597500] l3 = [310000, 7600000] l4 = [315000, 7610000] #l5 = [310000, 7612500] #poly_coast = [l0, l1, l2, l3, l4, l5] poly_coast = [l0, l1, l2, l3, l4] print 'coast polygon area', polygon_area(poly_coast)/1000000.0 #general coast and local area to onslow region m0 = [270000, 7581000] m1 = [300000, 7591000] m2 = [339000, 7610000] m3 = [330000, 7630000] m4 = [290000, 7640000] m5 = [260000, 7600000] poly_region = [m0, m1, m2, m3, m4, m5] print 'region polygon area', polygon_area(poly_region)/1000000.0