Changeset 3272


Ignore:
Timestamp:
Jul 4, 2006, 1:44:52 PM (19 years ago)
Author:
sexton
Message:

updates for pt hedland script

Location:
production/pt_hedland_2006
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • production/pt_hedland_2006/project.py

    r3271 r3272  
    4747    home = getenv('INUNDATIONHOME', sep+'d'+sep+'cit'+sep+'2'+sep+'cit'+sep+'inundation'+sep+'data')     
    4848    user = getenv('LOGNAME')
    49     print 'USER:', user
    5049
    5150#Derive subdirectories and filenames
  • production/pt_hedland_2006/run_pt_hedland.py

    r3271 r3272  
    3333import project                 # Definition of file names and polygons
    3434
     35#-------------------------------------------------------------------------------
     36# Copy scripts to time stamped output directory and capture screen
     37# output to file
     38#-------------------------------------------------------------------------------
     39
     40# creates copy of code in output dir if dir doesn't exist
     41if access(project.outputtimedir,F_OK) == 0 :
     42    mkdir (project.outputtimedir)
     43copy (dirname(project.__file__) +sep+ project.__name__+'.py', project.outputtimedir + project.__name__+'.py')
     44copy (__file__, project.outputtimedir + basename(__file__))
     45print 'project.outputtimedir',project.outputtimedir
     46
     47# normal screen output is stored in
     48screen_output_name = project.outputtimedir + "screen_output.txt"
     49screen_error_name = project.outputtimedir + "screen_error.txt"
     50
     51# used to catch screen output to file
     52sys.stdout = Screen_Catcher(screen_output_name)
     53sys.stderr = Screen_Catcher(screen_error_name)
     54print 'USER:    ', project.user
    3555
    3656#-------------------------------------------------------------------------------
     
    4868meshname = project.meshname+'.msh'
    4969source_dir = project.boundarydir
    50 
    51 ## creates copy of code in output dir if dir doesn't exist
    52 if access(project.outputtimedir,F_OK) == 0 :
    53     mkdir (project.outputtimedir)
    54 copy (dirname(project.__file__) +sep+ project.__name__+'.py', project.outputtimedir + project.__name__+'.py')
    55 copy (__file__, project.outputtimedir + basename(__file__))
    56 
    57 print 'project.outputtimedir',project.outputtimedir
    58 
    59 ##normal screen output is stored in
    60 screen_output_name = project.outputtimedir + "screen_output.txt"
    61 screen_error_name = project.outputtimedir + "screen_error.txt"
    62 
    63 #used to catch screen output to file
    64 sys.stdout = Screen_Catcher(screen_output_name)
    65 sys.stderr = Screen_Catcher(screen_error_name)
    6670
    6771# fine data (clipping the points file to smaller area)
     
    8084print 'create G1'
    8185G1 = Geospatial_data(file_name = project.offshore_dem_name1 + '.xya')
    82 
    8386print 'create G2'
    8487G2 = Geospatial_data(file_name = project.offshore_dem_name2 + '.xya')
    85 
    8688print 'create G3'
    8789G3 = Geospatial_data(file_name = project.onshore_dem_name + '.pts')
    88 
    8990print 'add G1+G2+G3'
    9091G = G1 + G2 + G3
    91 
    9292print 'export G'
    9393G.export_points_file(project.combined_dem_name + '.pts')
    94 
    9594
    9695#-------------------------------------------------------------------------------                                 
     
    105104coast_res = 25000
    106105pt_hedland_res = 5000
    107 # derive poly_coast from project.coast_name using alpha_shape
    108 #interior_regions = [[project.poly_pt_hedland, pt_hedland_res],
    109106interior_regions = [[project.poly_pt_hedland, pt_hedland_res],
    110107                    [project.poly_region, region_res]]
     
    112109print 'number of interior regions', len(interior_regions)
    113110
    114 from utilities.polygon import inside_polygon, plot_polygons
    115 
    116 bounding_polygon = project.polyAll
    117 count = 0
    118 for i in range(len(interior_regions)):
    119     region = interior_regions[i]
    120     interior_polygon = region[0]
    121     if len(inside_polygon(interior_polygon, bounding_polygon,
    122                    closed = True, verbose = False)) <> len(interior_polygon):
    123         print 'WARNING: interior polygon %d is outside bounding polygon' %(i)
    124         count += 1
    125 
     111from utilities.polygon import plot_polygons
    126112if sys.platform == 'win32':
    127113    #figname = project.outputtimedir + 'pt_hedland_polys'
     
    131117              verbose = True)   
    132118
    133 if count == 0:
    134     print 'interior regions OK'
    135 else:
    136     print 'check out your interior polygons'
    137     print 'check %s in production directory' %figname
    138     import sys; sys.exit()
    139    
    140119print 'start create mesh from regions'
    141120from caching import cache
    142121_ = cache(create_mesh_from_regions,
    143122          project.polyAll,
    144 #          project.poly_region,
    145 #          {'boundary_tags': {'right': [0], 'bottomright': [1],
    146 #                             'bottomleft': [2], 'left': [3], 'top': [4]},
    147 #          {'boundary_tags': {'topright': [0], 'top': [1],'topleft': [2], 'left': [3],
    148 #                             'bottomleft': [4], 'bottomright': [5], 'right': [6]},
    149           {'boundary_tags': {'topright': [0],'topleft': [1], 'left': [2],
    150                              'bottomleft': [3], 'bottomright': [4], 'right': [5]},
     123          {'boundary_tags': {'topright': [0], 'topleft': [1],
     124                             'left': [2], 'bottomleft': [3],
     125                             'bottomright': [4], 'right': [5]},
    151126           'maximum_triangle_area': 500000,
    152127           'filename': meshname,           
    153128           'interior_regions': interior_regions},
    154129          verbose = True, evaluate=True)
    155 
    156130
    157131#-------------------------------------------------------------------------------                                 
     
    206180cache(ferret2sww,
    207181      (source_dir + project.boundary_basename,
    208        source_dir + project.boundary_basename),
     182       source_dir + project.boundary_basename+'_'+project.basename),
    209183      {'verbose': True,
    210184       'minlat': south,
     
    219193       'inverted_bathymetry': True},
    220194       evaluate = True,
    221        verbose = True,)
    222 
     195       verbose = True,
     196      dependencies = source_dir + project.boundary_basename + '.sww')
    223197
    224198print 'Available boundary tags', domain.get_boundary_tags()
     
    228202Br = Reflective_boundary(domain)
    229203Bd = Dirichlet_boundary([tide,0,0])
    230 
    231204domain.set_boundary( {'topright': Bf,'topleft': Bf, 'left':  Bd,
    232                              'bottomleft': Bd, 'bottomright': Bd, 'right': Bd})
    233                              
     205                      'bottomleft': Bd, 'bottomright': Bd, 'right': Bd})
    234206#-------------------------------------------------------------------------------                                 
    235207# Evolve system through time
Note: See TracChangeset for help on using the changeset viewer.