Changeset 5992


Ignore:
Timestamp:
Nov 25, 2008, 9:51:52 AM (16 years ago)
Author:
Leharne
Message:

Phase 2 hazard map comparison plot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/perth/ph2_compare.py

    r5924 r5992  
    77
    88import project
    9 from pylab import plot, xlabel, ylabel, savefig, ion, close, axis, title, legend, grid
     9from pylab import plot, xlabel, ylabel, savefig, ion, close, axis, title, legend, grid, figure
    1010from os import sep
    1111
     
    1515
    1616def get_max_boundary_data(filename):
     17    from anuga.utilities.numerical_tools import mean
    1718    fid = open(filename)
    1819    lines = fid.readlines()
     
    2223        fields = line.split(',')
    2324        stage.append(float(fields[3]))
    24     return max(stage), min(stage)
     25    return mean(stage)
    2526
    2627def get_stage_data(filename,depth,no_models):
     
    6061
    6162event_number = 27283
    62 boundary_max, boundary_min = get_max_boundary_data(project.boundaries_dir+str(event_number)+sep+'max_sts_stage.csv')
     63boundary_mean = get_max_boundary_data(project.boundaries_dir+str(event_number)+sep+'max_sts_stage.csv')
    6364
    6465###################################################
     
    7071depth = [5.0,10.,20.,50.]
    7172no_models = 3
    72 filename = directory + sep + 'perth_ph2_compare_v2.csv'
     73filename = directory + sep + 'perth_ph2_compare_v5.csv'
    7374mean_stages, max_stages = get_stage_data(filename, depth, no_models)
    7475
     
    8182d1 = 100.
    8283d2 = arange(d1,1,-0.1)
    83 h1 = boundary_max
     84h1 = boundary_mean
    8485green = []
    8586for d in d2:
     
    8990ion()
    9091figure(1)
     92plot(depth,mean_stages[:,2],'>g',d2,green,'-g')
     93xlabel('depth (m)')
     94ylabel('stage (m)')
     95title('ANUGA outputs (average stage) versus Green\'s approximation \n \
     96for event 27283 at Perth')
     97legend(['original','Green\'s law'])
     98#axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1])
     99grid(True)
     100figname = 'ph2compare_perth_mean_ORIG_' + str(event_number) + '_mean'
     101savefig(figname)
     102
     103figure(2)
     104plot(depth,mean_stages[:,1],'+r',depth,mean_stages[:,2],'>g',d2,green,'-g')
     105xlabel('depth (m)')
     106ylabel('stage (m)')
     107title('ANUGA outputs (average stage) versus Green\'s approximation \n \
     108for event 27283 at Perth')
     109legend(['250m poly','original','Green\'s law'])
     110#axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1])
     111grid(True)
     112figname = 'ph2compare_perth_mean_250AP_' + str(event_number) + '_mean'
     113savefig(figname)
     114
     115figure(3)
    91116plot(depth,mean_stages[:,0],'ob',depth,mean_stages[:,1],'+r',depth,mean_stages[:,2],'>g',d2,green,'-g')
    92117xlabel('depth (m)')
     
    97122#axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1])
    98123grid(True)
    99 figname = 'ph2compare_perth_mean_' + str(event_number)
     124figname = 'ph2compare_perth_mean_ALL_' + str(event_number) + '_mean'
    100125savefig(figname)
    101126
    102 figure(2)
     127figure(4)
    103128plot(depth,max_stages[:,0],'ob',depth,max_stages[:,1],'+r',depth,max_stages[:,2],'>g',d2,green,'-g')
    104129xlabel('depth (m)')
     
    109134#axis([5,105,min(min(stages))*0.9,max(max(stages))*1.1])
    110135grid(True)
    111 figname = 'ph2compare_perth_max_' + str(event_number)
     136figname = 'ph2compare_perth_max_ALL_' + str(event_number) + '_mean'
     137savefig(figname)
    112138close('all')
    113139
Note: See TracChangeset for help on using the changeset viewer.