Changeset 3221 for inundation/pyvolution


Ignore:
Timestamp:
Jun 23, 2006, 5:06:07 PM (19 years ago)
Author:
sexton
Message:

updates

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/pyvolution/util.py

    r3190 r3221  
    599599    surface          - if True, then generate solution surface with 3d plot
    600600                       and save to current working directory
     601                     - default = False
    601602   
    602603    time_min         - beginning of user defined time range for plotting purposes
     
    862863    for j, f in enumerate(f_list):
    863864        if verbose: print 'swwfile %d of %d' %(j, len(f_list))
     865        comparefile = file_loc[j]+sep+'gauges_maxmins'+'.csv'
     866        fid_compare = open(comparefile, 'w')
    864867        ##### loop over each gauge #####
    865868        for k, g in enumerate(gauges):
     
    874877            s = 'Time, Stage, Momentum, Speed \n'
    875878            fid_out.write(s)
     879           
    876880            #### generate quantities #######
    877881            for i, t in enumerate(f.get_time()):
     
    901905                    s = '%.2f, %.2f, %.2f, %.2f\n' %(t, w, m, vel)
    902906                    fid_out.write(s)
     907                    if t/60.0 <= 13920: tindex = i
    903908                    if w > max_stage: max_stage = w
    904909                    if w < min_stage: min_stage = w
    905910                    if m > max_momentum: max_momentum = m
    906                     if vel > max_speed: max_speed = vel           
    907            
     911                    if vel > max_speed: max_speed = vel
     912                   
     913                   
     914            s = '%.2f, %.2f, %.2f, %s\n' %(max_stage, min_stage, z, leg_label[j])
     915            fid_compare.write(s)
    908916            max_stages.append(max_stage)
    909917            min_stages.append(min_stage)
    910918            max_momentums.append(max_momentum)
    911             max_speeds.append(max_speed)        
     919            max_speeds.append(max_speed)     
    912920            #### finished generating quantities for each swwfile #####
    913 
     921       
    914922        model_time_plot3d[:,:] = model_time[:,:,j]
    915923        stages_plot3d[:,:] = stages[:,:,j]
     
    922930                ax = p3.Axes3D(fig)
    923931                if len(gauges) > 80:
    924                     ax.plot_surface(eastings,model_time_plot3d,stages_plot3d)
    925                     #ax.plot_surface(eastings[:,:,j],model_time[:,:,j],stages[:,:,j])
     932                    ax.plot_surface(model_time[:,:,j],eastings[:,:,j],stages[:,:,j])
    926933                else:
    927                     #ax.plot_wireframe(eastings[:,:,j],model_time[:,:,j],stages[:,:,j])
    928                     ax.plot_wireframe(eastings,model_time_plot3d,stages_plot3d)
     934                    ax.plot_wireframe(model_time[:,:,j],eastings[:,:,j],stages[:,:,j])
    929935                    #ax.plot3D(ravel(eastings[:,:,j]),ravel(model_time[:,:,j]),ravel(stages[:,:,j]))
    930                 ax.set_xlabel('x')
    931                 ax.set_ylabel('time')
     936                ax.set_xlabel('time')
     937                ax.set_ylabel('x')
    932938                ax.set_zlabel('stage')
    933939                fig.add_axes(ax)
     
    936942                p1.savefig(surfacefig)
    937943                p1.close()
    938        
     944           
    939945    #### finished generating quantities for all swwfiles #####
    940946
     947    # x profile for given time
     948    if surface == True:
     949        figure(11)
     950        plot(eastings[tindex,:,j],stages[tindex,:,j])
     951        xlabel('x')
     952        ylabel('stage')
     953        profilefig = 'solution_xprofile'
     954        savefig('profilefig')
     955               
    941956    stage_axis = axis([time_min/60.0, time_max/60.0, min(min_stages), max(max_stages)*1.1])
    942957    vel_axis = axis([time_min/60.0, time_max/60.0, min(max_speeds), max(max_speeds)*1.1])
    943     mom_axis = axis([time_min/60.0, time_max/60.0, min(max_momentums), max(max_momentums)*1.1])
    944 
     958    mom_axis = axis([time_min/60.0, time_max/60.0, min(max_momentums), max(max_momentums)*1.1]) 
     959   
    945960    cstr = ['g', 'r', 'b', 'c', 'm', 'y', 'k']
    946961    nn = len(plot_quantity)
     
    10051020                xlabel('time (mins)')
    10061021                ylabel('%s (%s)' %(which_quantity, units))
    1007                 legend((leg_label),loc='upper right')
     1022                if len(label_id) > 1: legend((leg_label),loc='upper right')
    10081023
    10091024                gaugeloc1 = gaugeloc.replace(' ','')
     
    10401055                        else:
    10411056                            s = '& \n'
    1042                         fid.write(s)                       
     1057                        fid.write(s)
     1058                        savefig(graphname_latex)
    10431059               
    10441060                if title_on == True:
     
    10551071                   
    10561072                word_quantity += ' and ' + plot_quantity[nn-1]               
    1057                 caption = 'Time series for %s at %s gauge location (elevation %.2fm)' %(word_quantity, locations[k], elev[k]) #gaugeloc.replace('_',' '))
     1073                caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elev[k]) #gaugeloc.replace('_',' '))
    10581074                if elev[k] == 0.0:
    1059                     caption = 'Time series for %s at %s gauge location (elevation %.2fm)' %(word_quantity, locations[k], elevations[0,k,j])
     1075                    caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elevations[0,k,j])
    10601076                    east = gauges[0]
    10611077                    north = gauges[1]
     
    10901106            word_quantity += ' and ' + plot_quantity[nn-1]           
    10911107            label = 'gauge%s' %(gaugeloc2)
    1092             caption = 'Time series for %s at %s gauge location (elevation %.2fm)' %(word_quantity, locations[k], elev[k])
     1108            caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elev[k])
    10931109            if elev[k] == 0.0:
    1094                     caption = 'Time series for %s at %s gauge location (elevation %.2fm)' %(word_quantity, locations[k], elevations[0,k,j])
     1110                    caption = 'Time series for %s at %s location (elevation %.2fm)' %(word_quantity, locations[k], elevations[0,k,j])
    10951111                    thisgauge = gauges[k]
    10961112                    east = thisgauge[0]
Note: See TracChangeset for help on using the changeset viewer.