Changeset 2902


Ignore:
Timestamp:
May 18, 2006, 10:01:58 AM (19 years ago)
Author:
nick
Message:

update onslow and pt hedland

Location:
production
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • production/onslow_2006/export_results.py

    r2773 r2902  
    77from os import sep
    88
    9 time_dir = "20060419_071046"
     9time_dir = "20060426_004517"
    1010directory = project.outputdir
    1111name = directory + time_dir +sep + "source"
  • production/onslow_2006/project.py

    r2863 r2902  
    33"""
    44
    5 from os import sep, environ
     5from os import sep, environ, getenv, getcwd
    66from os.path import expanduser
    77from utilities.polygon import read_polygon
     
    1414from time import localtime, strftime
    1515
    16 from os import getcwd
    1716               
    1817#Making assumptions about the location of scenario data
     
    3635if sys.platform == 'win32':
    3736    home = environ['INUNDATIONHOME']     #Sandpit's parent dir
     37#    home = environ['INUNDATIONHOME']     #Sandpit's parent dir
    3838else:   
    39     home = environ['INUNDATIONHOME']     #Sandpit's parent dir
    40 #    home = expanduser('~')
     39    home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation')     
    4140
    4241#Derive subdirectories and filenames
  • production/onslow_2006/run_onslow.py

    r2863 r2902  
    131131'''
    132132#new
    133 region_res = 25000
     133region_res = 50000
    134134coast_res = 2500
    135135onslow_res = 500
     
    147147                             'bottom': [4], 'bottomright': [5],
    148148                             'topright':[6]},
    149            'maximum_triangle_area': 100000,
     149           'maximum_triangle_area': 200000,
    150150           'filename': meshname,           
    151151           'interior_regions': interior_regions},
  • production/pt_hedland_2006/project.py

    r2855 r2902  
    33"""
    44
    5 from os import sep, environ
     5from os import sep, environ, getenv, getcwd
    66from os.path import expanduser
    77from utilities.polygon import read_polygon
     
    1010from coordinate_transforms.redfearn import degminsec2decimal_degrees
    1111from time import localtime, strftime
    12 from os import getcwd
    1312
    1413#Making assumptions about the location of scenario data
     
    3231
    3332if sys.platform == 'win32':
    34     home = environ['INUNDATIONHOME']     #Sandpit's parent dir
     33    home = getenv('INUNDATIONHOME')
     34#    python_home = getenv('PWD')     
     35#    home = environ['INUNDATIONHOME']     #Sandpit's parent dir
    3536else:   
    36     home = expanduser('~')
     37#    home = environ['INUNDATIONHOME']     #Sandpit's parent dir
     38#    home = getenv('INUNDATIONHOME')     
     39#    python_home = getenv('PWD')     
     40    home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation')     
     41#    home = sep+'d'+sep+'cit'+sep+'1'+sep+'cit'+sep+'risk_assessment_methods_project'+sep+'inundation'
     42#    home = expanduser('~')
    3743
    3844#Derive subdirectories and filenames
    3945time = strftime('%Y%m%d_%H%M%S',localtime()) #gets time for new dir
     46#print 'home', home
    4047outputtimedir = home+sep+scenario_dir_name+sep+'output'+sep+time+sep
     48#print 'outputtimedir', outputtimedir
    4149meshdir = home+sep+scenario_dir_name+sep+'meshes'+sep
    4250datadir = home+sep+scenario_dir_name+sep+'topographies'+sep
     
    4856tidedir = home+sep+scenario_dir_name+sep+'tide_data'+sep
    4957
    50 print'bound', boundarydir
     58#print'bound', boundarydir
    5159
    5260#gauge_filename = gaugedir + 'onslow_gauges.xya'
     
    5967#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
    6068
    61 codedir = getcwd()+sep
    62                                
    63 codedirname = codedir + 'project.py'
     69#print 'name', __name__
     70#print 'path', __file__
     71#codedir = getcwd()+sep
     72
     73#project_code_name = __name__
     74                           
     75#project_code_dir_name = __file__
    6476
    6577meshname = meshdir + basename
     
    8193
    8294# for ferret2sww
    83 #south =
    84 #north =
    85 #west =
    86 #east =
     95south = degminsec2decimal_degrees(-20,30,0)
     96north = degminsec2decimal_degrees(-17,10,0)
     97west = degminsec2decimal_degrees(117,00,0)
     98east = degminsec2decimal_degrees(120,00,0)
    8799
    88100# region to export (used from export_results.py)
     
    96108
    97109# bounding polygon provided by Hamish
    98 d0 = [818732.55, 8062768.27]
     110#d0 = [818732.55, 8062768.27]
     111d0 = [755000.0, 8025000.0]
    99112d1 = [708940.32, 7750510.33]
    100113d2 = [656561.15, 7732615.11]
     
    102115d4 = [517682.34, 7899310.22]
    103116
    104 polyAll = [d0, d1, d2, d3, d4]
     117polyAll = [d0, d4, d3, d2, d1]
    105118
    106119#Interior region - Pt Hedland town
    107 i0 = [690000, 7750510.33] # these are just currently close to d1, d2 and d3
    108 i1 = [656561.15, 7750000]
    109 i2 = [620000, 7733013.56]
     120i0 = [668000, 7757000]
     121i1 = [659000, 7755000]
     122i2 = [660000, 7749000]
     123i3 = [667000, 7746000]
     124i4 = [678000, 7751000]
    110125
    111 poly_pt_hedland = [i0, i1, i2]
     126poly_pt_hedland = [i0, i1, i2, i3, i4]
    112127
    113128#Are there other significant features?
    114 j0 = []
    115 j1 = []
    116 j2 = []
    117 j3 = []
     129j0 = [670000, 7780000]
     130j1 = [620000, 7745000]
     131j2 = [665000, 7735000]
     132j3 = [700000, 7755000]
    118133
    119 poly_ = [j0, j1, j2, j3]
     134poly_region = [j0, j1, j2, j3]
    120135
  • production/pt_hedland_2006/run_pt_hedland.py

    r2855 r2902  
    1616
    1717# Standard modules
    18 import os
     18import os
     19
     20from os import sep
     21from os.path import dirname, basename
     22
    1923import time
    2024
     
    4751
    4852# filenames
     53print 'run home', project.home
    4954onshore_dem_name = project.onshore_dem_name
    5055offshore_points1 = project.offshore_dem_name1
     
    5459
    5560
     61
     62
     63#import sys; sys.exit()
     64
    5665# creates copy of code in output dir if dir doesn't exist
    5766if access(project.outputtimedir,F_OK) == 0 :
    5867    mkdir (project.outputtimedir)
    59 copy (project.codedirname, project.outputtimedir + project.codename)
    60 copy (project.codedir + 'run_pt_hedland.py', project.outputtimedir + 'run_pt_hedland.py')
    61 print'output dir', project.outputtimedir
     68copy (dirname(project.__file__) +sep+ project.__name__+'.py', project.outputtimedir + project.__name__+'.py')
     69copy (__file__, project.outputtimedir + basename(__file__))
     70
    6271
    6372#normal screen output is stored in
     
    6776#used to catch screen output to file
    6877sys.stdout = Screen_Catcher(screen_output_name)
    69 #sys.stderr = Screen_Catcher(screen_output_name)
    70 #sys.stderr = Screen_Catcher(screen_error_name)
    71 
    72 '''
    73 copied_files = False
    74 
    75 # files to be used
    76 files_used = [onshore_dem_name, offshore_points,]
    77 
    78 if sys.platform != 'win32':   
    79     copied_files = True
    80     for name in file_list:
    81         copy(name, )
    82 '''   
    83 #print' most file', project.MOST_dir + project.boundary_basename+'_ha.nc'
    84 #if access(project.MOST_dir + project.boundary_basename+'_ha.nc',F_OK) == 1 :
    85 #    print' most file', project.MOST_dir + project.boundary_basename
    86 
    87 
     78sys.stderr = Screen_Catcher(screen_error_name)
     79
     80
     81'''
    8882# fine data (clipping the points file to smaller area)
    8983# creates DEM from asc data
     
    114108G.export_points_file(project.combined_dem_name + '.pts')
    115109
    116 
     110'''
    117111#-------------------------------------------------------------------------------                                 
    118112# Create the triangular mesh based on overall clipping polygon with a tagged
     
    123117from pmesh.mesh_interface import create_mesh_from_regions
    124118
    125 region_res = 25000
     119region_res = 50000
    126120coast_res = 2500
    127 pt_hedland_res = 25000
     121pt_hedland_res = 5000
    128122# derive poly_coast from project.coast_name using alpha_shape
    129 interior_regions = []#[[project.poly_pt_hedland, pt_hedland_res]]#,
    130                     #[project.poly_coast, coast_res],
    131                     #[project.poly_region, region_res]]
     123interior_regions = [[project.poly_pt_hedland, pt_hedland_res],
     124                    [project.poly_region, region_res]]
    132125
    133126print 'number of interior regions', len(interior_regions)
     
    136129_ = cache(create_mesh_from_regions,
    137130          project.polyAll,
    138           {'boundary_tags': {'right': [0], 'bottomright': [1],
    139                              'bottomleft': [2], 'left': [3], 'top': [4]},
    140            'maximum_triangle_area': 250000,
     131#          {'boundary_tags': {'right': [0], 'bottomright': [1],
     132#                             'bottomleft': [2], 'left': [3], 'top': [4]},
     133          {'boundary_tags': {'top': [0], 'left': [1],
     134                             'bottomleft': [2], 'bottomright': [3], 'right': [4]},
     135           'maximum_triangle_area': 400000,
    141136           'filename': meshname,           
    142137           'interior_regions': interior_regions},
     
    147142# Setup computational domain
    148143#-------------------------------------------------------------------------------                                 
    149 
     144'''
    150145domain = pmesh_to_domain_instance(meshname, Domain,
    151146                                  use_cache = False,
    152147                                  verbose = True)
     148'''
     149
     150domain = Domain(meshname, use_cache = False, verbose = True)
    153151
    154152print 'Number of triangles = ', len(domain)
     
    171169
    172170domain.set_quantity('elevation',
    173 #                    filename = project.onshore_dem_name + '.pts',
    174171                    filename = project.combined_dem_name + '.pts',
    175 #                    filename = project.offshore_dem_name1 + '.xya',
    176 #                    filename = project.offshore_dem_name2 + '.xya',
    177172                    use_cache = True,
    178173                    verbose = True,
     
    181176
    182177print 'hi1'
    183 print 'have sent quantities OK - now exiting'
    184 import sys; sys.exit()
     178#print 'have sent quantities OK - now exiting'
     179#import sys; sys.exit()
    185180
    186181#-------------------------------------------------------------------------------                                 
     
    188183#-------------------------------------------------------------------------------
    189184print 'start ferret2sww'
     185# skipped as results in file SU-AU_clipped is correct for all WA
     186
    190187from pyvolution.data_manager import ferret2sww
    191188
     
    199196      (source_dir + project.boundary_basename,
    200197       source_dir + project.boundary_basename),
    201 #      (project.MOST_dir + project.boundary_basename,
    202 #       source_dir + project.boundary_basename),
    203198      {'verbose': True,
    204 # note didn't work with the below
    205 #       'minlat': south - 1,
    206 #       'maxlat': north + 1,
    207 #       'minlon': west - 1,
    208 #       'maxlon': east + 1,
    209199       'minlat': south,
    210200       'maxlat': north,
     
    228218Bd = Dirichlet_boundary([tide,0,0])
    229219
    230 
    231220# 7 min square wave starting at 1 min, 6m high
    232221Bw = Time_boundary(domain = domain,
    233222                   f=lambda t: [(60<t<480)*6, 0, 0])
    234223
    235 domain.set_boundary( {'right': Br, 'bottomright': Br,
    236                              'bottomleft': Br, 'left': Br, 'top': Bf} )
     224#domain.set_boundary( {'right': Br, 'bottomright': Br,
     225#                             'bottomleft': Br, 'left': Br, 'top': Bf} )
     226domain.set_boundary( {'top': Bf, 'left': Br, 'bottomleft': Br, 'bottomright': Br, 'right': Br} )
    237227                             
    238228#-------------------------------------------------------------------------------                                 
     
    242232t0 = time.time()
    243233
    244 for t in domain.evolve(yieldstep = 240, finaltime = 7201):
    245     domain.write_time()
    246     domain.write_boundary_statistics(tags = 'top')     
    247 
    248 for t in domain.evolve(yieldstep = 120, finaltime = 12601
    249                        ,skip_initial_step = True):
    250     domain.write_time()
    251     domain.write_boundary_statistics(tags = 'top')     
    252 
    253 for t in domain.evolve(yieldstep = 60, finaltime = 19801
     234for t in domain.evolve(yieldstep = 240, finaltime = 7200):
     235    domain.write_time()
     236    domain.write_boundary_statistics(tags = 'top')     
     237
     238for t in domain.evolve(yieldstep = 240, finaltime = 12600
     239                       ,skip_initial_step = True):
     240    domain.write_time()
     241    domain.write_boundary_statistics(tags = 'top')     
     242
     243for t in domain.evolve(yieldstep = 240, finaltime = 19800
    254244                       ,skip_initial_step = True):
    255245    domain.write_time()
    256246    domain.write_boundary_statistics(tags = 'top')     
    257247   
    258 for t in domain.evolve(yieldstep = 120, finaltime = 25201
    259                        ,skip_initial_step = True):
    260     domain.write_time()
    261     domain.write_boundary_statistics(tags = 'top')     
    262 
    263 for t in domain.evolve(yieldstep = 240, finaltime = 36001
     248for t in domain.evolve(yieldstep = 240, finaltime = 25200
     249                       ,skip_initial_step = True):
     250    domain.write_time()
     251    domain.write_boundary_statistics(tags = 'top')     
     252
     253for t in domain.evolve(yieldstep = 240, finaltime = 36000
    264254                       ,skip_initial_step = True):
    265255    domain.write_time()
Note: See TracChangeset for help on using the changeset viewer.