Changeset 6278


Ignore:
Timestamp:
Feb 5, 2009, 9:36:28 AM (15 years ago)
Author:
kristy
Message:

More on standardised coding style

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/busselton/standardised_version/project.py

    r6276 r6278  
    1818# Note: INUNDATIONHOME is the inundation directory, not the data directory.
    1919
    20 home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name()
     20home = getenv('INUNDATIONHOME')+sep+'data'+sep # Absolute path for data folder
    2121muxhome = getenv('MUXHOME')
    2222user = get_user_name()
     
    7676# Important to distinguish each run - ensure str(user) is included!
    7777# Note, the user is free to include as many parameters as desired
    78 output_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
     78output_comment= join('_', setup, '_', str(tide), '_', str(event_number),
     79                     '_', str(user)
    7980
    8081#------------------------------------------------------------------------------
     
    8283#------------------------------------------------------------------------------
    8384
    84 
    85 # elevation data used in build_busselton.py
     85# elevation data - used in build_busselton.py
     86# Format for ascii grids, as produced in ArcGIS + a projection file
    8687ascii_grid_filenames = [onshore_name,   # Topo
    8788                        offshore_name5] # Busselton Topo
    8889
     90# Format for point is x,y,elevation (with header)
    8991point_filenames = [coast_name,     # Coastline
    9092                   coast_name1,    # Beach survey
     
    9496                   offshore_name3, # 250m
    9597                   offshore_name4] # Bunbury DPI
    96 # onshore data: format ascii grid with accompanying projection file
    97 onshore_name = 'busselton_v2_gda94_mga50'
    98 # coastline: format x,y,elevation (with title)
    99 coast_name = 'Busselton_Contour0.txt'
    100 coast_name1 = 'Busselton_BeachSurvey.txt'
    101 # bathymetry: format x,y,elevation (with title)
    102 offshore_name = 'Busselton_NavyFinal.txt'
    103 offshore_name1 = 'Busselton_Chart.txt'
    104 offshore_name2 = 'Busselton_Digitised.txt'
    105 offshore_name3 = 'Busselton_250m.txt' # for areas that were heading to zero - 2005 Bathymetry grid
    106 offshore_name4 = 'DPI.txt' # for area within Bunbury 500 mesh less than zero generated from TIN
    107 offshore_name5 = 'topo_20m_buss_1km' # for area within Busselton 500 mesh less than zero generated from TIN
    108 
     98
     99# Land used to set the initial stage/water to be offcoast only
     100# Used in run_busselton,py
     101# Format for points easting,northing (no header)
     102mainland_polygon_filename = 'initial_condition.csv'
     103land_polygon_filename = 'initial_condition_land.csv'
     104
     105# Bounding polygon for data clipping and estimate of triangles in mesh
     106# Used in build_busselton.py
     107# Format for points easting,northing (no header)
     108bounding_polygon_filename = 'bounding_polygon.csv'
     109
     110# Interior regions, for designing the mesh - used in run_busselton.py
     111# Format for points easting,northing (no header)                   
     112interior_regions_data = [['busselton_1km.csv', 500],
     113                         ['bunbury_1km.csv', 500],
     114                         ['busselton_2km.csv', 10000],
     115                         ['bunbury_2km.csv', 10000],
     116                         ['island1.csv', 10000],
     117                         ['island2.csv', 10000],
     118                         ['coast_5km_d20m.csv', 40000
    109119# gauges - used in get_timeseries.py
    110 #gauge_name = scenario_name+'.txt'
     120# Format easting,northing,name,elevation (with header)
    111121gauges_filename = 'gauges.csv'
     122
    112123# buildings - used in run_building_inundation.py
     124# Format latitude,longitude etc (not geographic)
    113125building_exposure_filename = 'busselton_res_clip.csv' #from NEXIS
    114126
    115 
    116127# BOUNDING POLYGON - used in build_boundary.py and run_busselton.py respectively
    117 # NOTE: when files are put together the points must be in sequence - for ease go clockwise!
     128# NOTE: when files are put together the points must be in sequence
     129# For ease go clockwise!
    118130# Check the run_busselton.py for boundary_tags
    119 # thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
     131
     132# thinned ordering file from Hazard Map (geographic)
     133# Format is index,latitude,longitude (with header)
    120134urs_order_filename = 'thinned_boundary_ordering.csv'
     135
    121136#landward bounding points
     137# Format easting,northing (no header)
    122138landward_boundary_filename = 'landward_boundary.csv'
    123139
     
    127143#------------------------------------------------------------------------------
    128144# Output filename for elevation
    129 # this is a combination of all the data (utilisied in build_boundary)
     145# this is a combination of all the data generated in build_busselton.py
    130146combined_elevation_basename = scenario_name + '_combined_elevation'
    131147
     
    133149# Directory Structure
    134150#------------------------------------------------------------------------------
    135 anuga_dir = home+state+sep+scenario+sep+'anuga'
    136 topographies_dir = anuga_dir+'topographies'
    137 polygons_dir = anuga_dir+'polygons'
    138 tide_dir = anuga_dir+'tide_data'
    139 boundaries_dir = anuga_dir+'boundaries'
    140 output_dir = anuga_dir+'outputs'+sep
    141 gauges_dir = anuga_dir+'gauges'+sep
    142 meshes_dir = anuga_dir+'meshes'+sep
     151anuga_folder = join(home, state, scenario, 'anuga')
     152topographies_folder = join(anuga_folder, 'topographies')
     153polygons_folder = join(anuga_folder, 'polygons')
     154boundaries_folder = join(anuga_folder, 'boundaries')
     155output_folder = join(anuga_folder, 'outputs')
     156gauges_folder = join(anuga_folder,'gauges')
     157meshes_folder = join(anuga_folder, 'meshes')
    143158
    144159#------------------------------------------------------------------------------
     
    146161#------------------------------------------------------------------------------
    147162
    148 # Where the combined elevation file sits
    149 combined_elevation = topographies_folder + combined_elevation_basename
    150 
    151 # Where the mesh sits (this is created during the run_busselton.py)
    152 meshes = meshes_dir + scenario_name+'.msh'
    153 
    154 # Where the boundary ordering files sit (this is used within build_boundary.py)
    155 urs_order = boundaries_folder+ order_filename
    156 
    157 # Where the landward points of boundary extent sit (this is used within run_busselton.py)
    158 landward_boundary_dir = join(boundaries_dir, landward)
    159 
    160 # Where the event sts files sits (this is created during the build_boundary.py)
    161 boundaries_dir_event = boundaries_dir + str(event_number) + sep
    162 urs_boundary_name = join(boundaries_dir_event,
    163                                  scenario_name)
    164 
    165 
    166 # Where the directory of the output filename sits
    167 output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_busselton.py
    168 output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_busselton.py
    169 output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    170 
    171 # Where the directory of the gauges sit
    172 gauges = gauges_folder + gauges_filename       #used for get_timeseries.py
    173 building_in_dir_name = gauges_dir + building '    #used for run_building_inundation.py
    174 
    175 #------------------------------------------------------------------------------
    176 # Interior region definitions
     163# The absolute pathname of the all elevation, generated in build_busselton.py
     164combined_elevation = join(topographies_folder, combined_elevation_basename)
     165
     166# The absolute pathname of the mesh, generated in run_busselton.py
     167meshes = join(meshes_folder, scenario_name, '.msh')
     168
     169# The absolute pathname for the urs order points, used within build_boundary.py
     170urs_order = join(boundaries_folder, urs_order_filename)
     171
     172# The absolute pathname for the landward points of the bounding polygon,
     173# Used within run_busselton.py)
     174landward_boundary = join(boundaries_folder, landward_boundary_filename)
     175
     176# The absolute pathname for the .sts file, generated in build_boundary.py
     177event_sts = join(boundaries_folder, str(event_number), scenario_name)
     178
     179# The absolute pathname for the output folder names
     180# Used for build_busselton.py
     181output_build = join(output_folder, build_time, dir_comment)
     182# Used for run_busselton.py
     183output_run = join(output_folder, run_time, dir_comment)
     184# Used by post processing
     185output_run_time = join(output_run, scenario_name)
     186
     187# The absolute pathname for the gauges file, used for get_timeseries.py
     188gauges = join(gauges_folder, gauges_filename)       
     189
     190# The absolute pathname for the building file,
     191# Used for run_building_inundation.py
     192building_exposure = join(gauges_folder, building_exposure_filename)
     193
     194#------------------------------------------------------------------------------
     195# Interior region
    177196#------------------------------------------------------------------------------
    178197
    179198# Land, to set the initial stage/water to be offcoast only
    180 mainland_polygon = read_polygon(polygons_dir+'initial_condition.csv')
     199mainland_polygon = read_polygon(join(polygons_folder,
     200                                     mainland_polygon_filename))
    181201
    182202# Land, to set the initial stage/water to be offcoast only
    183 poly_marina = read_polygon(polygons_dir+'initial_condition_marina.csv')
     203land_polygon = read_polygon(join(polygons_folder,
     204                                   land_polygon_filename))
    184205
    185206# Initial bounding polygon for data clipping
    186 bounding_polygon = read_polygon(polygons_dir+'poly_all_extend.csv')
     207bounding_polygon = read_polygon(join(polygons_folder,
     208                                     bounding_polygon_filename))
    187209bounding_maxarea = 100000*scale_factor
    188210
    189 # Area of Interest 1 (Busselton)
    190 aoi1_polygon = read_polygon(polygons_dir+'busselton_1km.csv')
    191 aoi1_maxarea = 500*res_factor
    192 
    193 # Area of Interest 2 (Bunbury)
    194 poly_aoi2 = read_polygon(polygons_dir+'bunbury_1km.csv')
    195 res_aoi2 = 500*res_factor
    196 
    197 # Area of Significance 1 (Busselton)
    198 poly_aos1 = read_polygon(polygons_dir+'busselton_2km.csv')
    199 res_aos1 = 10000*res_factor
    200 
    201 # Area of Significance 2 (Bunbury)
    202 poly_aos2 = read_polygon(polygons_dir+'busselton_2km.csv')
    203 res_aos2 = 10000*res_factor
    204 
    205 # Refined areas
    206 # Polygon designed to islands
    207 poly_aos3 = read_polygon(polygons_dir+'island1.csv')
    208 res_aos3 = 10000*res_factor
    209 poly_aos4 = read_polygon(polygons_dir+'island2.csv')
    210 res_aos4 = 10000*res_factor
    211 
    212 # Shallow water 1
    213 poly_sw1 = read_polygon(polygons_dir+'coast_5km_d20m.csv')
    214 res_sw1 = 40000*res_factor
    215 
    216 # Combined all regions, must check that all are included!
    217 interior_regions = [[aoi1_polygon, aoi1_maxarea],
    218                     [poly_aoi2,res_aoi2],
    219                     [poly_aos1,res_aos1],
    220                     [poly_aos2,res_aos2],
    221                     [poly_aos3,res_aos3],
    222                     [poly_aos4,res_aos4],
    223                     [poly_sw1,res_sw1]]
    224 
    225    
     211interior_regions = []
     212for (filename, maxarea) in interior_regions_data:
     213    polygon = read_polygon(join(polygon_folder, filename)
     214    maxarea = maxarea*scale_factor
     215    interior_regions.append([filename, maxarea])
     216                     
     217   
    226218trigs_min = number_mesh_triangles(interior_regions,
    227                                   poly_all, res_poly_all)
     219                                  bounding_polygon, bounding_maxarea)
    228220print 'min estimated number of triangles', trigs_min
    229221   
Note: See TracChangeset for help on using the changeset viewer.