Changeset 9057


Ignore:
Timestamp:
Mar 3, 2014, 10:05:11 AM (11 years ago)
Author:
davies
Message:

Fixing towradgi test following Petar's suggestion

Location:
trunk/anuga_core/source/anuga_validation_tests/case_studies/towradgi
Files:
3 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga_validation_tests/case_studies/towradgi/Compare_results_with_fieldObs.py

    r9051 r9057  
    88from anuga.utilities import plot_utils as util
    99
     10
    1011swwdir='MODEL_OUTPUTS/'
    11 #swwdir='MODEL_bridges_n0p04/'
     12swwname='Towradgi_historic_flood.sww' #'Aug98_hort_discontinous.sww' #'Towradgi_historic_flood.sww'
    1213
    13 p=util.get_output(swwdir+'Towradgi_historic_flood.sww')
     14p=util.get_output(swwdir+swwname)
    1415p2=util.get_centroids(p,velocity_extrapolation=True)
    1516floodLevels=scipy.genfromtxt('Validation/historic_1998_flood_levels_towradgi_ck.csv', delimiter=',',skip_header=1)
     17pioneerLevel=scipy.genfromtxt('Validation/pioneer_timeseries.txt',
     18                              skip_header=1)
    1619
    1720# Extract modelled peak at the coordinates in floodLevels
     
    2730    modelled_ind[i]=myInd
    2831    modelled_level[i]=p2.stage[:,myInd].max()
     32
     33    if(i==0):
     34        pyplot.clf()
     35        pyplot.plot(p2.time,p2.stage[:, myInd],color='red')
     36        pyplot.plot((pioneerLevel[:,0]-540.)*60., pioneerLevel[:,2],color='black')
     37        pyplot.xlabel('Time')
     38        pyplot.ylabel('Stage (m)')
     39        pyplot.title('Pioneer Bridge Stage')
     40        pyplot.savefig('Pioneer_Bridge_Stage.png')
     41   
    2942
    3043pyplot.clf()
     
    5366    tif_outdir='OUTPUT_TIFS'
    5467    CellSize=5.0
    55     util.Make_Geotif(swwdir+'Towradgi_historic_flood.sww',
     68    print 'Making tifs'
     69    util.Make_Geotif(swwdir+swwname,
    5670                      ['depth','velocity','depthIntegratedVelocity','elevation'],'max',
    5771                      CellSize=CellSize,EPSG_CODE=32756,output_dir=tif_outdir)
    58 
     72    print 'Made tifs'
    5973    # Plot depth raster with discrepency between model and data
    6074    depthFile=tif_outdir+'/Towradgi_historic_flood_depth_max_max.tif'
     
    6680    pyplot.figure(figsize=(12,6))
    6781    pyplot.plot([X.min(),X.max()],[Y.min(),Y.max()],' ')
    68     pyplot.imshow(myDepth,extent=[X.min(),X.max(),Y.min(),Y.max()],origin='lower',cmap=pyplot.get_cmap('Greys'))
     82    print 'Imshow'
     83    #import pdb
     84    #pdb.set_trace()
     85    pyplot.imshow(scipy.flipud(myDepth),extent=[X.min(),X.max(),Y.min(),Y.max()],origin='lower',cmap=pyplot.get_cmap('Greys'))
    6986    pyplot.gca().set_aspect('equal')
    7087    pyplot.colorbar(orientation='horizontal').set_label('Peak Depth in model (m)')
    71     pyplot.scatter(floodLevels[:,0], floodLevels[:,1], c=floodLevels[:,3]-modelled_level,s=20,cmap=pyplot.get_cmap('spectral'))
     88    er1=floodLevels[:,3]-modelled_level
     89    #er1=er1*(er1<1.0) + 1.0*(er1>=1.0)
     90    #er1=er1*(er1> -1.0) - 1.0*(er1<=-1.0)
     91    pyplot.scatter(floodLevels[:,0], floodLevels[:,1], c=er1,s=20,cmap=pyplot.get_cmap('spectral'))
    7292    pyplot.colorbar().set_label(label='Field observation - Modelled Peak Depth (m)')
    7393    pyplot.xlim([p.x.min()+p.xllcorner,p.x.max()+p.xllcorner])
     
    7595    pyplot.savefig('Spatial_Depth_and_Error.png')
    7696except:
    77     'Cannot make GIS plot -- perhaps GDAL etc are not installed?'
     97    print 'Cannot make GIS plot -- perhaps GDAL etc are not installed?'
Note: See TracChangeset for help on using the changeset viewer.