Ignore:
Timestamp:
Nov 17, 2004, 3:28:09 PM (20 years ago)
Author:
duncan
Message:

added function to make boundary file for alpha shape

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

Legend:

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

    r511 r578  
    411411        raise IOError, msg
    412412
     413## used by alpha shapes
     414   
     415def export_boundary_file( file_name, points, title, delimiter = ','):
     416    """
     417    export a file, ofile, with the format
     418   
     419    First line: Title variable
     420    Following lines:  [point index][delimiter][point index]
     421
     422    file_name - the name of the new file
     423    points - List of point index pairs [[p1, p2],[p3, p4]..]
     424    title - info to write in the first line
     425    """
     426   
     427    fd = open(file_name,'w')
     428   
     429    fd.write(title+"\n")
     430    #[point index][delimiter][point index]
     431    for point in points:
     432        fd.write( str(point[0]) + delimiter
     433                  + str(point[1]) + "\n")
     434    fd.close()
     435
     436
    413437###
    414438#  LOADING XYA FILES
     
    423447    try:
    424448        fd = open(ofile)
     449        #print "ofile",ofile
    425450        xya_dic = read_xya_file(fd, delimiter)
    426451        fd.close()
     
    510535                  + attlist + "\n")
    511536    fd.close()
    512 
     537     
    513538if __name__ == "__main__":
    514539    m = import_mesh("tee.txt")
  • inundation/ga/storm_surge/pmesh/load_mesh/loadASCIIHarness.py

    r495 r578  
    44#FIXME (Ole): I think we need a unit test of write_ASCII_trianglulation
    55#             in order to quash bug in merimbula data
    6 
     6#  - to quash the bug need a raised error in pyvolution for reading xya files
     7# when the title attribute information is not consistent with the data in the
     8# file - DSG
    79
    810import sys
Note: See TracChangeset for help on using the changeset viewer.