Changeset 1125


Ignore:
Timestamp:
Mar 22, 2005, 5:48:05 PM (20 years ago)
Author:
ole
Message:

Working on ferret2sww3 test (Peter)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/test_data_manager.py

    r1121 r1125  
    728728        from coordinate_transforms.redfearn import redfearn
    729729
    730         fid1 = NetCDFFile('small_ha.nc')
    731         fid2 = NetCDFFile('small_e.nc')
    732         fid3 = NetCDFFile('small_va.nc')
     730        fid1 = NetCDFFile('small_ha.nc','a')
     731        fid3 = NetCDFFile('small_va.nc','a')
     732
     733        #Populate with decent values
     734        fid1.variables['HA'][:][0,0,3]=130.7
     735        fid3.variables['VA'][:][0,0,3]=10.0
     736
     737
     738        fid1.sync(); fid1.close()
     739        fid3.sync(); fid3.close()
     740
     741        fid1 = NetCDFFile('small_ha.nc','r')
     742        fid2 = NetCDFFile('small_e.nc','r')
     743        fid3 = NetCDFFile('small_va.nc','r')
     744
     745        print fid3.variables['VA'][:]
     746       
    733747
    734748        first_amp = fid1.variables['HA'][:][0,0,0]
     
    737751        fourth_elevation= fid2.variables['ELEVATION'][:][0,3]
    738752        first_speed = fid3.variables['VA'][0,0]
    739         fourth_speed = fid3.variables['VA'][:][0,3]
     753        fourth_speed = fid3.variables['VA'][:][0,0,3]
     754        print 'fourth speed', fourth_speed
    740755
    741756        fid1.close()
     
    748763
    749764
    750         #Work out the UTM coordinates for first point
    751         zone, e, n = redfearn(-34.5, 150.66667)
    752         #print zone, e, n
    753 
    754765        #Read output file 'small.sww'
    755766        fid = NetCDFFile('small.sww')
    756767
    757         x = fid.variables['x'][:]
    758         y = fid.variables['y'][:]
    759        
    760 
    761         #Check that first coordinate is correctly represented
    762         assert allclose(x[0], e)
    763         assert allclose(y[0], n)
    764768
    765769        #Check first value
     
    776780
    777781        assert allclose(ymomentum[0][0],first_momentum)  #Meters
     782
     783        print 'YM1', ymomentum[0][1]
     784        print 'YM4', ymomentum[0][3]       
     785        print '4M', fourth_momentum
    778786        assert allclose(ymomentum[0][1],fourth_momentum)  #Meters
    779787
Note: See TracChangeset for help on using the changeset viewer.