Changeset 1071


Ignore:
Timestamp:
Mar 14, 2005, 10:11:37 AM (20 years ago)
Author:
duncan
Message:

new functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pmesh/load_mesh/loadASCII.py

    r1059 r1071  
    5151
    5252from string import  find, rfind
    53 from Numeric import array, Float, Int16, Int32, Character,reshape, concatenate
     53from Numeric import array, Float, Int16, Int32, Character,reshape, concatenate, take
    5454from os.path import splitext
    5555
     
    11821182    return xya_dict
    11831183
     1184#FIXME(dsg), turn this dict plus methods into a class?
     1185def take_points(dict,indices_to_keep):
     1186    dict = point_atts2array(dict)
     1187    #FIXME maybe the points data structure should become a class?
     1188    dict['pointlist'] = take(dict['pointlist'],indices_to_keep)
     1189
     1190    for key in dict['attributelist'].keys():
     1191        dict['attributelist'][key]= take(dict['attributelist'][key],
     1192                                         indices_to_keep)
     1193    return dict
     1194   
     1195def add_point_dictionaries (dict1, dict2):
     1196    """
     1197    """
     1198    dict1 = point_atts2array(dict1)
     1199    dict2 = point_atts2array(dict2)
     1200   
     1201    combined = {} 
     1202    combined['pointlist'] = concatenate((dict2['pointlist'],
     1203                                         dict1['pointlist']),axis=0)   
     1204    atts = {}   
     1205    for key in dict2['attributelist'].keys():
     1206        atts[key]= concatenate((dict2['attributelist'][key],
     1207                                dict1['attributelist'][key]), axis=0)
     1208    combined['attributelist']=atts
     1209    combined['geo_reference'] = dict1['geo_reference']
     1210    return combined
     1211   
    11841212#FIXME (DSG) need an export_points_file method..               
    11851213def export_xya_file( file_name, xya_dict, title, delimiter = ','):
Note: See TracChangeset for help on using the changeset viewer.