Changeset 4582


Ignore:
Timestamp:
Jul 3, 2007, 4:29:52 PM (17 years ago)
Author:
sexton
Message:

update to sww2timeseries

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r4571 r4582  
    970970    line11 = line1.split(',')
    971971
    972     if line11[0] is basestring:
     972    if isinstance(line11[0],str) is True:
    973973        # We have found text in the first line
    974        
    975         east_index = len(line11)+1
    976         north_index = len(line11)+1
    977         name_index = len(line11)+1
    978         elev_index = len(line11)+1
     974        east_index = None
     975        north_index = None
     976        name_index = None
     977        elev_index = None
    979978        for i in range(len(line11)):
    980             if line11[i].strip('\n').strip(' ').lower() == 'easting': east_index = i
    981             if line11[i].strip('\n').strip(' ').lower() == 'northing': north_index = i
    982             if line11[i].strip('\n').strip(' ').lower() == 'name': name_index = i
    983             if line11[i].strip('\n').strip(' ').lower() == 'elevation': elev_index = i
     979            if line11[i].strip('\n').strip('\r').strip(' ').lower() == 'easting': east_index = i
     980            if line11[i].strip('\n').strip('\r').strip(' ').lower() == 'northing': north_index = i
     981            if line11[i].strip('\n').strip('\r').strip(' ').lower() == 'name': name_index = i
     982            if line11[i].strip('\n').strip('\r').strip(' ').lower() == 'elevation': elev_index = i
    984983
    985984        if east_index < len(line11) and north_index < len(line11):
     
    990989            raise Exception, msg
    991990
    992         if elev_index >= len(line11):
     991        if elev_index is None:
    993992            raise Exception
    994993   
    995         if name_index >= len(line11):
     994        if name_index is None:
    996995            raise Exception
    997996
     
    10101009        elev = [-9999]*N
    10111010        gaugelocation = range(N)
    1012        
    10131011       
    10141012    # Read in gauge data
     
    10221020            loc = fields[name_index]
    10231021            gaugelocation.append(loc.strip('\n'))
    1024            
    10251022
    10261023    return gauges, gaugelocation, elev
Note: See TracChangeset for help on using the changeset viewer.