Ignore:
Timestamp:
Feb 12, 2010, 9:22:29 AM (15 years ago)
Author:
griffin
Message:

Added extra plotting scripts for arrival time and velocity comparisons

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_work/production/australia_ph2/plot_comparisons/plot_250m_comparisons.py

    r7542 r7622  
    11"""
    22Program to plot the results from the Phase 2 comparisions.
     3Compares stage height results from models run with best available data against those
     4using the Geoscience Australia 250 m bathymetry/elevation grid (2005).
    35
    46
     
    1921path = r'/nas/gemd/georisk_models/inundation/data/australia_ph2/documents/250m comparisons'
    2022path_list = []
    21 model_list = ['BatemansBay', 'Busselton', 'Carnarvon', 'Geraldton', 'GoldCoast', 'Gosford', 'Pt_hedland']
     23model_list = ['BatemansBay', 'Busselton', 'Carnarvon', 'Geraldton', 'GoldCoast', 'Gosford', 'Hobart', 'Pt_hedland']
    2224
    2325# Choose figure name here! This controls what is plotted
    2426#figure_name = 'Phase2comparions_percent.png' # Plots the mean percentage difference in stage
    25 figure_name = 'Phase2comparions.png'   # Plots the absolute difference in stage
     27#figure_name = 'Phase2comparions.png'   # Plots the absolute difference in stage
     28#figure_name = 'greens_law_comparision.png'   # Plots the absolute difference in stage compared to Greens Law
     29figure_name = 'greens_law_percent_comparision.png'   # Plots the percentage difference in stage compared to Greens Law
     30
    2631figure_folder = join(path, 'figures')
    2732figure_path = join(figure_folder, figure_name)
    2833
    29 for model in model_list:
    30     model_path = join(path, model, 'comparisons.csv')
    31     path_list.append(model_path)
    32 
    33 plot_dict = {'BatemansBay':'x', 'Busselton':'^', 'Carnarvon':'x', 'Geraldton':'h', 'GoldCoast': 'v', 'Gosford':'+', 'Pt_hedland':'+'}
    34 colour_dict = {'BatemansBay':'r', 'Busselton':'b', 'Carnarvon': 2.03, 'Geraldton':'b', 'GoldCoast': 'r', 'Gosford':'r', 'Pt_hedland':'b'}
     34plot_dict = {'BatemansBay':'x', 'Busselton':'^', 'Carnarvon':'x', 'Geraldton':'h', 'GoldCoast': 'v', 'Gosford':'+', 'Hobart':'^','Pt_hedland':'+'}
     35colour_dict = {'BatemansBay':'r', 'Busselton':'b', 'Carnarvon': 'b', 'Geraldton':'b', 'GoldCoast': 'r', 'Gosford':'r',  'Hobart':'r','Pt_hedland':'b'}
    3536
    3637mean_100m_stage = {'BatemansBay': 1.10, 'Busselton': 0.98, 'Carnarvon': 2.03, 'Geraldton':0.95,
     
    3839event_dict = {'BatemansBay': 58284, 'Busselton': 27283, 'Carnarvon': 27283, 'Geraldton':27283,
    3940              'GoldCoast': 51469, 'Gosford': 51436, 'Hobart': 58260, 'Pt_hedland': 27283}
     41
     42depth_list2 = [-60,-50,-40,-30,-20,-10,0,10]
     43twenty_m = [20,20,20,20,20,20,20,20]
     44fifty_m = [50,50,50,50,50,50,50,50]
     45
     46for model in model_list:
     47    model_path = join(path, model, 'comparisons.csv')
     48    path_list.append(model_path)
    4049#
    4150pylab.cla()
     
    4857    orig_stage_index = header.index('stage_high_res_model')
    4958    print depth_index, stage_diff_index, orig_stage_index
     59   
    5060    depth = []
    5161    stage_diff = []
     
    5767    depth_dict = dict.fromkeys(depth).keys()
    5868
     69    # Establish dictionaries and lists
    5970    stage_diff_dict = {}
    6071    orig_stage_dict = {}
     
    6374    orig_stage_mean_dict = {}
    6475    percent_diff_mean_dict = {}
     76   
     77    greens_law_dict = {}
     78    greens_law_percent_dict = {}   
     79    greens_law_mean_dict = {}
     80    greens_law_percent_mean_dict = {}
     81   
     82
    6583    key_list = []
    66    
    6784    diff_mean_list = []
    6885    percent_mean_list = []
     86    greens_law_diff_mean_list=[]
     87    greens_law_percent_mean_list=[]
     88
    6989   
    7090    for key in depth_dict:
    71    
     91
     92        #print 'key',key
     93        # Calculate Green's Law estimate
     94        greens_estimate = mean_100m_stage[model_list[counter]]*numpy.power((100.0/abs(key+0.001)),(0.25))
     95        #print 'greens_estimate', greens_estimate
     96        # Lists to store results
    7297        stage_diff_list = []       
    7398        orig_stage_list = []
    7499        percent_diff_list = []
     100        greens_law_diff = []
     101        greens_law_percent = []
     102       
     103        # Loop through depths
    75104        for i in range(len(depth)):
    76105            if depth[i] == key:
     
    78107                orig_stage_list.append(orig_stage[i])
    79108                percent_diff_list.append((stage_diff[i]/orig_stage[i])*100)
     109                greens_law_diff.append(abs((orig_stage[i]-greens_estimate)))
     110                greens_law_percent.append(abs(((orig_stage[i]-greens_estimate)/orig_stage[i])*100))
     111               
    80112        stage_diff_dict[key] = stage_diff_list
    81113        orig_stage_dict[key] = orig_stage_list
    82114        percent_diff_dict[key] = percent_diff_list
     115        greens_law_dict[key] = greens_law_diff
     116        greens_law_percent_dict[key] = greens_law_percent
    83117
    84118        stage_diff_mean_dict[key] = numpy.mean(stage_diff_dict[key])
    85119        orig_stage_mean_dict[key] = numpy.mean(orig_stage_dict[key])
    86120        percent_diff_mean_dict[key] = numpy.mean( percent_diff_dict[key])
     121        greens_law_mean_dict[key] = numpy.mean(greens_law_dict[key])
     122        greens_law_percent_mean_dict[key] = numpy.mean(greens_law_percent_dict[key])
     123       
    87124        key_list.append(key)
    88125        diff_mean_list.append(stage_diff_mean_dict[key])
    89126        percent_mean_list.append(percent_diff_mean_dict[key])
    90 
     127        greens_law_diff_mean_list.append(greens_law_mean_dict[key])
     128        greens_law_percent_mean_list.append(greens_law_percent_mean_dict[key])
     129        #print 'greens_law_diff_mean_list', greens_law_diff_mean_list
    91130    pylab.semilogy()
    92131    pylab.xlabel('Depth (m)')
     
    96135        pylab.ylabel('Difference (m)')
    97136        pylab.scatter(key_list,diff_mean_list, marker = plot_dict[model_list[counter]],color = colour_dict[model_list[counter]])
     137       
    98138    if figure_name == 'Phase2comparions_percent.png':
    99139        pylab.title('Mean percentage difference in stage height')
    100140        pylab.ylabel('Difference %')
    101141        pylab.scatter(key_list,percent_mean_list, marker = plot_dict[model_list[counter]],color = colour_dict[model_list[counter]])
    102            
     142        pylab.plot(depth_list2,twenty_m, color = 'black')
     143       
     144    if figure_name == 'greens_law_comparision.png':
     145        pylab.title('Greens Law mean difference in stage height')
     146        pylab.ylabel('Difference (m)')
     147        pylab.scatter(key_list,greens_law_diff_mean_list, marker = plot_dict[model_list[counter]],color = colour_dict[model_list[counter]])
     148       
     149    if figure_name == 'greens_law_percent_comparision.png':
     150        pylab.title('Greens Law mean percentage difference in stage height')
     151        pylab.ylabel('Difference %')
     152        pylab.scatter(key_list,greens_law_percent_mean_list, marker = plot_dict[model_list[counter]],color = colour_dict[model_list[counter]])
     153        pylab.plot(depth_list2,twenty_m, color = 'black')
    103154    counter+=1
    104155
     
    110161    pylab.text(-58, 600, 'East Coast', color = 'r')
    111162    pylab.text(-58, 400, 'West Coast', color = 'b')
    112    
     163    pylab.text(-58, 22, '20%')
     164
     165if figure_name == 'greens_law_comparision.png':
     166    pylab.text(-58, 60, 'East Coast', color = 'r')
     167    pylab.text(-58, 40, 'West Coast', color = 'b')
     168
     169if figure_name == 'greens_law_percent_comparision.png':
     170    pylab.text(-58, 5000, 'East Coast', color = 'r')
     171    pylab.text(-58, 3000, 'West Coast', color = 'b')
     172    pylab.text(-58, 22, '20%')
    113173
    114174pylab.savefig(figure_path)
Note: See TracChangeset for help on using the changeset viewer.