Ignore:
Timestamp:
Jun 5, 2010, 10:58:55 AM (14 years ago)
Author:
hudson
Message:

Almost all failing tests fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/anuga_core/source/anuga/file_conversion/test_file_conversion.py

    r7776 r7780  
    99from anuga.file.sww import SWW_file
    1010from anuga.file.sww import extent_sww
     11from anuga.file_conversion.urs2nc import lon_lat2grid
    1112from anuga.config import netcdf_float, epsilon, g
    1213from Scientific.IO.NetCDF import NetCDFFile
     
    23462347        return base_name, files
    23472348
     2349
     2350
     2351    def test_lon_lat2grid(self):
     2352        lonlatdep = [
     2353            [ 113.06700134  ,  -26.06669998 ,   1.        ] ,
     2354            [ 113.06700134  ,  -26.33329964 ,   3.        ] ,
     2355            [ 113.19999695  ,  -26.06669998 ,   2.        ] ,
     2356            [ 113.19999695  ,  -26.33329964 ,   4.        ] ]
     2357           
     2358        long, lat, quantity = lon_lat2grid(lonlatdep)
     2359
     2360        for i, result in enumerate(lat):
     2361            assert lonlatdep [i][1] == result
     2362        assert len(lat) == 2
     2363
     2364        for i, result in enumerate(long):
     2365            assert lonlatdep [i*2][0] == result
     2366        assert len(long) == 2
     2367
     2368        for i,q in enumerate(quantity):
     2369            assert q == i+1
     2370           
     2371    def test_lon_lat2grid_bad(self):
     2372        lonlatdep  = [
     2373            [ -26.06669998,  113.06700134,    1.        ],
     2374            [ -26.06669998 , 113.19999695 ,   2.        ],
     2375            [ -26.06669998 , 113.33300018,    3.        ],
     2376            [ -26.06669998 , 113.43299866   , 4.        ],
     2377            [ -26.20000076 , 113.06700134,    5.        ],
     2378            [ -26.20000076 , 113.19999695 ,   6.        ],
     2379            [ -26.20000076 , 113.33300018  ,  7.        ],
     2380            [ -26.20000076 , 113.43299866   , 8.        ],
     2381            [ -26.33329964 , 113.06700134,    9.        ],
     2382            [ -26.33329964 , 113.19999695 ,   10.        ],
     2383            [ -26.33329964 , 113.33300018  ,  11.        ],
     2384            [ -26.33329964 , 113.43299866 ,   12.        ],
     2385            [ -26.43330002 , 113.06700134 ,   13        ],
     2386            [ -26.43330002 , 113.19999695 ,   14.        ],
     2387            [ -26.43330002 , 113.33300018,    15.        ],
     2388            [ -26.43330002 , 113.43299866,    16.        ]]
     2389        try:
     2390            long, lat, quantity = lon_lat2grid(lonlatdep)
     2391        except AssertionError:
     2392            pass
     2393        else:
     2394            msg = 'Should have raised exception'
     2395            raise msg
     2396       
     2397    def test_lon_lat2gridII(self):
     2398        lonlatdep = [
     2399            [ 113.06700134  ,  -26.06669998 ,   1.        ] ,
     2400            [ 113.06700134  ,  -26.33329964 ,   2.        ] ,
     2401            [ 113.19999695  ,  -26.06669998 ,   3.        ] ,
     2402            [ 113.19999695  ,  -26.344329964 ,   4.        ] ]
     2403        try:
     2404            long, lat, quantity = lon_lat2grid(lonlatdep)
     2405        except AssertionError:
     2406            pass
     2407        else:
     2408            msg = 'Should have raised exception'
     2409            raise msg
     2410       
     2411
    23482412#-------------------------------------------------------------
    23492413
Note: See TracChangeset for help on using the changeset viewer.