Changeset 4094


Ignore:
Timestamp:
Dec 19, 2006, 3:30:10 PM (18 years ago)
Author:
nick
Message:

update busselton

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/busselton_2006/project.py

    r3908 r4094  
    88from time import localtime, strftime, gmtime
    99from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon
     10#from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm
     11from anuga.utilities.system_tools import get_user_name
    1012
    11 if sys.platform == 'win32':
    12     home = getenv('INUNDATIONHOME')
    13     user = getenv('USERPROFILE')
     13# file and system info
     14#---------------------------------
     15codename = 'project.py'
    1416
    15 else:   
    16     home = getenv('INUNDATIONHOME', sep+'d'+sep+'xrd'+sep+'gem'+sep+'2'+sep+'ramp'+sep+'risk_assessment_methods_project'+sep+'inundation')     
    17     user = getenv('LOGNAME')
    18     print 'USER:', user
     17home = getenv('INUNDATIONHOME') #Sandpit's parent dir   
     18user = get_user_name()
    1919
    2020# INUNDATIONHOME is the inundation directory, not the data directory.
    2121home += sep +'data'
    2222
     23#time stuff
     24time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
     25gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir
     26build_time = time+'_build'
     27run_time = time+'_run'
     28print 'gtime: ', gtime
     29
     30tide = 0.6
     31
    2332#Making assumptions about the location of scenario data
    2433state = 'western_australia'
    25 scenario_dir_name = 'busselton_tsunami_scenario_2006'
     34scenario_name = 'busselton'
     35scenario = 'busselton_tsunami_scenario_2006'
    2636
    2737# onshore data provided by WA DLI
    28 onshore_name =  ''# original
     38onshore_name = 'DLI_orthophoto_DEM' # original
     39#islands
    2940
    3041# AHO + DPI data
    31 offshore_name1 = 'XY100011610'
    32 offshore_name2 = 'XY100011611'
    33 offshore_name3 = 'XY100011613'
    34 offshore_name4 = 'XY100011614'
    35 offshore_name5 = 'XY100011616'
    36 offshore_name6 = 'XY100011617'
    37 offshore_name7 = 'XY100011618'
    38 offshore_name8 = 'XY100011621'
    39 offshore_name9 = 'XY100011623'
    40 offshore_name10 = 'XY100011745'
    41 offshore_name11 = 'XY100011746'
    42 offshore_name12 = 'XY100017530'
    43 offshore_name13 = 'XY100017532'
    44 offshore_name14 = 'XY100017538'
    45 offshore_name15 = 'XY100017540'
    46 offshore_name16 = 'XYBR66'
    47 offshore_name17 = 'XYBR70'
    48 offshore_name18 = 'XYBR80'
    49 offshore_name19 = 'XYBR88'
    50 offshore_name20 = 'XYBR93'
    51 offshore_name21 = 'XYBR0110'
    52 offshore_name22 = 'XYWADPI'
     42coast_name = '100k_coastline'
     43offshore_name = 'Bathymetry'
    5344
    54 # developed by NM&I
    55 coast_name = 'coastline'
     45#final topo name
     46combined_name ='busselton_combined_elevation'
     47combined_smaller_name = 'busselton_combined_elevation_smaller'
    5648
    57 boundary_basename = 'SU-AU' # Mw ?
    5849
    59 #swollen/ all data output
    60 basename = 'source'
    61 codename = 'project.py'
     50topographies_in_dir = home+sep+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
     51topographies_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'topographies'+sep
     52topographies_time_dir = topographies_dir+build_time+sep
    6253
    63 #Derive subdirectories and filenames
    64 local_time = strftime('%Y%m%d_%H%M%S',gmtime())
    65 meshdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'meshes'+sep
    66 datadir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'topographies'+sep
    67 gaugedir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'gauges'+sep
    68 polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep
    69 boundarydir = home+sep+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'boundaries'+sep
    70 outputdir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'outputs'+sep
    71 outputtimedir = outputdir + local_time + sep
    72 polygondir = home+sep+state+sep+scenario_dir_name+sep+'anuga'+sep+'polygons'+sep
     54#input topo file location
     55onshore_in_dir_name = topographies_in_dir + onshore_name
     56#island_in_dir_name = topographies_in_dir + island_name
    7357
    74 gauge_filename = gaugedir + 'busselton_gauges.csv'
    75 community_filename = gaugedir + 'CHINS_v2.csv'
    76 community_broome = gaugedir + 'community_busselton.csv'
    77 codedir = getcwd()+sep                           
    78 codedirname = codedir + 'project.py'
    79 meshname = outputtimedir + 'mesh_' + basename
     58coast_in_dir_name = topographies_in_dir + coast_name
     59offshore_in_dir_name = topographies_in_dir + offshore_name
    8060
    81 # Necessary if using point datasets, rather than grid
    82 onshore_dem_name = datadir + onshore_name
    83 offshore_dem_name1 = datadir + offshore_name1
    84 offshore_dem_name2 = datadir + offshore_name2
    85 offshore_dem_name3 = datadir + offshore_name3
    86 offshore_dem_name4 = datadir + offshore_name4
    87 offshore_dem_name5 = datadir + offshore_name5
    88 offshore_dem_name6 = datadir + offshore_name6
    89 offshore_dem_name7 = datadir + offshore_name7
    90 offshore_dem_name8 = datadir + offshore_name8
    91 offshore_dem_name9 = datadir + offshore_name9
    92 offshore_dem_name10 = datadir + offshore_name10
    93 offshore_dem_name11 = datadir + offshore_name11
    94 offshore_dem_name12 = datadir + offshore_name12
    95 offshore_dem_name13 = datadir + offshore_name13
    96 offshore_dem_name14 = datadir + offshore_name14
    97 offshore_dem_name15 = datadir + offshore_name15
    98 offshore_dem_name16 = datadir + offshore_name16
    99 offshore_dem_name17 = datadir + offshore_name17
    100 offshore_dem_name18 = datadir + offshore_name18
    101 offshore_dem_name19 = datadir + offshore_name19
    102 offshore_dem_name20 = datadir + offshore_name20
    103 offshore_dem_name21 = datadir + offshore_name21
    104 offshore_dem_name22 = datadir + offshore_name22
     61onshore_dir_name = topographies_dir + onshore_name
     62#island_dir_name = topographies_dir + island_name
    10563
    106 coast_dem_name = datadir + coast_name
     64coast_dir_name = topographies_dir + coast_name
     65offshore_dir_name = topographies_dir + offshore_name
    10766
    108 combined_dem_name   = datadir + 'broome_combined_elevation'
     67#final topo files
     68combined_dir_name = topographies_dir + combined_name
     69combined_time_dir_name = topographies_time_dir + combined_name
     70combined_smaller_dir_name = topographies_dir + combined_smaller_name
     71
     72meshes_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'meshes'+sep
     73meshes_dir_name = meshes_dir + scenario_name
     74
     75polygons_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'polygons'+sep
     76tide_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'tide_data'+sep
     77
     78boundaries_source = '????'
     79#boundaries locations
     80boundaries_in_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep+'urs'+sep+boundaries_source+sep
     81boundaries_in_dir_name = boundaries_in_dir + scenario_name
     82boundaries_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'boundaries'+sep
     83boundaries_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
     88output_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep
     89output_build_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+build_time+sep
     90output_run_time_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'outputs'+sep+run_time+sep
     91output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
     92
     93#gauges
     94gauge_name = '???.csv'
     95gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
     96gauges_dir_name = gauges_dir + gauge_name
     97
    10998
    11099###############################
     
    113102
    114103# bounding box for clipping MOST/URS output (much bigger than study area)
    115 ##south = degminsec2decimal_degrees(-19,0,0)
    116 ##north = degminsec2decimal_degrees(-17,15,0)
    117 ##west  = degminsec2decimal_degrees(120,0,0)
    118 ##east  = degminsec2decimal_degrees(122,30,0)
    119 ##
    120 ##d0 = [south, west]
    121 ##d1 = [south, east]
    122 ##d2 = [north, east]
    123 ##d3 = [north, west]
    124 ##poly_bc, zone = convert_points_from_latlon_to_utm([d0, d1, d2, d3])
    125 ##refzone = zone
    126104
    127105# bounding polygon for study area
    128 polyAll = read_polygon(polygondir+'extent.csv')
     106poly_all = read_polygon(polygons_dir+'poly_all.csv')
     107res_poly_all = 100000
    129108
    130 # plot bounding polygon and make sure BC info surrounds it
    131 #plot_polygons([polyAll, poly_bc],'boundingpoly',verbose=False)
    132 print 'Area of bounding polygon', polygon_area(polyAll)/1000000.0
    133109
     110'''
    134111###################################################################
    135112# Clipping regions for export to asc and regions for clipping data
     
    147124
    148125# broome digitized polygons
    149 poly_busselton1 = read_polygon(polygondir+'buss_Local_Polygon_update.csv')
    150 poly_busselton2 = read_polygon(polygondir+'buss_Close2_update.csv')
    151 poly_busselton3 = read_polygon(polygondir+'buss_Coast_update.csv')
     126poly_busselton1 = read_polygon(polygons_dir+'buss_Local_Polygon_update.csv')
     127res_busselton1 = 500000
     128poly_busselton2 = read_polygon(polygons_dir+'buss_Close2_update.csv')
     129res_busselton2 = 500000
     130poly_busselton3 = read_polygon(polygons_dir+'buss_Coast_update.csv')
     131res_busselton3 = 500000
    152132
    153 plot_polygons([polyAll,poly_broome1,poly_broome2,poly_broome3],'boundingpoly2',verbose=False)
    154 print 'Area of local polygon', polygon_area(poly_broome1)/1000000.0
    155 print 'Area of close polygon', polygon_area(poly_broome2)/1000000.0
    156 print 'Area of coastal polygon', polygon_area(poly_broome3)/1000000.0
     133#plot_polygons([polyAll,poly_broome1,poly_broome2,poly_broome3],'boundingpoly2',verbose=False)
    157134
    158 for i in poly_broome3:
    159     v = is_inside_polygon(i,poly_broome1, verbose=False)
    160     if v == False: print v
     135interior_regions = [[poly_busselton1,res_busselton1],[poly_busselton2,res_busselton2],
     136                    [poly_busselton3,res_busselton3]]
     137#trigs_all = polygon_area(poly_all)/res_poly_all
     138#trigs_bus1 = polygon_area(poly_busselton1)/res_busselton1
     139#trigs_bus2 = polygon_area(poly_busselton2)/res_busselton2
     140#trigs_bus3 = polygon_area(poly_busselton3)/res_busselton3
     141#trigs_min = trigs_bound + trigs_pos + trigs_cbd + trigs_penguin
     142
     143#print 'Area of bounding poly', trigs_all
     144#print 'Area of busselton1', trigs_bus1
     145#print 'Area of busselton2', trigs_bus2
     146#print 'Area of busselton3', trigs_bus3
     147#print 'min number triangles', trigs_min
     148
     149trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
     150
     151print 'min number triangles', trigs_min
    161152
    162153def number_mesh_triangles(interior_regions, bounding_poly, remainder_res):
     
    173164    no_triangles += area/remainder_res
    174165    return int(no_triangles/0.7)
     166'''
     167
Note: See TracChangeset for help on using the changeset viewer.