Changeset 6329


Ignore:
Timestamp:
Feb 13, 2009, 10:39:47 AM (15 years ago)
Author:
rwilson
Message:

Further changes from testing.

Location:
anuga_work/production/busselton/standardised_version
Files:
4 edited

Legend:

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

    r6326 r6329  
    2222#-------------------------------------------------------------------------------
    2323def get_sts_gauge_data(filename, verbose=False):
     24    print 'get_sts_gauge_data: filename=%s' % filename
    2425    fid = NetCDFFile(filename+'.sts', 'r')      #Open existing file for read
    2526    permutation = fid.variables['permutation'][:]
     
    8788##
    8889# @brief Build boundary STS files from one or more MUX files.
    89 # @param mux_dir Directory containing the MUX files.
    90 # @param event_file Path to meta-file containing mux files+weight data.
     90# @param event_file Name of mux meta-file or single mux stem.
    9191# @param output_dir Directory to write STS data to.
    9292# @note 'event_file' is produced by EventSelection.
    93 def build_urs_boundary(mux_dir, event_file, output_dir):
     93def build_urs_boundary(event_file, output_dir):
    9494    '''Build a boundary STS file from a set of MUX files.'''
    9595
    96     print 'build_urs_boundary: mux_dir=%s' % mux_dir
    9796    print 'build_urs_boundary: event_file=%s' % event_file
    9897    print 'build_urs_boundary: output_dir=%s' % output_dir
    9998
    10099    # if we are using an EventSelection multi-mux file
    101     if project.multi_mux:   
    102         # get the mux+weight data from the event file
    103         mux_event_file = os.path.join(mux_dir, event_file)
     100    if project.multi_mux:
     101        print 'using multi-mux file'
     102        # get the mux+weight data from the meta-file (in <boundaries>)
     103        mux_event_file = os.path.join(project.boundaries_folder, event_file)
    104104        try:
    105105            fd = open(mux_event_file, 'r')
     
    130130            split_index = muxname.index('.grd')
    131131            muxname = muxname[:split_index+len('.grd')]
    132             muxname = os.path.join(mux_dir, muxname)
     132            muxname = os.path.join(project/mux_data_folder, muxname)
    133133            mux_filenames.append(muxname)
    134134       
     
    144144                verbose=True)
    145145    else:                           # a single mux stem file, assume 1.0 weight
    146         mux_filenames = [os.path.join(mux_dir, event_file)]
     146        print 'using single-mux file'
     147        mux_filenames = [os.path.join(project.mux_data_folder, event_file)]
    147148
    148149        weight_factor = 1.0
    149150        mux_weights = weight_factor*num.ones(len(mux_filenames), num.Float)
    150151           
    151         order_filename = project.order_filename_dir
     152        order_filename = project.urs_order
    152153
    153154        print 'reading', order_filename
    154155        # Create ordered sts file
    155156        print 'creating sts file'
     157        print 'mux_filenames=%s' % str(mux_filenames)
     158        print 'output_dir=%s' % str(output_dir)
     159        print 'mux_weights=%s' % str(mux_weights)
     160        print 'project.tide=%s' % str(project.tide)
    156161        urs2sts(mux_filenames,
    157162                basename_out=output_dir,
  • anuga_work/production/busselton/standardised_version/file_length.py

    r6327 r6329  
    77Returns: number of lines in file
    88"""
     9
    910def file_length(in_file):
     11    '''Function to return the number of lines in a file.
     12
     13    in_file: Path to the file to get number of lines in.
     14   
     15    Returns: number of lines in file
     16    '''
     17   
    1018    fid = open(in_file)
    1119    data = fid.readlines()
  • anuga_work/production/busselton/standardised_version/project.py

    r6324 r6329  
    2727# One or all can be changed each time the run_model script is executed
    2828tide = 0                # difference between MSL and HAT
    29 event_number = 26633    # the event number
     29event_number = 27197    # the event number
    3030alpha = 0.1             # smoothing parameter for mesh
    3131friction=0.01           # manning's friction coefficient
     
    119119# MUX input filename.
    120120# If a meta-file from EventSelection is used, set 'multi-mux' to True.
    121 # If a single MUX stem filename is used, set 'multi-mux' to False.
    122 mux_input_filename = 'event_026633.list'
    123 multi_mux = True
     121# If a single MUX stem filename (*.grd) is used, set 'multi-mux' to False.
     122mux_input_filename = 'Java-0016-z.grd'
     123multi_mux = False
    124124
    125125#-------------------------------------------------------------------------------
     
    175175gtime = strftime('%Y%m%d_%H%M%S', gmtime())
    176176build_time = time + '_build'
    177 run_time = time + '_run'
     177run_time = time + '_run_'
    178178
    179179# create paths generated from environment variables.
     
    193193# MUX data files
    194194# Directory containing the MUX data files to be used with EventSelection.
    195 mux_data_folder = '/nas/gemd/georisk_models/tsunami/models/PTHA/Australia/mux'
     195mux_data_folder = join(muxhome, 'mux')
    196196
    197197#-------------------------------------------------------------------------------
  • anuga_work/production/busselton/standardised_version/run_model.py

    r6328 r6329  
    6262
    6363# Create the STS file
    64 bub.build_urs_boundary(project.mux_data_folder,
    65                        project.mux_input,
     64print 'project.mux_data_folder=%s' % project.mux_data_folder
     65bub.build_urs_boundary(project.mux_input_filename,
    6666                       os.path.join(project.event_folder,
    6767                                    project.scenario_name))
     
    7878
    7979# Number of boundary segments
    80 N = len(event_sts) - 1
     80num_ocean_segments = len(event_sts) - 1
    8181# Number of landward_boundary points
    82 M = file_length(project.landward_boundary)
     82num_land_points = file_length(project.landward_boundary)
    8383
    8484# Boundary tags refer to project.landward_boundary
    8585# 4 points equals 5 segments start at N
    86 boundary_tags={'back': range(N+1,N+M),
    87                'side': [N,N+M],
    88                'ocean': range(N)}
     86boundary_tags={'back': range(num_ocean_segments+1,
     87                             num_ocean_segments+num_land_points),
     88               'side': [num_ocean_segments,
     89                        num_ocean_segments+num_land_points],
     90               'ocean': range(num_ocean_segments)}
    8991
    9092# Build mesh and domain
Note: See TracChangeset for help on using the changeset viewer.