Ignore:
Timestamp:
Jan 19, 2006, 12:00:08 PM (18 years ago)
Author:
ole
Message:

Cosmetic

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/combine_pts.py

    r2022 r2252  
    1 """Add two point files by the union of the fine and coarse points.
    2 Course points that are in the extent of the fine points are removed.
    3 
    4 The extent of the fine points file is assumed to be a rectangle, parallel
    5 to the x and y axis.
     1"""Functionality for aggregation of points files
    62
    73   Ole Nielsen, Stephen Roberts, Duncan Gray
    84   Geoscience Australia, 2005.   
    95"""
     6
    107from utilities.polygon import outside_polygon, inside_polygon
    118from Numeric import take, concatenate
     
    1613
    1714def combine_rectangular_points_files(fine_points_file,
    18                                     coarse_points_file,
    19                                     output_points_file,
     15                                     coarse_points_file,
     16                                     output_points_file,
    2017                                     verbose = False):
     18    """Add two point files by the union of the fine and coarse points.
    2119   
    22     from load_mesh.loadASCII import import_points_file, extent, point_atts2array, export_points_file, add_point_dictionaries,take_points
     20       Course points that are in the extent of the fine points are removed.
     21
     22       The extent of the fine points file is assumed to be a rectangle, parallel
     23       to the x and y axis.
     24    """
     25   
     26    from load_mesh.loadASCII import import_points_file, extent, point_atts2array, export_points_file, add_point_dictionaries, take_points
    2327
    2428   
    2529    # load fine points file
    26     if verbose:print "loading Point files"
     30    if verbose: print "loading Point files"
    2731    fine = import_points_file(fine_points_file)
    2832   
     
    3034    coarse = import_points_file(coarse_points_file)
    3135       
    32     if verbose:print "doing other stuff"
     36    if verbose: print "doing other stuff"
    3337    # convert to Numeric   
    3438    fine = point_atts2array(fine)
     
    4448        if coarse.has_key('geo_reference'):
    4549            coarse['pointlist'] = \
    46              fine['geo_reference'].change_points_geo_ref(coarse['pointlist'],
    47                                                          points_geo_ref=coarse['geo_reference']) 
     50                fine['geo_reference'].change_points_geo_ref(coarse['pointlist'],
     51                                                            points_geo_ref=coarse['geo_reference']) 
    4852    # find extent of course points
    4953    extent = extent(fine['pointlist'])   
     
    5559        t0 = time.time()
    5660    outside_coarse_indices = outside_polygon(coarse['pointlist'],
    57                                              extent,closed=True)
     61                                             extent, closed=True)
    5862    if verbose:
    5963        print "Points outside determined"
     
    6468       
    6569    # add fine points and out_points
    66     if verbose:print "Adding points"
     70    if verbose: print "Adding points"
    6771    combined = add_point_dictionaries(fine, coarse)
    6872
    6973    # save
    70     if verbose:print "writing points"
     74    if verbose: print "writing points"
    7175    export_points_file(output_points_file, combined)
    7276
    7377def add_points_files(fine_points_file,
    74                                     coarse_points_file,
    75                                     output_points_file,
    76                                      verbose = False):
     78                     coarse_points_file,
     79                     output_points_file,
     80                     verbose = False):
     81    """
     82    """
    7783   
    7884    from load_mesh.loadASCII import import_points_file, extent, point_atts2array, export_points_file, add_point_dictionaries,take_points
     
    113119       
    114120    # add fine points and out_points
    115     if verbose:print "Adding points"
     121    if verbose: print "Adding points"
    116122    combined = add_point_dictionaries(fine, coarse)
    117123
    118124    # save
    119     if verbose:print "writing points"
     125    if verbose: print "writing points"
    120126    export_points_file(output_points_file, combined)
    121127
    122128def reduce_points_to_mesh_extent(points_file,
    123                                     mesh_file,
    124                                     output_points_file,
    125                                      verbose = False):
     129                                 mesh_file,
     130                                 output_points_file,
     131                                 verbose = False):
     132    """
     133    """   
    126134   
    127135    from load_mesh.loadASCII import import_points_file, extent, point_atts2array, export_points_file, add_point_dictionaries,take_points, import_mesh_file
     
    145153            extent = \
    146154             points['geo_reference'].change_points_geo_ref(extent,
    147                                                          points_geo_ref=mesh['geo_reference']) 
     155                                                           points_geo_ref=mesh['geo_reference']) 
    148156    #print "extent",extent
    149157
Note: See TracChangeset for help on using the changeset viewer.