Changeset 1047


Ignore:
Timestamp:
Mar 9, 2005, 4:37:29 PM (20 years ago)
Author:
duncan
Message:

added reading and writing of geo_ref info to ASCII files

Location:
inundation/ga/storm_surge/pmesh/load_mesh
Files:
2 edited

Legend:

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

    r1021 r1047  
    5151
    5252from string import  find, rfind
    53 from Numeric import array, Float, Int16, Character,reshape, concatenate
     53from Numeric import array, Float, Int16, Int32, Character,reshape, concatenate
    5454from os.path import splitext
    5555
     
    197197        stringtag = line.strip()
    198198        segmenttags.append(stringtag)
     199
     200    try:
     201        geo_reference = Geo_reference(ASCIIFile=fd)
     202    except AttributeError, e:
     203        #geo_ref not compulsory
     204        geo_reference = None
     205           
    199206    meshDict = {}
    200207    meshDict['vertices'] = points
     
    206213    meshDict['segment_tags'] = segmenttags
    207214    meshDict['vertex_attribute_titles'] = vertTitle
     215    meshDict['geo_reference'] = geo_reference
    208216    return meshDict
    209217   
     
    385393    return numbers
    386394
     395#FIXME change this name
    387396def write_ASCII_triangulation(fd,
    388397                               gen_dict):
     
    475484                 + str(segment_tags[i]) + "\n")
    476485
     486    # geo_reference info
     487    if gen_dict.has_key('geo_reference') and not gen_dict['geo_reference'] is None:
     488        gen_dict['geo_reference'].write_ASCII(fd)
    477489
    478490def export_mesh_file(ofile,mesh_dict):
     
    607619    from Scientific.IO.NetCDF import NetCDFFile
    608620
    609     IntType = Int16
     621    IntType = Int32
    610622   
    611623    #
  • inundation/ga/storm_surge/pmesh/load_mesh/test_loadASCII.py

    r1026 r1047  
    229229                        array(loadedDict['vertex_attribute_titles']),
    230230                         'test_export_mesh_file failed. Test 8')
     231        self.failUnless(array(meshDict['geo_reference'])  ==
     232                        array(loadedDict['geo_reference']),
     233                         'test_export_mesh_file failed. Test 9')
    231234           
    232235        os.remove(fileName)
Note: See TracChangeset for help on using the changeset viewer.