Changeset 5784


Ignore:
Timestamp:
Sep 25, 2008, 1:14:25 PM (16 years ago)
Author:
sexton
Message:

updated commments for perth scripts

Location:
anuga_work/production/perth
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/perth/build_boundary_27255.py

    r5781 r5784  
    11"""
    2 Script for building boundary to run tsunami inundation scenario for Perth,
    3 WA, Australia.  The boundary is based on the National Hazard Map.
     2Script for building boundary to run a tsunami inundation scenario for Perth,
     3WA, Australia.  The boundary is sourced from the National Hazard Map.
    44
    55Input: order_filename from project.py
     
    2828# Create sts boundary from mux2files
    2929#--------------------------------------------------------------------------
    30 
     30# location of mux files
     31# Note, this may change when all mux files are on the GA network
    3132dir=os.path.join(project.muxhome,'mux')
    3233
    3334# Refer to event_027255.list in home+state+sep+event08 for event details
    3435# taken from David's event list for 27255
     36# Note, this is specific to the event and will be supplied by David.
     37# In time, this will become more automated.
    3538urs_filenames = [
    3639    os.path.join(dir,'Java-0017-z.grd'), 
     
    8790        quantities[name] = fid.variables[name][:]
    8891
    89 #------------------------------------------------------------------------------
    90 # Get Maxium wave height throughout timeseries at each index point
    91 #------------------------------------------------------------------------------
     92    #------------------------------------------------------------------------------
     93    # Get maxium wave height throughout timeseries at each index point
     94    #------------------------------------------------------------------------------
    9295
    9396    maxname = 'max_sts_stage.csv'
     
    104107        fid_max.write(s)
    105108     
    106 #------------------------------------------------------------------------------
    107 # Get Minium wave height throughout timeseries at each index point
    108 #------------------------------------------------------------------------------
     109    #------------------------------------------------------------------------------
     110    # Get minium wave height throughout timeseries at each index point
     111    #------------------------------------------------------------------------------
    109112
    110113    minname = 'min_sts_stage.csv'
     
    127130        fid_sts.write(s)
    128131
    129 #------------------------------------------------------------------------------
    130 # End of the get gauges
    131 #------------------------------------------------------------------------------
     132    #------------------------------------------------------------------------------
     133    # End of the get gauges
     134    #------------------------------------------------------------------------------
    132135        for k in range(len(time)-1):
    133136            s = '%.6f, %.6f, %.6f, %.6f\n' %(time[k], stage[k], xmomentum[k], ymomentum[k])
  • anuga_work/production/perth/build_perth.py

    r5781 r5784  
    11"""
    2 Script for building the elevation data to run tsunami inundation scenario
     2Script for building the elevation data to run a tsunami inundation scenario
    33for Perth, WA, Australia.
    44
     
    77The run_perth.py is reliant on the output of this script.
    88
    9 Ole Nielsen and Duncan Gray, GA - 2005 and Jane Sexton, Nick Bartzis, GA - 2006
    109"""
    1110
     
    5049# Fine pts file to be clipped to area of interest
    5150#-------------------------------------------------------------------------------
    52 print"project.poly_all",project.poly_all
    53 print"project.combined_dir_name",project.combined_dir_name
     51print "project.poly_all", project.poly_all
     52print "project.combined_dir_name", project.combined_dir_name
    5453
    5554# input elevation directory filenames
     
    8584convert_dem_from_ascii2netcdf(island_in_dir_name3, basename_out=island_dir_name3, use_cache=True, verbose=True)
    8685
    87 #creates pts file for onshore DEM
     86# creates pts file for onshore DEM
    8887print "creates pts file for onshore DEM"
    8988dem2pts(onshore_dir_name ,use_cache=True,verbose=True)
    9089
    91 #creates pts file for island DEM
     90# creates pts file for island DEM
    9291dem2pts(island_dir_name, use_cache=True, verbose=True)
    9392dem2pts(island_dir_name1, use_cache=True, verbose=True)
     
    9594dem2pts(island_dir_name3, use_cache=True, verbose=True)
    9695
    97 #-------------------------------------------------------------------------------
    98 # Combine datasets into project.combined_dir_name
    99 #-------------------------------------------------------------------------------
    100 
     96# create onshore pts files
    10197print'create Geospatial data1 objects from topographies'
    10298G1 = Geospatial_data(file_name = onshore_dir_name + '.pts')
     
    109105print'create Geospatial data5 objects from topographies'
    110106G5 = Geospatial_data(file_name = island_dir_name3 + '.pts')
     107
     108# create coastal and offshore pts files
    111109print'create Geospatial data6 objects from topographies'
    112110G_coast = Geospatial_data(file_name = coast_in_dir_name)
     
    120118G_off3 = Geospatial_data(file_name = offshore_in_dir_name3)
    121119
     120#-------------------------------------------------------------------------------
     121# Combine, clip and export dataset
     122#-------------------------------------------------------------------------------
    122123
    123124print'add all geospatial objects'
     
    130131if access(project.topographies_dir,F_OK) == 0:
    131132    mkdir (project.topographies_dir)
    132 #G_clipped.export_points_file(project.combined_dir_name + '.pts')
    133 G_clipped.export_points_file(project.combined_dir_name + '.txt') #Use for comparision in ARC
     133G_clipped.export_points_file(project.combined_dir_name + '.pts')
     134#G_clipped.export_points_file(project.combined_dir_name + '.txt') #Use for comparision in ARC
    134135
    135 import sys
    136 sys.exit()
  • anuga_work/production/perth/run_perth.py

    r5781 r5784  
    1 """Script for running tsunami inundation scenario for Perth, WA, Australia.
     1"""Script for running a tsunami inundation scenario for Perth, WA, Australia.
    22
    33The scenario is defined by a triangular mesh created from project.polygon,
    4 the elevation data is combiled into a pts file through build_perth.py
    5 and a simulated tsunami is generated through an sts file from build_boundary.py
    6 
    7 Input: sts file (build_boundary.py for resepective event)
     4the elevation data is compiled into a pts file through build_perth.py
     5and a simulated tsunami is generated through an sts file from build_boundary.py.
     6
     7Input: sts file (build_boundary.py for respective event)
    88       pts file (build_perth.py)
    99       information from project file
     
    9090    N = len(urs_bounding_polygon)-1
    9191
    92     #boundary tags refer to project.landward 4 points equals 5 segments start at N
     92    # boundary tags refer to project.landward 4 points equals 5 segments start at N
    9393    boundary_tags={'back': [N+1,N+2,N+3], 'side': [N,N+4], 'ocean': range(N)}
    9494
    95    
    9695    #--------------------------------------------------------------------------
    9796    # Create the triangular mesh based on overall clipping polygon with a tagged
     
    10099    #--------------------------------------------------------------------------
    101100
    102     #IMPORTANT don't cache create_mesh_from_region and Domain(mesh....) as it
     101    # IMPORTANT don't cache create_mesh_from_region and Domain(mesh....) as it
    103102    # causes problems with the ability to cache set quantity which takes alot of times
    104103       
     
    132131    print 'Setup initial conditions'
    133132
    134     #following sets the stage/water to be offcoast only
     133    # sets the initial stage in the offcoast region only
    135134    IC = Polygon_function( [(project.poly_mainland, 0)], default = kwargs['tide'],
    136135                             geo_reference = domain.geo_reference)
     
    161160    domain.set_name(kwargs['scenario_name'])
    162161    domain.set_datadir(kwargs['output_dir'])
    163     domain.set_default_order(2) # Apply second order scheme
    164     domain.set_minimum_storable_height(0.01) # Don't store anything less than 1cm
     162    domain.set_default_order(2)                 # Apply second order scheme
     163    domain.set_minimum_storable_height(0.01)    # Don't store anything less than 1cm
    165164    domain.set_store_vertices_uniquely(False)
    166165    domain.set_quantities_to_be_stored(['stage', 'xmomentum', 'ymomentum'])
     
    206205        domain.write_boundary_statistics(tags = 'ocean')
    207206
     207    # these outputs should be checked with the resultant inundation map
    208208    x, y = domain.get_maximum_inundation_location()
    209209    q = domain.get_maximum_inundation_elevation()
    210 
    211210    print 'Maximum runup observed at (%.2f, %.2f) with elevation %.2f' %(x,y,q)
    212211
    213     print 'That took %.2f seconds' %(time.time()-t0)
     212    print 'Simulation took %.2f seconds' %(time.time()-t0)
    214213
    215214    #kwargs 'completed' must be added to write the final parameters to file
     
    232231    kwargs['alpha'] = project.alpha
    233232    kwargs['friction']=project.friction
    234     #kwargs['est_num_trigs']=project.trigs_min
    235233    #kwargs['num_cpu']=numprocs
    236234    #kwargs['host']=project.host
    237     #kwargs['res_factor']=project.res_factor
    238235    #kwargs['starttime']=project.starttime
    239236    #kwargs['yieldstep']=project.yieldstep
    240     #kwargs['file_name']=project.home+'detail.csv'
    241     #kwargs['ab_time']=project.time
    242     #kwargs['res_factor']= project.res_factor
    243237    #kwargs['user']=project.user
    244238    #kwargs['time_thinning'] = project.time_thinning
    245     #kwargs['dir_comment']=project.dir_comment
    246239     
    247 
    248240    run_model(**kwargs)
    249241     
Note: See TracChangeset for help on using the changeset viewer.