Changeset 2083


Ignore:
Timestamp:
Nov 28, 2005, 7:17:33 PM (18 years ago)
Author:
ole
Message:

Karratha material for talk

Location:
production/karratha_2005
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • production/karratha_2005/get_timeseries.py

    r2069 r2083  
    11"""Read in sww file, interpolate at specified locations and plot time series
    2 Additionally, store augmented building database with max inundation depths
     2
    33"""
    44
     
    99
    1010
    11 plot = False
    1211   
    1312swwfile = project.outputname + '.sww'
     
    4140gauges, buildings = get_gauges_from_file(project.gauge_filename)
    4241
     42gauges = [[easting, northing-10]]
     43
     44
    4345#Read model output
    4446quantities = ['stage', 'elevation', 'xmomentum', 'ymomentum']
     
    5052
    5153
    52 buildings[0] = buildings[0].strip() +\
    53                ',MAX INUNDATION DEPTH (m)' +\
    54                ',MAX MOMENTUM (m^2/s)\n'           
    5554               
    5655from math import sqrt
     
    6867    max_momentum = 0   
    6968    for i, t in enumerate(f.T):
     69        #if tmin < t < tmax:
    7070        w = f(t, point_id = k)[0]
    7171        z = f(t, point_id = k)[1]
     
    8585            max_momentum = m   
    8686
    87     #Augment building data
    88     buildings[k+1] = buildings[k+1].strip() +\
    89                      ',%f' %max_depth +\
    90                      ',%f\n' %max_momentum
    9187   
    92     #print buildings[k]
    93    
    94     if plot is True:
    95         #Plot only those gauges that have been inundated by more than a threshold
    96         if max_depth < 0.2:
    97             print 'Skipping gauge %d' %k
    98             continue
    9988
    100         #FIXME Reduce to tmin and tmax
    101         #i0 = model_timefind
    102    
    103         ion()
    104         hold(False)
     89    #Plot only those gauges that have been inundated by more than a threshold
     90    #if max_depth < 0.2:
     91    #    print 'Skipping gauge %d' %k
     92    #    continue
    10593
    106         if elevations[0] < -10:
    107             plot(model_time, stages, '-b')
    108         else:   
    109             plot(model_time, stages, '-b',
    110                  model_time, elevations, '-k')
    111         name = 'Gauge_%d: (%.1f, %.1f)' %(k, g[0], g[1])
    112         title(name)
     94    ion()
     95    hold(False)
    11396
    114         title('%s (stage)' %name)
    115         xlabel('time [s]')
    116         ylabel('elevation [m]')   
    117         legend(('Stage', 'Bed = %.1f' %elevations[0]),
    118                shadow=True,
    119                loc='upper right')
    120         savefig('Gauge_%d_stage' %k)
     97    if elevations[0] < -10:
     98        plot(model_time, stages, '-b')
     99    else:   
     100        plot(model_time, stages, '-b',
     101             model_time, elevations, '-k')
     102    name = 'Gauge_%d: (%.1f, %.1f)' %(k, g[0], g[1])
     103    title(name)
    121104
    122         raw_input('Next')
     105    title('%s (stage)' %name)
     106    xlabel('time [s]')
     107    ylabel('elevation [m]')   
     108    legend(('Stage', 'Bed = %.1f' %elevations[0]),
     109           shadow=True,
     110           loc='upper right')
     111    savefig('Gauge_%d_stage' %k)
     112
     113    raw_input('Next')
    123114
    124115
    125         #Momentum plot
    126         ion()
    127         hold(False)
    128         plot(model_time, momenta, '-r')
    129         title(name)
     116    #Momentum plot
     117    ion()
     118    hold(False)
     119    plot(model_time, momenta, '-r')
     120    title(name)
    130121
    131         title('%s (momentum)' %name)
    132         xlabel('time [s]')
    133         ylabel('sqrt( uh^2 + vh^2 ) [m^2/s]')   
    134         savefig('Gauge_%d_momentum' %k)
    135 
    136         raw_input('Next')
     122    title('%s (momentum)' %name)
     123    xlabel('time [s]')
     124    ylabel('sqrt( uh^2 + vh^2 ) [m^2/s]')   
     125    savefig('Gauge_%d_momentum' %k)
     126   
     127    raw_input('Next')
    137128   
    138129
    139 #Store new building file with mak depths added
     130show()
    140131
    141 FN = 'inundation_augmented_' + project.gauge_filename
    142 fid = open(FN, 'w')
    143 for line in buildings:
    144     fid.write(line)
    145 fid.close()   
    146 
    147 
    148 if plot is True:   
    149     show()
    150 
Note: See TracChangeset for help on using the changeset viewer.