Changeset 1125
- Timestamp:
- Mar 22, 2005, 5:48:05 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/test_data_manager.py
r1121 r1125 728 728 from coordinate_transforms.redfearn import redfearn 729 729 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 733 747 734 748 first_amp = fid1.variables['HA'][:][0,0,0] … … 737 751 fourth_elevation= fid2.variables['ELEVATION'][:][0,3] 738 752 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 740 755 741 756 fid1.close() … … 748 763 749 764 750 #Work out the UTM coordinates for first point751 zone, e, n = redfearn(-34.5, 150.66667)752 #print zone, e, n753 754 765 #Read output file 'small.sww' 755 766 fid = NetCDFFile('small.sww') 756 767 757 x = fid.variables['x'][:]758 y = fid.variables['y'][:]759 760 761 #Check that first coordinate is correctly represented762 assert allclose(x[0], e)763 assert allclose(y[0], n)764 768 765 769 #Check first value … … 776 780 777 781 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 778 786 assert allclose(ymomentum[0][1],fourth_momentum) #Meters 779 787
Note: See TracChangeset
for help on using the changeset viewer.