Ignore:
Timestamp:
Jun 9, 2010, 12:28:24 PM (12 years ago)
Author:
hudson
Message:

New filename conventions for file conversion. Filenames must always be passed in with the correct extension.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/file_conversion/sdf2pts.py

    r7758 r7814  
    3838
    3939
    40 def sdf2pts(basename_in,
    41                               basename_out=None,
     40def sdf2pts(name_in,
     41                              name_out=None,
    4242                              verbose=False):
    4343    """Read HEC-RAS Elevation datal from the following ASCII format (.sdf)
     
    9999    from Scientific.IO.NetCDF import NetCDFFile
    100100
    101     root = basename_in
     101    if name_in[-4:] != '.sdf':
     102        raise IOError('Input file %s should be of type .sdf.' % name_in)
     103
     104    if name_out is None:
     105        name_out = name_in[:-4] + '.pts'
     106    elif name_out[-4:] != '.pts':
     107        raise IOError('Input file %s should be of type .pts.' % name_out)
    102108
    103109    # Get ASCII file
    104     infile = open(root + '.sdf', 'r')
     110    infile = open(name_in, 'r')
    105111
    106112    if verbose: log.critical('Reading DEM from %s' % (root + '.sdf'))
     
    170176
    171177    # Get output file, write PTS data
    172     if basename_out == None:
    173         ptsname = root + '.pts'
     178    if name_out == None:
     179        ptsname = name_in[:-4] + '.pts'
    174180    else:
    175         ptsname = basename_out + '.pts'
     181        ptsname = name_out
    176182
    177183    geo_ref = Geo_reference(zone, 0, 0, datum, projection, units)
Note: See TracChangeset for help on using the changeset viewer.