Ignore:
Timestamp:
Nov 21, 2006, 4:50:59 PM (17 years ago)
Author:
duncan
Message:

fix bug reported in ticket#109, with ferret2sww

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r4013 r4024  
    23142314
    23152315
     2316    def test_ferret2sww_lat_long(self):
     2317        # Test that min lat long works
     2318
     2319        #The test file has
     2320        # LON = 150.66667, 150.83334, 151, 151.16667
     2321        # LAT = -34.5, -34.33333, -34.16667, -34 ;
     2322        # TIME = 0, 0.1, 0.6, 1.1, 1.6, 2.1 ;
     2323        #
     2324        # First value (index=0) in small_ha.nc is 0.3400644 cm,
     2325        # Fourth value (index==3) is -6.50198 cm
     2326
     2327
     2328
     2329        #Read
     2330        from anuga.coordinate_transforms.redfearn import redfearn
     2331        fid = NetCDFFile(self.test_MOST_file + '_ha.nc')
     2332        first_value = fid.variables['HA'][:][0,0,0]
     2333        fourth_value = fid.variables['HA'][:][0,0,3]
     2334        fid.close()
     2335
     2336
     2337        #Call conversion (with zero origin)
     2338        #ferret2sww('small', verbose=False,
     2339        #           origin = (56, 0, 0))
     2340        ferret2sww(self.test_MOST_file, verbose=False,
     2341                   origin = (56, 0, 0), minlat=-34.5, maxlat=-34)
     2342
     2343        #Work out the UTM coordinates for first point
     2344        zone, e, n = redfearn(-34.5, 150.66667)
     2345        #print zone, e, n
     2346
     2347        #Read output file 'small.sww'
     2348        #fid = NetCDFFile('small.sww')
     2349        fid = NetCDFFile(self.test_MOST_file + '.sww')
     2350
     2351        x = fid.variables['x'][:]
     2352        y = fid.variables['y'][:]
     2353        #Check that first coordinate is correctly represented
     2354        assert 16 == len(x)
     2355
     2356        fid.close()
     2357
     2358        #Cleanup
     2359        import os
     2360        os.remove(self.test_MOST_file + '.sww')
     2361
    23162362
    23172363    def test_ferret2sww3(self):
     
    48474893if __name__ == "__main__":
    48484894    #suite = unittest.makeSuite(Test_Data_Manager,'test_lon')
    4849     #suite = unittest.makeSuite(Test_Data_Manager,'test_urs2sww')
     4895    #suite = unittest.makeSuite(Test_Data_Manager,'test_ferret2sww_lat_long')
    48504896    suite = unittest.makeSuite(Test_Data_Manager,'test')
    48514897    runner = unittest.TextTestRunner()
Note: See TracChangeset for help on using the changeset viewer.