Changeset 3909


Ignore:
Timestamp:
Nov 2, 2006, 9:29:04 AM (17 years ago)
Author:
sexton
Message:

fixes to sww2timeseries

File:
1 edited

Legend:

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

    r3900 r3909  
    752752                         
    753753#Fixme - Use geospatial to read this file - it's an xya file
     754#Need to include other information into this filename, so xya + Name - required for report
    754755def get_gauges_from_file(filename):
    755756    from os import sep, getcwd, access, F_OK, mkdir
     
    763764    line1 = lines[0]
    764765    line11 = line1.split(',')
     766    east_index = len(line11)+1
     767    north_index = len(line11)+1
     768    name_index = len(line11)+1
     769    elev_index = len(line11)+1
    765770    for i in range(len(line11)):
    766         if line11[i].strip('\n').strip(' ') == 'Easting': east_index = i
    767         if line11[i].strip('\n').strip(' ') == 'Northing': north_index = i
    768         if line11[i].strip('\n').strip(' ') == 'Name': name_index = i
    769         if line11[i].strip('\n').strip(' ') == 'Elevation': elev_index = i
     771        if line11[i].strip('\n').strip(' ').title() == 'Easting': east_index = i
     772        if line11[i].strip('\n').strip(' ').title() == 'Northing': north_index = i
     773        if line11[i].strip('\n').strip(' ').title() == 'Name': name_index = i
     774        if line11[i].strip('\n').strip(' ').title() == 'Elevation': elev_index = i
    770775
    771776    for line in lines[1:]:
    772777        fields = line.split(',')
    773         gauges.append([float(fields[east_index]), float(fields[north_index])])
    774         elev.append(float(fields[elev_index]))
    775         loc = fields[name_index]
    776         gaugelocation.append(loc.strip('\n'))
     778        if east_index < len(line11) and north_index < len(line11):
     779            gauges.append([float(fields[east_index]), float(fields[north_index])])
     780        else:
     781            msg = 'WARNING: %s does not contain location information' %(filename)
     782            raise Exception, msg
     783        if elev_index < len(line11): elev.append(float(fields[elev_index]))
     784        if name_index < len(line11):
     785            loc = fields[name_index]
     786            gaugelocation.append(loc.strip('\n'))
    777787
    778788    return gauges, gaugelocation, elev
     
    944954                    ax.plot_surface(model_time[:,:,j],eastings[:,:,j],stages[:,:,j])
    945955                else:
    946                     ax.plot_wireframe(model_time[:,:,j],eastings[:,:,j],stages[:,:,j])
    947                     #ax.plot3D(ravel(eastings[:,:,j]),ravel(model_time[:,:,j]),ravel(stages[:,:,j]))
     956                    #ax.plot_wireframe(model_time[:,:,j],eastings[:,:,j],stages[:,:,j])
     957                    ax.plot3D(ravel(eastings[:,:,j]),ravel(model_time[:,:,j]),ravel(stages[:,:,j]))
    948958                ax.set_xlabel('time')
    949959                ax.set_ylabel('x')
     
    966976        savefig('profilefig')
    967977               
    968     stage_axis = axis([time_min/60.0, time_max/60.0, min(min_stages), max(max_stages)*1.1])
     978    #stage_axis = axis([time_min/60.0, time_max/60.0, min(min_stages), max(max_stages)*1.1])
     979    stage_axis = axis([time_min/60.0, time_max/60.0, -3.0, 3.0])   
    969980    vel_axis = axis([time_min/60.0, time_max/60.0, min(max_speeds), max(max_speeds)*1.1])
    970981    mom_axis = axis([time_min/60.0, time_max/60.0, min(max_momentums), max(max_momentums)*1.1]) 
     
    10931104                fid.write(s)
    10941105                c += 1
    1095                 if c % 25 == 0: fid.write('\\clearpage \n')
     1106                if c % 6 == 0: fid.write('\\clearpage \n')
    10961107                savefig(graphname_latex)               
    10971108               
     
    11291140            fid.write(s)
    11301141            c += 1
    1131             if c % 25 == 0: fid.write('\\clearpage \n')         
     1142            if c % 6 == 0: fid.write('\\clearpage \n')         
    11321143           
    11331144            #### finished generating figures ###
Note: See TracChangeset for help on using the changeset viewer.