Ignore:
Timestamp:
Sep 26, 2008, 11:25:31 AM (16 years ago)
Author:
kristy
Message:

Updated scripts to reflect perth. Also added the 250m scripts and used more than one polygon for initial condition

File:
1 edited

Legend:

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

    r5755 r5790  
    1 # -*- coding: cp1252 -*-
    2 """Common filenames and locations for topographic data, meshes and outputs.
     1"""Common filenames and locations for elevation, meshes and outputs.
     2This script is the heart of all scripts in the folder
    33"""
     4#------------------------------------------------------------------------------
     5# Import necessary modules
     6#------------------------------------------------------------------------------
    47
    58from os import sep, environ, getenv, getcwd
     
    811from time import localtime, strftime, gmtime
    912from anuga.utilities.polygon import read_polygon, plot_polygons, is_inside_polygon, number_mesh_triangles
    10 #from anuga.coordinate_transforms.redfearn import degminsec2decimal_degrees, convert_points_from_latlon_to_utm
    1113from anuga.utilities.system_tools import get_user_name, get_host_name
    1214from anuga.shallow_water.data_manager import urs2sts,create_sts_boundary
    1315from anuga.utilities.polygon import read_polygon, plot_polygons, polygon_area, is_inside_polygon
    1416
    15 # file and system info
    16 #---------------------------------
    17 #codename = 'project.py'
     17#------------------------------------------------------------------------------
     18# Directory setup
     19#------------------------------------------------------------------------------
     20# Note: INUNDATIONHOME is the inundation directory, not the data directory.
    1821
    1922home = getenv('INUNDATIONHOME') + sep +'data'+sep #Sandpit's parent diruser = get_user_name()
     
    2225host = get_host_name()
    2326
    24 # INUNDATIONHOME is the inundation directory, not the data directory.
    25 
    26 #time stuff
    27 time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
    28 gtime = strftime('%Y%m%d_%H%M%S',gmtime()) #gets time for new dir
     27# determines time for setting up output directories
     28time = strftime('%Y%m%d_%H%M%S',localtime())
     29gtime = strftime('%Y%m%d_%H%M%S',gmtime())
    2930build_time = time+'_build'
    3031run_time = time+'_run'
    31 print 'gtime: ', gtime
    32 
    33 #Making assumptions about the location of scenario data
     32
     33#------------------------------------------------------------------------------
     34# Initial Conditions
     35#------------------------------------------------------------------------------
     36
     37# this section needs to be updated to reflect the modelled community.
     38# Note, the user needs to set up the directory system accordingly
    3439state = 'western_australia'
    3540scenario_name = 'carnarvon'
    3641scenario = 'carnarvon_tsunami_scenario'
    3742
    38 
    39 tide = 0.0 #1.0
    40 
    41 alpha = 0.1
    42 friction=0.01
    43 starttime=0
    44 finaltime=1000
    45 export_cellsize=25
    46 setup='final'
    47 source='polyline'
     43# Model specific parameters. One or all can be changed each time the
     44# run_scenario script is executed
     45tide = 0                #0.6
     46#event_number = 27255   # linked to hazard map
     47event_number = 27283
     48alpha = 0.1             # smoothing parameter for mesh
     49friction=0.01           # manning's friction coefficient
     50starttime=0             
     51finaltime=80000         # final time for simulation
     52
     53setup='final'  # Final can be replaced with trial or basic.
     54               # Either will result in a coarser mesh that will allow a
     55               # faster, but less accurate, simulation.
    4856
    4957if setup =='trial':
     
    6371    yieldstep=60
    6472
    65 dir_comment='_'+setup+'_'+str(tide)+'_'+str(source)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
    66 
    67 # onshore data provided by WA DLI
    68 onshore_name = 'bathy250_clipland' # original
    69 
    70 # AHO + DPI data + colin French coastline
    71 coast_name = 'DPI_coastlineP'
    72 offshore_name = 'Shark_Bay_Clip'
    73 offshore_name1 = 'XYAHD_Clip'
    74 offshore_name2 = 'DPI_data'
    75 
    76 
    77 #final topo name
    78 combined_name = scenario_name+'_combined_elevation'
    79 combined_smaller_name = scenario_name+'_combined_elevation_smaller'
    80 
     73#------------------------------------------------------------------------------
     74# Output Filename
     75#------------------------------------------------------------------------------
     76# Important to distinguish each run - ensure str(user) is included!
     77# Note, the user is free to include as many parameters as desired
     78dir_comment='_'+setup+'_'+str(tide)+'_'+str(event_number)+'_'+ 'alpha' +str(alpha)+'_'+str(user)
     79
     80#------------------------------------------------------------------------------
     81# Input Data
     82#------------------------------------------------------------------------------
     83
     84# elevation data used in build_carnarvon.py
     85# onshore data: format ascii grid with accompanying projection file
     86onshore_name = 'dem_onshore'
     87# coastline: format x,y,elevation (with title)
     88coast_name = 'coastline.txt'
     89# bathymetry: format x,y,elevation (with title)
     90offshore_name = 'Shark_Bay_Clip.txt'
     91offshore_name1 = 'XYAHD_Clip.txt'
     92offshore_name2 = 'DPI_data.txt'
     93
     94# gauges - used in get_timeseries.py
     95gauge_name = 'carnarvon.csv'
     96gauge_name2 = 'thinned_MGA50.csv'
     97
     98# BOUNDING POLYGON - used in build_boundary.py and run_carnarvon.py respectively
     99# NOTE: when files are put together the points must be in sequence - for ease go clockwise!
     100# Check the run_carnarvon.py for boundary_tags
     101# thinned ordering file from Hazard Map: format is index,latitude,longitude (with title)
     102order_filename = 'thinned_boundary_ordering.txt'
     103#landward bounding points
     104landward = 'landward_bounding_polygon.txt'
     105
     106#------------------------------------------------------------------------------
     107# Output Elevation Data
     108#------------------------------------------------------------------------------
     109# Output filename for elevation
     110# this is a combination of all the data (utilisied in build_boundary)
     111combined_name ='carnarvon_combined_elevation'
     112combined_smaller_name = 'carnarvon_combined_elevation_smaller'
     113
     114#------------------------------------------------------------------------------
     115# Directory Structure
     116#------------------------------------------------------------------------------
    81117anuga_dir = home+state+sep+scenario+sep+'anuga'+sep
    82 
    83118topographies_in_dir = home+state+sep+scenario+sep+'elevation_final'+sep+'points'+sep
    84119topographies_dir = anuga_dir+'topographies'+sep
    85 
    86 # input topo file location
     120polygons_dir = anuga_dir+'polygons'+sep
     121tide_dir = anuga_dir+'tide_data'+sep
     122boundaries_dir = anuga_dir+'boundaries'+ sep
     123output_dir = anuga_dir+'outputs'+sep
     124gauges_dir = anuga_dir+'gauges'+sep
     125meshes_dir = anuga_dir+'meshes'+sep
     126
     127#------------------------------------------------------------------------------
     128# Location of input and output data
     129#------------------------------------------------------------------------------
     130# where the input data sits
    87131onshore_in_dir_name = topographies_in_dir + onshore_name
    88 
    89132coast_in_dir_name = topographies_in_dir + coast_name
    90133offshore_in_dir_name = topographies_in_dir + offshore_name
     
    92135offshore_in_dir_name2 = topographies_in_dir + offshore_name2
    93136
     137# where the output data sits
    94138onshore_dir_name = topographies_dir + onshore_name
    95 
    96139coast_dir_name = topographies_dir + coast_name
    97140offshore_dir_name = topographies_dir + offshore_name
     
    99142offshore_dir_name2 = topographies_dir + offshore_name2
    100143
    101 #final topo files
     144# where the combined elevation file sits
    102145combined_dir_name = topographies_dir + combined_name
    103 #combined_time_dir_name = topographies_time_dir + combined_name
    104146combined_smaller_name_dir = topographies_dir + combined_smaller_name
    105 #combined_time_dir_final_name = topographies_time_dir + combined_final_name
    106 
    107 meshes_dir = anuga_dir+'meshes'+sep
    108 meshes_dir_name = meshes_dir + scenario_name
    109 
    110 polygons_dir = anuga_dir+'polygons'+sep
    111 tide_dir = anuga_dir+'tide_data'+sep
    112 
    113 
    114 #boundaries_source = '1'
    115    
    116 if source=='polyline':
    117     boundaries_name = 'perth_3103_28052008' #polyline gun
    118     boundaries_in_dir = anuga_dir+'boundaries'+sep+'urs'+sep+'polyline'+sep+'1_10000'+sep
    119 
    120 if source=='test':
    121     boundaries_name = 'other' #polyline
    122     boundaries_in_dir = anuga_dir+'boundaries'+sep
    123 
    124 
    125 #boundaries locations
    126 boundaries_in_dir_name = boundaries_in_dir + boundaries_name
    127 boundaries_dir = anuga_dir+'boundaries'+sep
    128 boundaries_dir_name = boundaries_dir + scenario_name # what it creates???
     147
     148# where the mesh sits (this is created during the run_carnarvon.py)
     149meshes_dir_name = meshes_dir + scenario_name+'.msh'
     150
     151# where the boundary ordering files sit (this is used within build_boundary.py)
     152order_filename_dir = boundaries_dir + order_filename
     153
     154# where the landward points of boundary extent sit (this is used within run_carnarvon.py)
     155landward_dir = boundaries_dir + landward
     156
     157# where the event sts files sits (this is created during the build_boundary.py)
     158boundaries_dir_event = boundaries_dir + str(event_number) + sep
    129159boundaries_dir_mux = muxhome
    130160
    131 #output locations
    132 output_dir = anuga_dir+'outputs'+sep
    133 output_build_time_dir = anuga_dir+'outputs'+sep+build_time+dir_comment+sep
    134 output_run_time_dir = anuga_dir+'outputs'+sep+run_time+dir_comment+sep
     161# where the directory of the output filename sits
     162output_build_time_dir = output_dir+build_time+dir_comment+sep   #used for build_carnarvon.py
     163output_run_time_dir = output_dir+run_time+dir_comment+sep       #used for run_carnarvon.py
    135164output_run_time_dir_name = output_run_time_dir + scenario_name  #Used by post processing
    136165
    137 vertex_filename = output_run_time_dir + 'mesh_vertex.csv'
    138 
    139 #gauges
    140 gauge_name = 'carnarvon.csv'
    141 
    142 gauges_dir = home+sep+state+sep+scenario+sep+'anuga'+sep+'gauges'+sep
    143 beach_gauges = gauges_dir + 'beach_gauges.csv'
    144 gauges_dir_name = gauges_dir + gauge_name
    145 
    146 ##buildings_filename = gauges_dir + 'Perth_resA.csv'
    147 ##buildings_filename_out = 'Perth_res_Project_modified.csv'
    148 
    149 ###############################
     166#w here the directory of the gauges sit
     167gauges_dir_name = gauges_dir + gauge_name       #used for get_timeseries.py
     168gauges_dir_name2 = gauges_dir + gauge_name2     #used for get_timeseries.py
     169
     170#------------------------------------------------------------------------------
    150171# Interior region definitions
    151 ###############################
    152 
    153 #Initial bounding polygon for data clipping
     172#------------------------------------------------------------------------------
     173
     174#Land, to set the initial stage/water to be offcoast only
     175#Land and Ocean to clip data
     176poly_mainland=read_polygon(polygons_dir +'land_initial_condition.csv')
     177poly_island1=read_polygon(polygons_dir +'land_initial_condition_bernier.csv')
     178poly_island2=read_polygon(polygons_dir +'land_initial_condition_dorne.csv')
     179poly_ocean=read_polygon(polygons_dir +'ocean_initial_condition.csv')
     180
     181# Initial bounding polygon for data clipping
    154182poly_all = read_polygon(polygons_dir+'poly_all.csv')
    155183res_poly_all = 100000*res_factor
    156184
    157 #Polygon designed
    158 poly_internal_20 = read_polygon(polygons_dir+'Carnarvon20m.csv')
    159 res_internal_20 = 25000*res_factor
    160 
    161 #Polygon designed to
    162 poly_internal_5 = read_polygon(polygons_dir+'Carnarvon5m.csv')
    163 res_internal_5 = 500*res_factor
    164 
    165 #Polygon designed to
    166 poly_internal_10 = read_polygon(polygons_dir+'Carnarvon10m.csv')
    167 res_internal_10 = 1500*res_factor
    168 
    169 #Polygon designed to incorporate
    170 poly_island_20 = read_polygon(polygons_dir+'Island20m.csv')
    171 res_island_20 = 50000*res_factor
    172 
    173 
    174 interior_regions = [[poly_internal_20,res_internal_20],[poly_internal_5,res_internal_5]
    175                      ,[poly_island_20,res_island_20],[poly_internal_10,res_internal_10]]
     185# Area of Interest 1 (carnarvon)
     186poly_aoi1 = read_polygon(polygons_dir+'Carnarvon5m.csv')
     187res_aoi1 = 500*res_factor
     188
     189# Area of Significance 1 (carnarvon)
     190poly_aos1 = read_polygon(polygons_dir+'Carnarvon10m.csv')
     191res_aos1 = 1500*res_factor
     192
     193# Shallow water 1
     194poly_sw1 = read_polygon(polygons_dir+'Carnarvon20m.csv')
     195res_sw1 = 25000*res_factor
     196
     197# Shallow water 2
     198poly_sw2 = read_polygon(polygons_dir+'Island20m.csv')
     199res_sw2 = 50000*res_factor
     200
     201# Combined all regions, must check that all are included!
     202interior_regions = [[poly_aoi1,res_aoi1],[poly_aos1,res_aos1]
     203                     ,[poly_sw1,res_sw1],[poly_sw2,res_sw2]]
    176204
    177205   
    178206trigs_min = number_mesh_triangles(interior_regions, poly_all, res_poly_all)
    179 print 'min number triangles', trigs_min
     207print 'min estimated number of triangles', trigs_min
    180208   
    181 
    182 poly_mainland = read_polygon(polygons_dir+'initial_condition.csv')
    183 
    184 ###################################################################
     209#------------------------------------------------------------------------------
    185210# Clipping regions for export to asc and regions for clipping data
    186 ###################################################################
    187 
    188 
     211# Final inundation maps should only be created in regions of the finest mesh
     212#------------------------------------------------------------------------------
     213
     214# carnarvon CBD extract ascii grid
     215##xminCBD =
     216##xmaxCBD =
     217##yminCBD =
     218##ymaxCBD =
Note: See TracChangeset for help on using the changeset viewer.