Changeset 6157


Ignore:
Timestamp:
Jan 13, 2009, 5:42:30 PM (15 years ago)
Author:
rwilson
Message:

Change Numeric imports to general form - ready to change to NumPy?.

Location:
anuga_core/source/anuga/shallow_water
Files:
14 edited

Legend:

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

    r6086 r6157  
    2525
    2626from Scientific.IO.NetCDF import NetCDFFile
    27 from Numeric import array, Float
     27import Numeric as num
    2828
    2929from anuga.fit_interpolate.interpolate import Interpolate
     
    101101    sww_fileName = tempfile.mktemp(".sww" )
    102102    # sww_fileName = "aa.sww"
    103     elevation = array(range(len(mesh_dict["vertices"])))
     103    elevation = num.array(range(len(mesh_dict["vertices"])))
    104104    stage = elevation
    105105    ymomentum = elevation
     
    111111    sww.store_header(fid, 0,
    112112               len(mesh_dict['triangles']),
    113                len(mesh_dict["vertices"]),sww_precision=Float)
     113               len(mesh_dict["vertices"]),sww_precision=num.Float)
    114114    sww.store_triangulation(fid,
    115115                      mesh_dict["vertices"], mesh_dict['triangles'],
  • anuga_core/source/anuga/shallow_water/data_manager.py

    r6132 r6157  
    6161from os import sep, path, remove, mkdir, access, F_OK, W_OK, getcwd
    6262
    63 from Numeric import concatenate, array, Float, Int, Int32, resize, \
    64      sometrue, searchsorted, zeros, allclose, around, reshape, \
    65      transpose, sort, NewAxis, ArrayType, compress, take, arange, \
    66      argmax, alltrue, shape, Float32, size
     63import Numeric as num
    6764
    6865from Scientific.IO.NetCDF import NetCDFFile
     
    345342    def __init__(self, domain, mode=netcdf_mode_w, max_size=2000000000, recursion=False):
    346343        from Scientific.IO.NetCDF import NetCDFFile
    347         from Numeric import Int, Float, Float32
    348 
    349         self.precision = Float32 #Use single precision for quantities
     344
     345        self.precision = num.Float32 #Use single precision for quantities
    350346        self.recursion = recursion
    351347        self.mode = mode
     
    425421
    426422        from Scientific.IO.NetCDF import NetCDFFile
    427         from Numeric import concatenate, Int
    428423
    429424        domain = self.domain
     
    443438
    444439        # store the connectivity data
    445         points = concatenate( (X[:,NewAxis],Y[:,NewAxis]), axis=1 )
     440        points = num.concatenate( (X[:,num.NewAxis],Y[:,num.NewAxis]), axis=1 )
    446441        self.writer.store_triangulation(fid,
    447442                                        points,
    448443#                                        V.astype(volumes.typecode()),
    449                                         V.astype(Float32),
     444                                        V.astype(num.Float32),
    450445                                        Z,
    451446                                        points_georeference=\
     
    466461        from time import sleep
    467462        from os import stat
    468         from Numeric import choose
    469463
    470464        if names is None:
     
    563557
    564558                storable_indices = (A-z[:] >= self.minimum_storable_height)
    565                 stage = choose(storable_indices, (z[:], A))
     559                stage = num.choose(storable_indices, (z[:], A))
    566560
    567561                # Define a zero vector of same size and type as A
    568562                # for use with momenta
    569                 null = zeros(size(A), A.typecode())
     563                null = num.zeros(num.size(A), A.typecode())
    570564
    571565                # Get xmomentum where depth exceeds minimum_storable_height
     
    573567                xmom, _ = Q.get_vertex_values(xy=False,
    574568                                              precision=self.precision)
    575                 xmomentum = choose(storable_indices, (null, xmom))
     569                xmomentum = num.choose(storable_indices, (null, xmom))
    576570
    577571
     
    580574                ymom, _ = Q.get_vertex_values(xy=False,
    581575                                              precision=self.precision)
    582                 ymomentum = choose(storable_indices, (null, ymom))
     576                ymomentum = num.choose(storable_indices, (null, ymom))
    583577
    584578                # Write quantities to underlying data  file
     
    627621    def __init__(self, domain, mode=netcdf_mode_w):
    628622        from Scientific.IO.NetCDF import NetCDFFile
    629         from Numeric import Int, Float, Float
    630 
    631         self.precision = Float #Use full precision
     623
     624        self.precision = num.Float #Use full precision
    632625
    633626        Data_format.__init__(self, domain, 'sww', mode)
     
    657650
    658651
    659             fid.createVariable('volumes', Int, ('number_of_volumes',
    660                                                 'number_of_vertices'))
     652            fid.createVariable('volumes', num.Int, ('number_of_volumes',
     653                                                    'number_of_vertices'))
    661654
    662655            fid.createVariable('time', self.precision, ('number_of_timesteps',))
     
    680673
    681674        from Scientific.IO.NetCDF import NetCDFFile
    682         from Numeric import concatenate
    683675
    684676        domain = self.domain
     
    11511143    Y = {}
    11521144    for key in X.keys():
    1153         Y[key] = array([float(x) for x in X[key]])
     1145        Y[key] = num.array([float(x) for x in X[key]])
    11541146
    11551147    return Y
     
    12691261
    12701262    from Scientific.IO.NetCDF import NetCDFFile
    1271     from Numeric import Float, zeros
    12721263
    12731264    # Get NetCDF
     
    12841275
    12851276    M = size  #Number of lines
    1286     xx = zeros((M,3), Float)
    1287     yy = zeros((M,3), Float)
    1288     zz = zeros((M,3), Float)
     1277    xx = num.zeros((M,3), num.Float)
     1278    yy = num.zeros((M,3), num.Float)
     1279    zz = num.zeros((M,3), num.Float)
    12891280
    12901281    for i in range(M):
     
    13241315    import glob, os
    13251316    from anuga.config import data_dir
    1326     from Numeric import zeros, Float
    13271317
    13281318    # Get bathymetry and x,y's
     
    13301320
    13311321    M = len(lines)  #Number of lines
    1332     x = zeros((M,3), Float)
    1333     y = zeros((M,3), Float)
    1334     z = zeros((M,3), Float)
     1322    x = num.zeros((M,3), num.Float)
     1323    y = num.zeros((M,3), num.Float)
     1324    z = num.zeros((M,3), num.Float)
    13351325
    13361326    for i, line in enumerate(lines):
     
    15241514    import os
    15251515    from Scientific.IO.NetCDF import NetCDFFile
    1526     from Numeric import Float, zeros, reshape, sum
    15271516
    15281517    root = basename_in
     
    15911580    outfile.nrows = nrows
    15921581
    1593     dem_elevation_r = reshape(dem_elevation, (nrows, ncols))
     1582    dem_elevation_r = num.reshape(dem_elevation, (nrows, ncols))
    15941583    totalnopoints = nrows*ncols
    15951584
     
    16401629
    16411630    # Variable definitions
    1642     outfile.createVariable('points', Float, ('number_of_points',
    1643                                              'number_of_dimensions'))
    1644     outfile.createVariable('elevation', Float, ('number_of_points',))
     1631    outfile.createVariable('points', num.Float, ('number_of_points',
     1632                                                 'number_of_dimensions'))
     1633    outfile.createVariable('elevation', num.Float, ('number_of_points',))
    16451634
    16461635    # Get handles to the variables
     
    16601649
    16611650        v = dem_elevation_r[i,index1:index2+1]
    1662         no_NODATA = sum(v == NODATA_value)
     1651        no_NODATA = num.sum(v == NODATA_value)
    16631652        if no_NODATA > 0:
    16641653            newcols = lenv - no_NODATA  # ncols_in_bounding_box - no_NODATA
     
    16661655            newcols = lenv              # ncols_in_bounding_box
    16671656
    1668         telev = zeros(newcols, Float)
    1669         tpoints = zeros((newcols, 2), Float)
     1657        telev = num.zeros(newcols, num.Float)
     1658        tpoints = num.zeros((newcols, 2), num.Float)
    16701659
    16711660        local_index = 0
     
    17891778    import os
    17901779    from Scientific.IO.NetCDF import NetCDFFile
    1791     from Numeric import Float, zeros, reshape
    17921780
    17931781    root = basename_in
     
    21332121
    21342122    import sys
    2135     from Numeric import array, Float, concatenate, NewAxis, zeros, reshape
    2136     from Numeric import array2string, sometrue
    21372123
    21382124    from anuga.utilities.polygon import inside_polygon, outside_polygon, \
     
    22542240        #q has a time component, must be reduced alongthe temporal dimension
    22552241        if verbose: print 'Reducing quantity %s' %quantity
    2256         q_reduced = zeros(number_of_points, Float)
     2242        q_reduced = num.zeros(number_of_points, num.Float)
    22572243
    22582244        if timestep is not None:
     
    23142300    y = y + yllcorner - newyllcorner
    23152301
    2316     vertex_points = concatenate ((x[:,NewAxis], y[:,NewAxis]), axis=1)
     2302    vertex_points = num.concatenate ((x[:,num.NewAxis], y[:,num.NewAxis]), axis=1)
    23172303    assert len(vertex_points.shape) == 2
    23182304
    2319     grid_points = zeros ((ncols*nrows, 2), Float)
     2305    grid_points = num.zeros ((ncols*nrows, 2), num.Float)
    23202306
    23212307    for i in xrange(nrows):
     
    23592345    if format.lower() == 'ers':
    23602346        # setup ERS header information
    2361         grid_values = reshape(grid_values, (nrows, ncols))
     2347        grid_values = num.reshape(grid_values, (nrows, ncols))
    23622348        header = {}
    23632349        header['datum'] = '"' + datum + '"'
     
    24262412            slice = grid_values[base_index:base_index+ncols]
    24272413            #s = array2string(slice, max_line_width=sys.maxint)
    2428             s = array2string(slice, max_line_width=sys.maxint,
    2429                              precision=number_of_decimal_places)
     2414            s = num.array2string(slice, max_line_width=sys.maxint,
     2415                                 precision=number_of_decimal_places)
    24302416            ascid.write(s[1:-1] + '\n')
    24312417
     
    25432529
    25442530    import sys
    2545     from Numeric import array, Float, concatenate, NewAxis, zeros, reshape
    2546     from Numeric import array2string, sometrue
    25472531    from anuga.utilities.polygon import inside_polygon, outside_polygon, \
    25482532             separate_points_by_polygon
     
    26312615        if verbose: print 'Reducing quantity %s' % quantity
    26322616
    2633         q_reduced = zeros(number_of_points, Float)
     2617        q_reduced = num.zeros(number_of_points, num.Float)
    26342618        for k in range(number_of_points):
    26352619            q_reduced[k] = reduction(q[:,k])
     
    26452629
    26462630    # Create grid and update xll/yll corner and x,y
    2647     vertex_points = concatenate((x[:, NewAxis], y[:, NewAxis]), axis=1)
     2631    vertex_points = num.concatenate((x[:, num.NewAxis], y[:, num.NewAxis]), axis=1)
    26482632    assert len(vertex_points.shape) == 2
    26492633
     
    27482732    import os
    27492733    from Scientific.IO.NetCDF import NetCDFFile
    2750     from Numeric import Float, array
    27512734
    27522735    root = basename_in
     
    28662849
    28672850    # variable definitions
    2868     fid.createVariable('elevation', Float, ('number_of_rows',
    2869                                             'number_of_columns'))
     2851    fid.createVariable('elevation', num.Float, ('number_of_rows',
     2852                                                'number_of_columns'))
    28702853
    28712854    # Get handles to the variables
     
    28782861        if verbose and i % ((n+10)/10) == 0:
    28792862            print 'Processing row %d of %d' % (i, nrows)
    2880         elevation[i, :] = array([float(x) for x in fields])
     2863        elevation[i, :] = num.array([float(x) for x in fields])
    28812864
    28822865    fid.close()
     
    29462929    import os
    29472930    from Scientific.IO.NetCDF import NetCDFFile
    2948     from Numeric import Float, Int, Int32, searchsorted, zeros, array
    2949     from Numeric import allclose, around
    2950 
    2951     precision = Float
     2931
     2932    precision = num.Float
    29522933
    29532934    msg = 'Must use latitudes and longitudes for minlat, maxlon etc'
     
    30223003
    30233004    # Precision used by most for lat/lon is 4 or 5 decimals
    3024     e_lat = around(file_e.variables[dim_e_latitude][:], 5)
    3025     e_lon = around(file_e.variables[dim_e_longitude][:], 5)
     3005    e_lat = num.around(file_e.variables[dim_e_latitude][:], 5)
     3006    e_lon = num.around(file_e.variables[dim_e_longitude][:], 5)
    30263007
    30273008    # Check that files are compatible
    3028     assert allclose(latitudes, file_u.variables[dim_u_latitude])
    3029     assert allclose(latitudes, file_v.variables[dim_v_latitude])
    3030     assert allclose(latitudes, e_lat)
    3031 
    3032     assert allclose(longitudes, file_u.variables[dim_u_longitude])
    3033     assert allclose(longitudes, file_v.variables[dim_v_longitude])
    3034     assert allclose(longitudes, e_lon)
     3009    assert num.allclose(latitudes, file_u.variables[dim_u_latitude])
     3010    assert num.allclose(latitudes, file_v.variables[dim_v_latitude])
     3011    assert num.allclose(latitudes, e_lat)
     3012
     3013    assert num.allclose(longitudes, file_u.variables[dim_u_longitude])
     3014    assert num.allclose(longitudes, file_v.variables[dim_v_longitude])
     3015    assert num.allclose(longitudes, e_lon)
    30353016
    30363017    if mint is None:
     
    30383019        mint = times[0]
    30393020    else:
    3040         jmin = searchsorted(times, mint)
     3021        jmin = num.searchsorted(times, mint)
    30413022
    30423023    if maxt is None:
     
    30443025        maxt = times[-1]
    30453026    else:
    3046         jmax = searchsorted(times, maxt)
     3027        jmax = num.searchsorted(times, maxt)
    30473028
    30483029    kmin, kmax, lmin, lmax = _get_min_max_indexes(latitudes[:],
     
    30893070
    30903071    #Cleanup
    3091     from Numeric import sometrue
    3092 
    30933072    missing = (amplitudes == nan_ha)
    3094     if sometrue (missing):
     3073    if num.sometrue (missing):
    30953074        if fail_on_NaN:
    30963075            msg = 'NetCDFFile %s contains missing values' \
     
    31013080
    31023081    missing = (uspeed == nan_ua)
    3103     if sometrue (missing):
     3082    if num.sometrue (missing):
    31043083        if fail_on_NaN:
    31053084            msg = 'NetCDFFile %s contains missing values' \
     
    31103089
    31113090    missing = (vspeed == nan_va)
    3112     if sometrue (missing):
     3091    if num.sometrue (missing):
    31133092        if fail_on_NaN:
    31143093            msg = 'NetCDFFile %s contains missing values' \
     
    31193098
    31203099    missing = (elevations == nan_e)
    3121     if sometrue (missing):
     3100    if num.sometrue (missing):
    31223101        if fail_on_NaN:
    31233102            msg = 'NetCDFFile %s contains missing values' \
     
    31873166    sww.store_header(outfile, times, number_of_volumes,
    31883167                     number_of_points, description=description,
    3189                      verbose=verbose, sww_precision=Float)
     3168                     verbose=verbose, sww_precision=num.Float)
    31903169
    31913170    # Store
    31923171    from anuga.coordinate_transforms.redfearn import redfearn
    3193     x = zeros(number_of_points, Float)  #Easting
    3194     y = zeros(number_of_points, Float)  #Northing
     3172    x = num.zeros(number_of_points, num.Float)  #Easting
     3173    y = num.zeros(number_of_points, num.Float)  #Northing
    31953174
    31963175    if verbose: print 'Making triangular grid'
     
    32263205            volumes.append([v4,v3,v2]) #Lower element
    32273206
    3228     volumes = array(volumes)
     3207    volumes = num.array(volumes)
    32293208
    32303209    if origin is None:
     
    32423221
    32433222    #FIXME use the Write_sww instance(sww) to write this info
    3244     from Numeric import resize
    3245     z = resize(z, outfile.variables['z'][:].shape)
     3223    z = num.resize(z, outfile.variables['z'][:].shape)
    32463224    outfile.variables['x'][:] = x - geo_ref.get_xllcorner()
    32473225    outfile.variables['y'][:] = y - geo_ref.get_yllcorner()
    32483226    outfile.variables['z'][:] = z             #FIXME HACK for bacwards compat.
    32493227    outfile.variables['elevation'][:] = z
    3250     outfile.variables['volumes'][:] = volumes.astype(Int32) #For Opteron 64
     3228    outfile.variables['volumes'][:] = volumes.astype(num.Int32) #For Opteron 64
    32513229
    32523230    #Time stepping
     
    33313309
    33323310    import time, calendar
    3333     from Numeric import array
    33343311    from anuga.config import time_format
    33353312    from anuga.utilities.numerical_tools import ensure_numeric
     
    33713348
    33723349    # Read times proper
    3373     from Numeric import zeros, Float, alltrue
    33743350    from anuga.config import time_format
    33753351    import time, calendar
     
    33823358    d = len(q)
    33833359
    3384     T = zeros(N, Float)       # Time
    3385     Q = zeros((N, d), Float)  # Values
     3360    T = num.zeros(N, num.Float)       # Time
     3361    Q = num.zeros((N, d), num.Float)  # Values
    33863362
    33873363    for i, line in enumerate(lines):
     
    33983374    msg = 'File %s must list time as a monotonuosly ' % filename
    33993375    msg += 'increasing sequence'
    3400     assert alltrue(T[1:] - T[:-1] > 0), msg
     3376    assert num.alltrue(T[1:] - T[:-1] > 0), msg
    34013377
    34023378    #Create NetCDF file
     
    34193395    fid.createDimension('number_of_timesteps', len(T))
    34203396
    3421     fid.createVariable('time', Float, ('number_of_timesteps',))
     3397    fid.createVariable('time', num.Float, ('number_of_timesteps',))
    34223398
    34233399    fid.variables['time'][:] = T
     
    34293405            name = 'Attribute%d' % i
    34303406
    3431         fid.createVariable(name, Float, ('number_of_timesteps',))
     3407        fid.createVariable(name, num.Float, ('number_of_timesteps',))
    34323408        fid.variables[name][:] = Q[:,i]
    34333409
     
    34883464    from Scientific.IO.NetCDF import NetCDFFile
    34893465    from shallow_water import Domain
    3490     from Numeric import asarray, transpose, resize
    34913466
    34923467    # initialise NaN.
     
    35113486    starttime = fid.starttime[0]
    35123487    volumes = fid.variables['volumes'][:]       # Connectivity
    3513     coordinates = transpose(asarray([x.tolist(), y.tolist()]))
     3488    coordinates = num.transpose(num.asarray([x.tolist(), y.tolist()]))
    35143489    # FIXME (Ole): Something like this might be better:
    35153490    #                 concatenate((x, y), axis=1)
    3516     # or              concatenate((x[:,NewAxis], x[:,NewAxis]), axis=1)
     3491    # or              concatenate((x[:,num.NewAxis], x[:,num.NewAxis]), axis=1)
    35173492
    35183493    conserved_quantities = []
     
    36083583                X = (X*data) + (data==0)*NaN_filler
    36093584        if unique:
    3610             X = resize(X, (len(X)/3, 3))
     3585            X = num.resize(X, (len(X)/3, 3))
    36113586        domain.set_quantity(quantity, X)
    36123587    #
     
    36333608                X = (X*data) + (data==0)*NaN_filler
    36343609        if unique:
    3635             X = resize(X, (X.shape[0]/3, 3))
     3610            X = num.resize(X, (X.shape[0]/3, 3))
    36363611        domain.set_quantity(quantity, X)
    36373612
     
    37023677# @param boundary
    37033678def weed(coordinates, volumes, boundary=None):
    3704     if type(coordinates) == ArrayType:
     3679    if type(coordinates) == num.ArrayType:
    37053680        coordinates = coordinates.tolist()
    3706     if type(volumes) == ArrayType:
     3681    if type(volumes) == num.ArrayType:
    37073682        volumes = volumes.tolist()
    37083683
     
    37813756    import os
    37823757    from Scientific.IO.NetCDF import NetCDFFile
    3783     from Numeric import Float, zeros, sum, reshape, equal
    37843758
    37853759    root = basename_in
     
    38513825
    38523826    # variable definition
    3853     outfile.createVariable('elevation', Float, ('number_of_points',))
     3827    outfile.createVariable('elevation', num.Float, ('number_of_points',))
    38543828
    38553829    # Get handle to the variable
    38563830    elevation = outfile.variables['elevation']
    38573831
    3858     dem_elevation_r = reshape(dem_elevation, (nrows, ncols))
     3832    dem_elevation_r = num.reshape(dem_elevation, (nrows, ncols))
    38593833
    38603834    #Store data
     
    38643838
    38653839        lower_index = global_index
    3866         telev = zeros(ncols_new, Float)
     3840        telev = num.zeros(ncols_new, num.Float)
    38673841        local_index = 0
    38683842        trow = i * cellsize_ratio
     
    38763850            #decimated dem to NODATA_value, else compute decimated
    38773851            #value using stencil
    3878             if sum(sum(equal(tmp, NODATA_value))) > 0:
     3852            if num.sum(num.sum(num.equal(tmp, NODATA_value))) > 0:
    38793853                telev[local_index] = NODATA_value
    38803854            else:
    3881                 telev[local_index] = sum(sum(tmp * stencil))
     3855                telev[local_index] = num.sum(num.sum(tmp * stencil))
    38823856
    38833857            global_index += 1
     
    39923966    from anuga.coordinate_transforms.redfearn import redfearn
    39933967
    3994     precision = Float # So if we want to change the precision its done here
     3968    precision = num.Float # So if we want to change the precision its done here
    39953969
    39963970    # go in to the bath dir and load the only file,
     
    40934067    #################################
    40944068
    4095     outfile.createVariable('volumes', Int, ('number_of_volumes',
    4096                                             'number_of_vertices'))
     4069    outfile.createVariable('volumes', num.Int, ('number_of_volumes',
     4070                                                'number_of_vertices'))
    40974071
    40984072    outfile.createVariable('time', precision, ('number_of_timesteps',))
     
    41104084    from anuga.coordinate_transforms.redfearn import redfearn
    41114085
    4112     x = zeros(number_of_points, Float)  #Easting
    4113     y = zeros(number_of_points, Float)  #Northing
     4086    x = num.zeros(number_of_points, num.Float)  #Easting
     4087    y = num.zeros(number_of_points, num.Float)  #Northing
    41144088
    41154089    if verbose: print 'Making triangular grid'
     
    41474121            volumes.append([v4,v2,v3]) #Lower element
    41484122
    4149     volumes = array(volumes)
     4123    volumes = num.array(volumes)
    41504124
    41514125    geo_ref = Geo_reference(refzone, min(x), min(y))
     
    41654139        print 'geo_ref: ', geo_ref
    41664140
    4167     z = resize(bath_grid,outfile.variables['z'][:].shape)
     4141    z = num.resize(bath_grid,outfile.variables['z'][:].shape)
    41684142    outfile.variables['x'][:] = x - geo_ref.get_xllcorner()
    41694143    outfile.variables['y'][:] = y - geo_ref.get_yllcorner()
     
    41724146    outfile.variables['z'][:] = z
    41734147    outfile.variables['elevation'][:] = z
    4174     outfile.variables['volumes'][:] = volumes.astype(Int32) # On Opteron 64
     4148    outfile.variables['volumes'][:] = volumes.astype(num.Int32) # On Opteron 64
    41754149
    41764150    stage = outfile.variables['stage']
     
    41984172        # handle missing values
    41994173        missing = (elevation_grid == elevation_meta['NODATA_value'])
    4200         if sometrue (missing):
     4174        if num.sometrue (missing):
    42014175            if fail_on_NaN:
    42024176                msg = 'File %s contains missing values' \
     
    42544228    longitudes = ensure_numeric(longitudes)
    42554229
    4256     assert allclose(sort(longitudes), longitudes)
     4230    assert num.allclose(num.sort(longitudes), longitudes)
    42574231
    42584232    #print latitudes[0],longitudes[0]
     
    42614235
    42624236    lat_ascending = True
    4263     if not allclose(sort(latitudes), latitudes):
     4237    if not num.allclose(num.sort(latitudes), latitudes):
    42644238        lat_ascending = False
    42654239        # reverse order of lat, so it's in ascending order
    42664240        latitudes = latitudes[::-1]
    4267         assert allclose(sort(latitudes), latitudes)
     4241        assert num.allclose(num.sort(latitudes), latitudes)
    42684242
    42694243    largest_lat_index = len(latitudes)-1
     
    42734247        lat_min_index = 0
    42744248    else:
    4275         lat_min_index = searchsorted(latitudes, minlat)-1
     4249        lat_min_index = num.searchsorted(latitudes, minlat)-1
    42764250        if lat_min_index <0:
    42774251            lat_min_index = 0
     
    42804254        lat_max_index = largest_lat_index #len(latitudes)
    42814255    else:
    4282         lat_max_index = searchsorted(latitudes, maxlat)
     4256        lat_max_index = num.searchsorted(latitudes, maxlat)
    42834257        if lat_max_index > largest_lat_index:
    42844258            lat_max_index = largest_lat_index
     
    42874261        lon_min_index = 0
    42884262    else:
    4289         lon_min_index = searchsorted(longitudes, minlon)-1
     4263        lon_min_index = num.searchsorted(longitudes, minlon)-1
    42904264        if lon_min_index <0:
    42914265            lon_min_index = 0
     
    42944268        lon_max_index = len(longitudes)
    42954269    else:
    4296         lon_max_index = searchsorted(longitudes, maxlon)
     4270        lon_max_index = num.searchsorted(longitudes, maxlon)
    42974271
    42984272    # Reversing the indexes, if the lat array is decending
     
    43494323        cells = line.split()
    43504324        assert len(cells) == ncols
    4351         grid.append(array([float(x) for x in cells]))
    4352     grid = array(grid)
     4325        grid.append(num.array([float(x) for x in cells]))
     4326    grid = num.array(grid)
    43534327
    43544328    return {'xllcorner':xllcorner,
     
    43644338lat_name = 'LAT'
    43654339time_name = 'TIME'
    4366 precision = Float # So if we want to change the precision its done here
     4340precision = num.Float # So if we want to change the precision its done here
    43674341
    43684342##
     
    46454619    lonlatdep = p_array.array('f')
    46464620    lonlatdep.read(mux_file, columns * points_num)
    4647     lonlatdep = array(lonlatdep, typecode=Float)
    4648     lonlatdep = reshape(lonlatdep, (points_num, columns))
     4621    lonlatdep = num.array(lonlatdep, typecode=num.Float)
     4622    lonlatdep = num.reshape(lonlatdep, (points_num, columns))
    46494623
    46504624    lon, lat, depth = lon_lat2grid(lonlatdep)
     
    46744648        hz_p_array = p_array.array('f')
    46754649        hz_p_array.read(mux_file, points_num)
    4676         hz_p = array(hz_p_array, typecode=Float)
    4677         hz_p = reshape(hz_p, (len(lon), len(lat)))
    4678         hz_p = transpose(hz_p)  # mux has lat varying fastest, nc has long v.f.
     4650        hz_p = num.array(hz_p_array, typecode=num.Float)
     4651        hz_p = num.reshape(hz_p, (len(lon), len(lat)))
     4652        hz_p = num.transpose(hz_p)  # mux has lat varying fastest, nc has long v.f.
    46794653
    46804654        #write time slice to nc file
     
    47114685    outfile.variables[lat_name][:] = ensure_numeric(lat)
    47124686
    4713     depth = reshape(depth_vector, (len(lat), len(lon)))
     4687    depth = num.reshape(depth_vector, (len(lat), len(lon)))
    47144688    outfile.variables[zname][:] = depth
    47154689
     
    47724746    QUANTITY = 2
    47734747
    4774     long_lat_dep = ensure_numeric(long_lat_dep, Float)
     4748    long_lat_dep = ensure_numeric(long_lat_dep, num.Float)
    47754749
    47764750    num_points = long_lat_dep.shape[0]
     
    47994773        last = first + lenlat
    48004774
    4801         assert allclose(long_lat_dep[first:last,LAT], lat), msg
    4802         assert allclose(long_lat_dep[first:last,LONG], long[i]), msg
     4775        assert num.allclose(long_lat_dep[first:last,LAT], lat), msg
     4776        assert num.allclose(long_lat_dep[first:last,LONG], long[i]), msg
    48034777
    48044778    msg = 'Out of range latitudes/longitudes'
     
    48104784    # FIXME - make this faster/do this a better way
    48114785    # use numeric transpose, after reshaping the quantity vector
    4812     quantity = zeros(num_points, Float)
     4786    quantity = num.zeros(num_points, num.Float)
    48134787
    48144788    for lat_i, _ in enumerate(lat):
     
    52825256    sww = Write_sww()
    52835257    sww.store_header(outfile, times, len(volumes), len(points_utm),
    5284                      verbose=verbose, sww_precision=Float)
     5258                     verbose=verbose, sww_precision=num.Float)
    52855259    outfile.mean_stage = mean_stage
    52865260    outfile.zscale = zscale
     
    53065280                                 xmomentum=xmomentum,
    53075281                                 ymomentum=ymomentum,
    5308                                  sww_precision=Float)
     5282                                 sww_precision=num.Float)
    53095283        j += 1
    53105284
     
    53495323    """
    53505324
    5351     from Numeric import ones,Float,compress,zeros,arange
    53525325    from urs_ext import read_mux2
    53535326
    53545327    numSrc = len(filenames)
    53555328
    5356     file_params = -1 * ones(3, Float)                    # [nsta,dt,nt]
     5329    file_params = -1 * num.ones(3, num.Float)                    # [nsta,dt,nt]
    53575330
    53585331    # Convert verbose to int C flag
     
    53635336
    53645337    if weights is None:
    5365         weights = ones(numSrc)
     5338        weights = num.ones(numSrc)
    53665339
    53675340    if permutation is None:
    5368         permutation = ensure_numeric([], Float)
     5341        permutation = ensure_numeric([], num.Float)
    53695342
    53705343    # Call underlying C implementation urs2sts_ext.c
     
    53735346
    53745347    msg = 'File parameter values were not read in correctly from c file'
    5375     assert len(compress(file_params > 0, file_params)) != 0, msg
     5348    assert len(num.compress(file_params > 0, file_params)) != 0, msg
    53765349
    53775350    msg = 'The number of stations specifed in the c array and in the file ' \
     
    54135386    parameters_index = data.shape[1] - OFFSET
    54145387
    5415     times = dt * arange(parameters_index)
    5416     latitudes = zeros(number_of_selected_stations, Float)
    5417     longitudes = zeros(number_of_selected_stations, Float)
    5418     elevation = zeros(number_of_selected_stations, Float)
    5419     quantity = zeros((number_of_selected_stations, parameters_index), Float)
     5388    times = dt * num.arange(parameters_index)
     5389    latitudes = num.zeros(number_of_selected_stations, num.Float)
     5390    longitudes = num.zeros(number_of_selected_stations, num.Float)
     5391    elevation = num.zeros(number_of_selected_stations, num.Float)
     5392    quantity = num.zeros((number_of_selected_stations, parameters_index), num.Float)
    54205393
    54215394    starttime = 1e16
     
    54445417        mux_times_start_i = 0
    54455418    else:
    5446         mux_times_start_i = searchsorted(mux_times, mint)
     5419        mux_times_start_i = num.searchsorted(mux_times, mint)
    54475420
    54485421    if maxt == None:
     
    54515424        maxt += 0.5 # so if you specify a time where there is
    54525425                    # data that time will be included
    5453         mux_times_fin_i = searchsorted(mux_times, maxt)
     5426        mux_times_fin_i = num.searchsorted(mux_times, maxt)
    54545427
    54555428    return mux_times_start_i, mux_times_fin_i
     
    55185491    import os
    55195492    from Scientific.IO.NetCDF import NetCDFFile
    5520     from Numeric import Float, Int, Int32, searchsorted, zeros, array
    5521     from Numeric import allclose, around,ones,Float
    55225493    from types import ListType,StringType
    55235494    from operator import __and__
     
    55435514    if weights is None:
    55445515        # Default is equal weighting
    5545         weights = ones(numSrc, Float) / numSrc
     5516        weights = num.ones(numSrc, num.Float) / numSrc
    55465517    else:
    55475518        weights = ensure_numeric(weights)
     
    56225593            msg = '%s, %s and %s have inconsistent gauge data' \
    56235594                  % (files_in[0], files_in[1], files_in[2])
    5624             assert allclose(times, times_old), msg
    5625             assert allclose(latitudes, latitudes_old), msg
    5626             assert allclose(longitudes, longitudes_old), msg
    5627             assert allclose(elevation, elevation_old), msg
    5628             assert allclose(starttime, starttime_old), msg
     5595            assert num.allclose(times, times_old), msg
     5596            assert num.allclose(latitudes, latitudes_old), msg
     5597            assert num.allclose(longitudes, longitudes_old), msg
     5598            assert num.allclose(elevation, elevation_old), msg
     5599            assert num.allclose(starttime, starttime_old), msg
    56295600        times_old = times
    56305601        latitudes_old = latitudes
     
    56655636    # 0 to number_of_points-1
    56665637    if permutation is None:
    5667         permutation = arange(number_of_points, typecode=Int)
     5638        permutation = num.arange(number_of_points, typecode=num.Int)
    56685639
    56695640    # NetCDF file definition
     
    56795650                     description=description,
    56805651                     verbose=verbose,
    5681                      sts_precision=Float)
     5652                     sts_precision=num.Float)
    56825653
    56835654    # Store
    56845655    from anuga.coordinate_transforms.redfearn import redfearn
    56855656
    5686     x = zeros(number_of_points, Float)  # Easting
    5687     y = zeros(number_of_points, Float)  # Northing
     5657    x = num.zeros(number_of_points, num.Float)  # Easting
     5658    y = num.zeros(number_of_points, num.Float)  # Northing
    56885659
    56895660    # Check zone boundaries
     
    57155686    geo_ref = write_NetCDF_georeference(origin, outfile)
    57165687
    5717     elevation = resize(elevation, outfile.variables['elevation'][:].shape)
    5718     outfile.variables['permutation'][:] = permutation.astype(Int32) # Opteron 64
     5688    elevation = num.resize(elevation, outfile.variables['elevation'][:].shape)
     5689    outfile.variables['permutation'][:] = permutation.astype(num.Int32) # Opteron 64
    57195690    outfile.variables['x'][:] = x - geo_ref.get_xllcorner()
    57205691    outfile.variables['y'][:] = y - geo_ref.get_yllcorner()
     
    57825753    y = fid.variables['y'][:] + yllcorner
    57835754
    5784     x = reshape(x, (len(x),1))
    5785     y = reshape(y, (len(y),1))
    5786     sts_points = concatenate((x,y), axis=1)
     5755    x = num.reshape(x, (len(x),1))
     5756    y = num.reshape(y, (len(y),1))
     5757    sts_points = num.concatenate((x,y), axis=1)
    57875758
    57885759    return sts_points.tolist()
     
    58325803                     smoothing=True,
    58335804                     order=1,
    5834                      sww_precision=Float32,
     5805                     sww_precision=num.Float32,
    58355806                     verbose=False):
    58365807        """Write an SWW file header.
     
    58655836        # This is being used to seperate one number from a list.
    58665837        # what it is actually doing is sorting lists from numeric arrays.
    5867         if type(times) is list or type(times) is ArrayType:
     5838        if type(times) is list or type(times) is num.ArrayType:
    58685839            number_of_times = len(times)
    58695840            times = ensure_numeric(times)
     
    59145885        outfile.createVariable('z', sww_precision, ('number_of_points',))
    59155886
    5916         outfile.createVariable('volumes', Int, ('number_of_volumes',
    5917                                                 'number_of_vertices'))
     5887        outfile.createVariable('volumes', num.Int, ('number_of_volumes',
     5888                                                    'number_of_vertices'))
    59185889
    59195890        # Doing sww_precision instead of Float gives cast errors.
    5920         outfile.createVariable('time', Float,
     5891        outfile.createVariable('time', num.Float,
    59215892                               ('number_of_timesteps',))
    59225893
     
    59325903            outfile.variables[q+Write_sww.RANGE][1] = -max_float # Max
    59335904
    5934         if type(times) is list or type(times) is ArrayType:
     5905        if type(times) is list or type(times) is num.ArrayType:
    59355906            outfile.variables['time'][:] = times    #Store time relative
    59365907
     
    59875958
    59885959        number_of_points = len(points_utm)
    5989         volumes = array(volumes)
    5990         points_utm = array(points_utm)
     5960        volumes = num.array(volumes)
     5961        points_utm = num.array(points_utm)
    59915962
    59925963        # given the two geo_refs and the points, do the stuff
     
    60356006        outfile.variables['z'][:] = elevation
    60366007        outfile.variables['elevation'][:] = elevation  #FIXME HACK
    6037         outfile.variables['volumes'][:] = volumes.astype(Int32) #On Opteron 64
     6008        outfile.variables['volumes'][:] = volumes.astype(num.Int32) #On Opteron 64
    60386009
    60396010        q = 'elevation'
     
    60516022    # @param verbose True if this function is to be verbose.
    60526023    # @param **quant
    6053     def store_quantities(self, outfile, sww_precision=Float32,
     6024    def store_quantities(self, outfile, sww_precision=num.Float32,
    60546025                         slice_index=None, time=None,
    60556026                         verbose=False, **quant):
     
    62446215                     number_of_points,
    62456216                     description='Converted from URS mux2 format',
    6246                      sts_precision=Float32,
     6217                     sts_precision=num.Float32,
    62476218                     verbose=False):
    62486219        """
     
    62676238        # This is being used to seperate one number from a list.
    62686239        # what it is actually doing is sorting lists from numeric arrays.
    6269         if type(times) is list or type(times) is ArrayType:
     6240        if type(times) is list or type(times) is num.ArrayType:
    62706241            number_of_times = len(times)
    62716242            times = ensure_numeric(times)
     
    62876258
    62886259        # Variable definitions
    6289         outfile.createVariable('permutation', Int, ('number_of_points',))
     6260        outfile.createVariable('permutation', num.Int, ('number_of_points',))
    62906261        outfile.createVariable('x', sts_precision, ('number_of_points',))
    62916262        outfile.createVariable('y', sts_precision, ('number_of_points',))
     
    63026273
    63036274        # Doing sts_precision instead of Float gives cast errors.
    6304         outfile.createVariable('time', Float, ('number_of_timesteps',))
     6275        outfile.createVariable('time', num.Float, ('number_of_timesteps',))
    63056276
    63066277        for q in Write_sts.sts_quantities:
     
    63146285            outfile.variables[q + Write_sts.RANGE][1] = -max_float # Max
    63156286
    6316         if type(times) is list or type(times) is ArrayType:
     6287        if type(times) is list or type(times) is num.ArrayType:
    63176288            outfile.variables['time'][:] = times    #Store time relative
    63186289
     
    63656336
    63666337        number_of_points = len(points_utm)
    6367         points_utm = array(points_utm)
     6338        points_utm = num.array(points_utm)
    63686339
    63696340        # given the two geo_refs and the points, do the stuff
     
    64236394    # @param verboseTrue if this function is to be verbose.
    64246395    # @param **quant Extra keyword args.
    6425     def store_quantities(self, outfile, sts_precision=Float32,
     6396    def store_quantities(self, outfile, sts_precision=num.Float32,
    64266397                         slice_index=None, time=None,
    64276398                         verbose=False, **quant):
     
    65146485        lonlatdep = p_array.array('f')
    65156486        lonlatdep.read(mux_file, columns * self.points_num)
    6516         lonlatdep = array(lonlatdep, typecode=Float)
    6517         lonlatdep = reshape(lonlatdep, (self.points_num, columns))
     6487        lonlatdep = num.array(lonlatdep, typecode=num.Float)
     6488        lonlatdep = num.reshape(lonlatdep, (self.points_num, columns))
    65186489        self.lonlatdep = lonlatdep
    65196490
     
    65506521        hz_p_array = p_array.array('f')
    65516522        hz_p_array.read(self.mux_file, self.points_num)
    6552         hz_p = array(hz_p_array, typecode=Float)
     6523        hz_p = num.array(hz_p_array, typecode=num.Float)
    65536524        self.iter_time_step += 1
    65546525
     
    66956666    # array to store data, number in there is to allow float...
    66966667    # i'm sure there is a better way!
    6697     data = array([], typecode=Float)
    6698     data = resize(data, ((len(lines)-1), len(header_fields)))
     6668    data = num.array([], typecode=num.Float)
     6669    data = num.resize(data, ((len(lines)-1), len(header_fields)))
    66996670
    67006671    array_number = 0
     
    68536824    from Scientific.IO.NetCDF import NetCDFFile
    68546825    from shallow_water import Domain
    6855     from Numeric import asarray, transpose, resize
    68566826    from anuga.abstract_2d_finite_volumes.neighbour_mesh import Mesh
    68576827
     
    68716841
    68726842    # Mesh (nodes (Mx2), triangles (Nx3))
    6873     nodes = concatenate((x[:,NewAxis], y[:,NewAxis]), axis=1)
     6843    nodes = num.concatenate((x[:,num.NewAxis], y[:,num.NewAxis]), axis=1)
    68746844    triangles = fid.variables['volumes'][:]
    68756845
     
    72947264
    72957265        # Get the relevant quantities (Convert from single precison)
    7296         elevation = array(fid.variables['elevation'][:], Float)
    7297         stage = array(fid.variables['stage'][:], Float)
     7266        elevation = num.array(fid.variables['elevation'][:], num.Float)
     7267        stage = num.array(fid.variables['stage'][:], num.Float)
    72987268
    72997269        # Here's where one could convert nodal information to centroid
     
    73127282            # and call it here
    73137283
    7314             points = concatenate((x[:,NewAxis], y[:,NewAxis]), axis=1)
     7284            points = num.concatenate((x[:,num.NewAxis], y[:,num.NewAxis]), axis=1)
    73157285
    73167286            point_indices = inside_polygon(points, polygon)
    73177287
    73187288            # Restrict quantities to polygon
    7319             elevation = take(elevation, point_indices)
    7320             stage = take(stage, point_indices, axis=1)
     7289            elevation = num.take(elevation, point_indices)
     7290            stage = num.take(stage, point_indices, axis=1)
    73217291
    73227292            # Get info for location of maximal runup
    7323             points_in_polygon = take(points, point_indices)
     7293            points_in_polygon = num.take(points, point_indices)
    73247294            x = points_in_polygon[:,0]
    73257295            y = points_in_polygon[:,1]
    73267296        else:
    73277297            # Take all points
    7328             point_indices = arange(len(x))
     7298            point_indices = num.arange(len(x))
    73297299
    73307300        # Temporal restriction
    73317301        time = fid.variables['time'][:]
    7332         all_timeindices = arange(len(time))
     7302        all_timeindices = num.arange(len(time))
    73337303        if time_interval is not None:
    73347304            msg = 'time_interval must be a sequence of length 2.'
     
    73437313
    73447314            # Take time indices corresponding to interval (& is bitwise AND)
    7345             timesteps = compress((time_interval[0] <= time) \
     7315            timesteps = num.compress((time_interval[0] <= time) \
    73467316                                     & (time <= time_interval[1]),
    7347                                  all_timeindices)
     7317                                     all_timeindices)
    73487318
    73497319            msg = 'time_interval %s did not include any model timesteps.' \
    73507320                  % time_interval
    7351             assert not alltrue(timesteps == 0), msg
     7321            assert not num.alltrue(timesteps == 0), msg
    73527322        else:
    73537323            # Take them all
     
    73727342            # Get wet nodes i.e. nodes with depth>0 within given region
    73737343            # and timesteps
    7374             wet_nodes = compress(depth > minimum_allowed_height,
    7375                                  arange(len(depth)))
    7376 
    7377             if alltrue(wet_nodes == 0):
     7344            wet_nodes = num.compress(depth > minimum_allowed_height,
     7345                                     num.arange(len(depth)))
     7346
     7347            if num.alltrue(wet_nodes == 0):
    73787348                runup = None
    73797349            else:
    73807350                # Find maximum elevation among wet nodes
    7381                 wet_elevation = take(elevation, wet_nodes)
    7382                 runup_index = argmax(wet_elevation)
     7351                wet_elevation = num.take(elevation, wet_nodes)
     7352                runup_index = num.argmax(wet_elevation)
    73837353                runup = max(wet_elevation)
    73847354                assert wet_elevation[runup_index] == runup       # Must be True
     
    73887358
    73897359                # Record location
    7390                 wet_x = take(x, wet_nodes)
    7391                 wet_y = take(y, wet_nodes)
     7360                wet_x = num.take(x, wet_nodes)
     7361                wet_y = num.take(y, wet_nodes)
    73927362                maximal_runup_location = [wet_x[runup_index],wet_y[runup_index]]
    73937363
  • anuga_core/source/anuga/shallow_water/eq_test.py

    r4436 r6157  
    6666   
    6767from anuga.abstract_2d_finite_volumes.util import file_function
    68 from Numeric import array, Float
     68import Numeric as num
    6969from pylab import plot, ion, hold,savefig
    7070
     
    7575
    7676y = 10000
    77 points=array([[0]*2]*max)
     77points=num.array([[0]*2]*max)
    7878print points
    7979half_max_skip=(max*skip)/2
     
    8787number_points = profile_lenght/interval
    8888y = 10000
    89 points=array([[0]*2]*number_points)
     89points=num.array([[0]*2]*number_points)
    9090print points
    9191half_profile=profile_lenght/2
  • anuga_core/source/anuga/shallow_water/eqf.py

    r4320 r6157  
    2525
    2626"""
     27
    2728
    2829def earthquake_tsunami(length, width, strike, depth, \
     
    112113
    113114        from math import sin, cos, radians, exp, cosh
    114         from Numeric import zeros, Float
    115115        from okada import okadatest
    116116
  • anuga_core/source/anuga/shallow_water/shallow_water_domain.py

    r6121 r6157  
    8080# $LastChangedBy$
    8181
    82 from Numeric import zeros, ones, Float, array, sum, size
    83 from Numeric import compress, arange
     82import Numeric as num
    8483
    8584from anuga.abstract_2d_finite_volumes.neighbour_mesh import segment_midpoints
     
    343342
    344343        # Select indices for which depth > 0
    345         wet_indices = compress(depth > minimum_allowed_height,
    346                                arange(len(depth)))
     344        wet_indices = num.compress(depth > minimum_allowed_height,
     345                                   num.arange(len(depth)))
    347346        return wet_indices
    348347
     
    651650        """
    652651
    653         from Numeric import sqrt
    654652        from anuga.config import epsilon, g               
    655653
     
    744742            # Froude number in each direction
    745743            name = 'Froude (x)'
    746             Vfx = Vu/(sqrt(g*Vh) + epsilon)
    747             Efx = Eu/(sqrt(g*Eh) + epsilon)
    748             Cfx = Cu/(sqrt(g*Ch) + epsilon)
     744            Vfx = Vu/(num.sqrt(g*Vh) + epsilon)
     745            Efx = Eu/(num.sqrt(g*Eh) + epsilon)
     746            Cfx = Cu/(num.sqrt(g*Ch) + epsilon)
    749747           
    750748            s  = '    %s: vertex_values =  %.4f,\t %.4f,\t %.4f\n'\
     
    761759
    762760            name = 'Froude (y)'
    763             Vfy = Vv/(sqrt(g*Vh) + epsilon)
    764             Efy = Ev/(sqrt(g*Eh) + epsilon)
    765             Cfy = Cv/(sqrt(g*Ch) + epsilon)
     761            Vfy = Vv/(num.sqrt(g*Vh) + epsilon)
     762            Efy = Ev/(num.sqrt(g*Eh) + epsilon)
     763            Cfy = Cv/(num.sqrt(g*Ch) + epsilon)
    766764           
    767765            s  = '    %s: vertex_values =  %.4f,\t %.4f,\t %.4f\n'\
     
    10821080        self.normals = domain.normals
    10831081
    1084         self.conserved_quantities = zeros(3, Float)
     1082        self.conserved_quantities = num.zeros(3, num.Float)
    10851083
    10861084    def __repr__(self):
     
    15001498    if callable(f):
    15011499        N = 3
    1502         x = ones(3, Float)
    1503         y = ones(3, Float)
     1500        x = num.ones(3, num.Float)
     1501        y = num.ones(3, num.Float)
    15041502        try:
    15051503            q = f(1.0, x=x, y=y)
     
    15101508
    15111509        try:
    1512             q = array(q).astype(Float)
     1510            q = num.array(q).astype(num.Float)
    15131511        except:
    15141512            msg = 'Return value from vector function %s could ' %f
     
    15781576
    15791577        from anuga.config import rho_a, rho_w, eta_w
    1580         from Numeric import array, Float
    15811578
    15821579        if len(args) == 2:
     
    16081605
    16091606        from math import pi, cos, sin, sqrt
    1610         from Numeric import Float, ones, ArrayType
    16111607
    16121608        xmom_update = domain.quantities['xmomentum'].explicit_update
     
    16231619
    16241620            try:
    1625                 s_vec = self.speed * ones(N, Float)
     1621                s_vec = self.speed * num.ones(N, num.Float)
    16261622            except:
    16271623                msg = 'Speed must be either callable or a scalar: %s' %self.s
     
    16361632
    16371633            try:
    1638                 phi_vec = self.phi * ones(N, Float)
     1634                phi_vec = self.phi * num.ones(N, num.Float)
    16391635            except:
    16401636                msg = 'Angle must be either callable or a scalar: %s' %self.phi
  • anuga_core/source/anuga/shallow_water/smf.py

    r5675 r6157  
    4646Geoscience Australia, June 2005
    4747"""
     48
     49import Numeric as num
     50
     51
    4852def find_min(x0, wa, kappad, dx):
    4953    """Determine eta_min to scale eta(x,y)
     
    384388
    385389        from math import sin, cos, radians, exp, cosh
    386         from Numeric import zeros, Float
     390#        from Numeric import zeros, Float
    387391
    388392        #ensure vectors x and y have the same length
     
    412416        yr = ((x-x0) * sina + (y-y0) * cosa) + y0
    413417
    414         z = zeros(N, Float)
     418        z = num.zeros(N, num.Float)
    415419        maxz = 0.0
    416420        minz = 0.0
  • anuga_core/source/anuga/shallow_water/test_data_manager.py

    r6120 r6157  
    77import unittest
    88import copy
    9 from Numeric import zeros, array, allclose, Float, Int, ones,transpose
     9import Numeric as num
     10               
    1011from anuga.utilities.numerical_tools import mean
    1112import tempfile
     
    6667        #Initial condition - with jumps
    6768        bed = domain.quantities['elevation'].vertex_values
    68         stage = zeros(bed.shape, Float)
     69        stage = num.zeros(bed.shape, num.Float)
    6970
    7071        h = 0.3
     
    188189        V = fid.variables['volumes']
    189190
    190         assert allclose (x[:], self.X.flat)
    191         assert allclose (y[:], self.Y.flat)
    192         assert allclose (z[:], self.F.flat)
     191        assert num.allclose (x[:], self.X.flat)
     192        assert num.allclose (y[:], self.Y.flat)
     193        assert num.allclose (z[:], self.F.flat)
    193194
    194195        P = len(self.domain)
     
    252253        range = fid.variables['stage_range'][:]
    253254        #print range
    254         assert allclose(range,[-0.93519, 0.15]) or\
    255                allclose(range,[-0.9352743, 0.15]) or\
    256                allclose(range,[-0.93522203, 0.15000001]) # Old slope limiters
     255        assert num.allclose(range,[-0.93519, 0.15]) or\
     256               num.allclose(range,[-0.9352743, 0.15]) or\
     257               num.allclose(range,[-0.93522203, 0.15000001]) # Old slope limiters
    257258       
    258259        range = fid.variables['xmomentum_range'][:]
    259260        #print range
    260         assert allclose(range,[0,0.4695096]) or \
    261                allclose(range,[0,0.47790655]) or\
    262                allclose(range,[0,0.46941957]) or\
    263                allclose(range,[0,0.47769409])
     261        assert num.allclose(range,[0,0.4695096]) or \
     262               num.allclose(range,[0,0.47790655]) or\
     263               num.allclose(range,[0,0.46941957]) or\
     264               num.allclose(range,[0,0.47769409])
    264265
    265266       
    266267        range = fid.variables['ymomentum_range'][:]
    267268        #print range
    268         assert allclose(range,[0,0.02174380]) or\
    269                allclose(range,[0,0.02174439]) or\
    270                allclose(range,[0,0.02283983]) or\
    271                allclose(range,[0,0.0217342]) or\
    272                allclose(range,[0,0.0227564]) # Old slope limiters
     269        assert num.allclose(range,[0,0.02174380]) or\
     270               num.allclose(range,[0,0.02174439]) or\
     271               num.allclose(range,[0,0.02283983]) or\
     272               num.allclose(range,[0,0.0217342]) or\
     273               num.allclose(range,[0,0.0227564]) # Old slope limiters
    273274       
    274275        fid.close()
     
    330331        # Get the variables
    331332        extrema = fid.variables['stage-elevation.extrema'][:]
    332         assert allclose(extrema, [0.00, 0.30])
     333        assert num.allclose(extrema, [0.00, 0.30])
    333334
    334335        loc = fid.variables['stage-elevation.min_location'][:]
    335         assert allclose(loc, [0.16666667, 0.33333333])
     336        assert num.allclose(loc, [0.16666667, 0.33333333])
    336337
    337338        loc = fid.variables['stage-elevation.max_location'][:]       
    338         assert allclose(loc, [0.8333333, 0.16666667])       
     339        assert num.allclose(loc, [0.8333333, 0.16666667])       
    339340
    340341        time = fid.variables['stage-elevation.max_time'][:]
    341         assert allclose(time, 0.0)               
     342        assert num.allclose(time, 0.0)               
    342343
    343344        extrema = fid.variables['xmomentum.extrema'][:]
    344         assert allclose(extrema,[-0.06062178, 0.47873023]) or allclose(extrema, [-0.06062178, 0.47847986])
     345        assert num.allclose(extrema,[-0.06062178, 0.47873023]) or num.allclose(extrema, [-0.06062178, 0.47847986])
    345346       
    346347        extrema = fid.variables['ymomentum.extrema'][:]
    347         assert allclose(extrema,[0.00, 0.0625786]) or allclose(extrema,[0.00, 0.06062178])
     348        assert num.allclose(extrema,[0.00, 0.0625786]) or num.allclose(extrema,[0.00, 0.06062178])
    348349
    349350        time_interval = fid.variables['extrema.time_interval'][:]
    350         assert allclose(time_interval, [0,1])
     351        assert num.allclose(time_interval, [0,1])
    351352       
    352353        polygon = fid.variables['extrema.polygon'][:]       
    353         assert allclose(polygon, domain.get_boundary_polygon())
     354        assert num.allclose(polygon, domain.get_boundary_polygon())
    354355       
    355356        fid.close()
     
    380381        V = fid.variables['volumes']
    381382
    382         assert allclose([X[0], Y[0]], array([0.0, 0.0]))
    383         assert allclose([X[1], Y[1]], array([0.0, 0.5]))
    384         assert allclose([X[2], Y[2]], array([0.0, 1.0]))
    385         assert allclose([X[4], Y[4]], array([0.5, 0.5]))
    386         assert allclose([X[7], Y[7]], array([1.0, 0.5]))
     383        assert num.allclose([X[0], Y[0]], num.array([0.0, 0.0]))
     384        assert num.allclose([X[1], Y[1]], num.array([0.0, 0.5]))
     385        assert num.allclose([X[2], Y[2]], num.array([0.0, 1.0]))
     386        assert num.allclose([X[4], Y[4]], num.array([0.5, 0.5]))
     387        assert num.allclose([X[7], Y[7]], num.array([1.0, 0.5]))
    387388
    388389        assert Z[4] == -0.5
     
    427428        A = stage[0,:]
    428429        #print A[0], (Q2[0,0] + Q1[1,0])/2
    429         assert allclose(A[0], (Q2[0] + Q1[1])/2)
    430         assert allclose(A[1], (Q0[1] + Q1[3] + Q2[2])/3)
    431         assert allclose(A[2], Q0[3])
    432         assert allclose(A[3], (Q0[0] + Q1[5] + Q2[4])/3)
     430        assert num.allclose(A[0], (Q2[0] + Q1[1])/2)
     431        assert num.allclose(A[1], (Q0[1] + Q1[3] + Q2[2])/3)
     432        assert num.allclose(A[2], Q0[3])
     433        assert num.allclose(A[3], (Q0[0] + Q1[5] + Q2[4])/3)
    433434
    434435        #Center point
    435         assert allclose(A[4], (Q1[0] + Q2[1] + Q0[2] +\
    436                                  Q0[5] + Q2[6] + Q1[7])/6)
     436        assert num.allclose(A[4], (Q1[0] + Q2[1] + Q0[2] +\
     437                                   Q0[5] + Q2[6] + Q1[7])/6)
    437438       
    438439        fid.close()
     
    446447
    447448        import time, os
    448         from Numeric import array, zeros, allclose, Float, concatenate
    449449        from Scientific.IO.NetCDF import NetCDFFile
    450450
     
    481481
    482482        A = stage[1,:]
    483         assert allclose(A[0], (Q2[0] + Q1[1])/2)
    484         assert allclose(A[1], (Q0[1] + Q1[3] + Q2[2])/3)
    485         assert allclose(A[2], Q0[3])
    486         assert allclose(A[3], (Q0[0] + Q1[5] + Q2[4])/3)
     483        assert num.allclose(A[0], (Q2[0] + Q1[1])/2)
     484        assert num.allclose(A[1], (Q0[1] + Q1[3] + Q2[2])/3)
     485        assert num.allclose(A[2], Q0[3])
     486        assert num.allclose(A[3], (Q0[0] + Q1[5] + Q2[4])/3)
    487487
    488488        #Center point
    489         assert allclose(A[4], (Q1[0] + Q2[1] + Q0[2] +\
    490                                  Q0[5] + Q2[6] + Q1[7])/6)
     489        assert num.allclose(A[4], (Q1[0] + Q2[1] + Q0[2] +\
     490                                   Q0[5] + Q2[6] + Q1[7])/6)
    491491
    492492
     
    504504       
    505505        import time, os
    506         from Numeric import array, zeros, allclose, Float, concatenate
    507506        from Scientific.IO.NetCDF import NetCDFFile
    508507
     
    538537
    539538        A = stage[1,:]
    540         assert allclose(A[0], min(Q2[0], Q1[1]))
    541         assert allclose(A[1], min(Q0[1], Q1[3], Q2[2]))
    542         assert allclose(A[2], Q0[3])
    543         assert allclose(A[3], min(Q0[0], Q1[5], Q2[4]))
     539        assert num.allclose(A[0], min(Q2[0], Q1[1]))
     540        assert num.allclose(A[1], min(Q0[1], Q1[3], Q2[2]))
     541        assert num.allclose(A[2], Q0[3])
     542        assert num.allclose(A[3], min(Q0[0], Q1[5], Q2[4]))
    544543
    545544        #Center point
    546         assert allclose(A[4], min(Q1[0], Q2[1], Q0[2],\
    547                                   Q0[5], Q2[6], Q1[7]))
     545        assert num.allclose(A[4], min(Q1[0], Q2[1], Q0[2],
     546                                      Q0[5], Q2[6], Q1[7]))
    548547
    549548
     
    559558
    560559        import time, os, config
    561         from Numeric import array, zeros, allclose, Float, concatenate
    562560        from Scientific.IO.NetCDF import NetCDFFile
    563561
     
    590588           
    591589            if t == 0.0:
    592                 assert allclose(stage, self.initial_stage)
    593                 assert allclose(stage_file[:], stage.flat)
     590                assert num.allclose(stage, self.initial_stage)
     591                assert num.allclose(stage_file[:], stage.flat)
    594592            else:
    595                 assert not allclose(stage, self.initial_stage)
    596                 assert not allclose(stage_file[:], stage.flat)
     593                assert not num.allclose(stage, self.initial_stage)
     594                assert not num.allclose(stage_file[:], stage.flat)
    597595
    598596            fid.close()
     
    607605
    608606        import time, os
    609         from Numeric import array, zeros, allclose, Float, concatenate
    610607        from Scientific.IO.NetCDF import NetCDFFile
    611608
     
    646643
    647644        A = stage[1,:]
    648         assert allclose(stage[1,:], z[:])
    649 
    650 
    651         assert allclose(xmomentum, 0.0)
    652         assert allclose(ymomentum, 0.0)       
     645        assert num.allclose(stage[1,:], z[:])
     646
     647
     648        assert num.allclose(xmomentum, 0.0)
     649        assert num.allclose(ymomentum, 0.0)       
    653650       
    654651        fid.close()
     
    663660
    664661        import time, os
    665         from Numeric import array, zeros, allclose, Float, concatenate
    666662        from Scientific.IO.NetCDF import NetCDFFile
    667663
     
    724720
    725721        import time, os
    726         from Numeric import array, zeros, allclose, Float, concatenate, ones
    727722        from Scientific.IO.NetCDF import NetCDFFile
    728723
     
    819814                ref_points.append ([xnew,ynew]) #Relative point values
    820815
    821         assert allclose(points, ref_points)
    822 
    823         assert allclose(elevation, ref_elevation)
     816        assert num.allclose(points, ref_points)
     817
     818        assert num.allclose(elevation, ref_elevation)
    824819
    825820        #Cleanup
     
    838833
    839834        import time, os
    840         from Numeric import array, zeros, allclose, Float, concatenate, ones
    841835        from Scientific.IO.NetCDF import NetCDFFile
    842836
     
    861855        xvec = range(10)
    862856        #z = range(100)
    863         z = zeros(100)
     857        z = num.zeros(100)
    864858        NODATA_value = -9999
    865859        count = -1
     
    920914
    921915        #create new reference points
    922         newz = zeros(19)
     916        newz = num.zeros(19)
    923917        newz[0:2] = ref_elevation[32:34]
    924918        newz[2:5] = ref_elevation[35:38]
     
    950944
    951945
    952         assert allclose(points, new_ref_points)
    953         assert allclose(elevation, ref_elevation)
     946        assert num.allclose(points, new_ref_points)
     947        assert num.allclose(elevation, ref_elevation)
    954948
    955949        #Cleanup
     
    969963
    970964        import time, os
    971         from Numeric import array, zeros, allclose, Float, concatenate, ones
    972965        from Scientific.IO.NetCDF import NetCDFFile
    973966
     
    992985        xvec = range(10)
    993986        #z = range(100)
    994         z = zeros(100)
     987        z = num.zeros(100)
    995988        NODATA_value = -9999
    996989        count = -1
     
    10511044
    10521045        #create new reference points
    1053         newz = zeros(14)
     1046        newz = num.zeros(14)
    10541047        newz[0:2] = ref_elevation[32:34]
    10551048        newz[2:5] = ref_elevation[35:38]
     
    10831076        #print new_ref_points, len(new_ref_points)
    10841077
    1085         assert allclose(elevation, ref_elevation)
    1086         assert allclose(points, new_ref_points)
     1078        assert num.allclose(elevation, ref_elevation)
     1079        assert num.allclose(points, new_ref_points)
    10871080
    10881081
     
    11031096
    11041097        import time, os
    1105         from Numeric import array, zeros, allclose, Float, concatenate
    11061098        from Scientific.IO.NetCDF import NetCDFFile
    11071099
     
    12131205        #print points[:]
    12141206        #print ref_points
    1215         assert allclose(points, ref_points)
     1207        assert num.allclose(points, ref_points)
    12161208
    12171209        #print attributes[:]
    12181210        #print ref_elevation
    1219         assert allclose(elevation, ref_elevation)
     1211        assert num.allclose(elevation, ref_elevation)
    12201212
    12211213        #Cleanup
     
    12351227
    12361228        import time, os
    1237         from Numeric import array, zeros, allclose, Float, concatenate
    12381229        from Scientific.IO.NetCDF import NetCDFFile
    12391230
     
    13411332        L = lines[2].strip().split()
    13421333        assert L[0].strip().lower() == 'xllcorner'
    1343         assert allclose(float(L[1].strip().lower()), 308500)
     1334        assert num.allclose(float(L[1].strip().lower()), 308500)
    13441335
    13451336        L = lines[3].strip().split()
    13461337        assert L[0].strip().lower() == 'yllcorner'
    1347         assert allclose(float(L[1].strip().lower()), 6189000)
     1338        assert num.allclose(float(L[1].strip().lower()), 6189000)
    13481339
    13491340        L = lines[4].strip().split()
    13501341        assert L[0].strip().lower() == 'cellsize'
    1351         assert allclose(float(L[1].strip().lower()), cellsize)
     1342        assert num.allclose(float(L[1].strip().lower()), cellsize)
    13521343
    13531344        L = lines[5].strip().split()
     
    13601351            y = (4-j) * cellsize
    13611352            for i in range(5):
    1362                 assert allclose(float(L[i]), -i*cellsize - y)
     1353                assert num.allclose(float(L[i]), -i*cellsize - y)
    13631354               
    13641355        #Cleanup
     
    13911382        L = lines[2].strip().split()
    13921383        assert L[0].strip().lower() == 'xllcorner'
    1393         assert allclose(float(L[1].strip().lower()), 308500)
     1384        assert num.allclose(float(L[1].strip().lower()), 308500)
    13941385
    13951386        L = lines[3].strip().split()
    13961387        assert L[0].strip().lower() == 'yllcorner'
    1397         assert allclose(float(L[1].strip().lower()), 6189000)
     1388        assert num.allclose(float(L[1].strip().lower()), 6189000)
    13981389
    13991390        L = lines[4].strip().split()
    14001391        assert L[0].strip().lower() == 'cellsize'
    1401         assert allclose(float(L[1].strip().lower()), cellsize)
     1392        assert num.allclose(float(L[1].strip().lower()), cellsize)
    14021393
    14031394        L = lines[5].strip().split()
     
    14101401            y = (4-j) * cellsize
    14111402            for i in range(5):
    1412                 assert allclose(float(L[i]), 1 - (-i*cellsize - y))
     1403                assert num.allclose(float(L[i]), 1 - (-i*cellsize - y))
    14131404
    14141405
     
    14271418
    14281419        import time, os
    1429         from Numeric import array, zeros, allclose, Float, concatenate
    14301420        from Scientific.IO.NetCDF import NetCDFFile
    14311421
     
    14851475        L = lines[2].strip().split()
    14861476        assert L[0].strip().lower() == 'xllcorner'
    1487         assert allclose(float(L[1].strip().lower()), 308500)
     1477        assert num.allclose(float(L[1].strip().lower()), 308500)
    14881478
    14891479        L = lines[3].strip().split()
    14901480        assert L[0].strip().lower() == 'yllcorner'
    1491         assert allclose(float(L[1].strip().lower()), 6189000)
     1481        assert num.allclose(float(L[1].strip().lower()), 6189000)
    14921482
    14931483        #Check grid values
     
    14961486            y = (4-j) * cellsize
    14971487            for i in range(5):
    1498                 assert allclose(float(L[i]), -i*cellsize - y)
     1488                assert num.allclose(float(L[i]), -i*cellsize - y)
    14991489               
    15001490        #Cleanup
     
    15111501
    15121502        import time, os
    1513         from Numeric import array, zeros, allclose, Float, concatenate
    15141503        from Scientific.IO.NetCDF import NetCDFFile
    15151504
     
    15911580        L = lines[2].strip().split()
    15921581        assert L[0].strip().lower() == 'xllcorner'
    1593         assert allclose(float(L[1].strip().lower()), 308500)
     1582        assert num.allclose(float(L[1].strip().lower()), 308500)
    15941583
    15951584        L = lines[3].strip().split()
    15961585        assert L[0].strip().lower() == 'yllcorner'
    1597         assert allclose(float(L[1].strip().lower()), 6189000)
     1586        assert num.allclose(float(L[1].strip().lower()), 6189000)
    15981587
    15991588        #print "ascfile", ascfile
     
    16051594                #print " -i*cellsize - y",  -i*cellsize - y
    16061595                #print "float(L[i])", float(L[i])
    1607                 assert allclose(float(L[i]), -i*cellsize - y)
     1596                assert num.allclose(float(L[i]), -i*cellsize - y)
    16081597
    16091598        #Cleanup
     
    16201609        L = lines[2].strip().split()
    16211610        assert L[0].strip().lower() == 'xllcorner'
    1622         assert allclose(float(L[1].strip().lower()), 308500)
     1611        assert num.allclose(float(L[1].strip().lower()), 308500)
    16231612
    16241613        L = lines[3].strip().split()
    16251614        assert L[0].strip().lower() == 'yllcorner'
    1626         assert allclose(float(L[1].strip().lower()), 6189000)
     1615        assert num.allclose(float(L[1].strip().lower()), 6189000)
    16271616
    16281617        #Check grid values
     
    16331622                #print " -i*cellsize - y",  -i*cellsize - y
    16341623                #print "float(L[i])", float(L[i])               
    1635                 assert allclose(float(L[i]), 1 - (-i*cellsize - y))
     1624                assert num.allclose(float(L[i]), 1 - (-i*cellsize - y))
    16361625
    16371626        #Cleanup
     
    16491638
    16501639        import time, os
    1651         from Numeric import array, zeros, allclose, Float, concatenate
    16521640        from Scientific.IO.NetCDF import NetCDFFile
    16531641
     
    17261714        L = lines[2].strip().split()
    17271715        assert L[0].strip().lower() == 'xllcorner'
    1728         assert allclose(float(L[1].strip().lower()), 308500)
     1716        assert num.allclose(float(L[1].strip().lower()), 308500)
    17291717
    17301718        L = lines[3].strip().split()
    17311719        assert L[0].strip().lower() == 'yllcorner'
    1732         assert allclose(float(L[1].strip().lower()), 6189000)
     1720        assert num.allclose(float(L[1].strip().lower()), 6189000)
    17331721
    17341722        #print "ascfile", ascfile
     
    17401728                #print " -i*cellsize - y",  -i*cellsize - y
    17411729                #print "float(L[i])", float(L[i])
    1742                 assert allclose(float(L[i]), -i*cellsize - y)
     1730                assert num.allclose(float(L[i]), -i*cellsize - y)
    17431731               
    17441732        #Cleanup
     
    17551743        L = lines[2].strip().split()
    17561744        assert L[0].strip().lower() == 'xllcorner'
    1757         assert allclose(float(L[1].strip().lower()), 308500)
     1745        assert num.allclose(float(L[1].strip().lower()), 308500)
    17581746
    17591747        L = lines[3].strip().split()
    17601748        assert L[0].strip().lower() == 'yllcorner'
    1761         assert allclose(float(L[1].strip().lower()), 6189000)
     1749        assert num.allclose(float(L[1].strip().lower()), 6189000)
    17621750
    17631751        #Check grid values
     
    17661754            y = (4-j) * cellsize
    17671755            for i in range(5):
    1768                 assert allclose(float(L[i]), 1 - (-i*cellsize - y))
     1756                assert num.allclose(float(L[i]), 1 - (-i*cellsize - y))
    17691757
    17701758        #Cleanup
     
    17951783
    17961784        import time, os
    1797         from Numeric import array, zeros, allclose, Float, concatenate
    17981785        from Scientific.IO.NetCDF import NetCDFFile
    17991786
     
    18611848                #print " -i*cellsize - y",  -i*cellsize - y
    18621849                #print "float(L[i])", float(L[i])
    1863                 assert allclose(float(L[i]), -i*cellsize - y)               
     1850                assert num.allclose(float(L[i]), -i*cellsize - y)               
    18641851        #Cleanup
    18651852        os.remove(prjfile)
     
    18791866                #print " -i*cellsize - y",  -i*cellsize - y
    18801867                #print "float(L[i])", float(L[i])
    1881                 assert allclose(float(L[i]), -i*cellsize - y)               
     1868                assert num.allclose(float(L[i]), -i*cellsize - y)               
    18821869        #Cleanup
    18831870        os.remove(prjfile)
     
    18961883            y = (4-j) * cellsize
    18971884            for i in range(5):
    1898                 assert allclose(float(L[i]), 1 - (-i*cellsize - y))
     1885                assert num.allclose(float(L[i]), 1 - (-i*cellsize - y))
    18991886        #Cleanup
    19001887        os.remove(prjfile)
     
    19121899            y = (4-j) * cellsize
    19131900            for i in range(5):
    1914                 assert allclose(float(L[i]), 1 - (-i*cellsize - y))
     1901                assert num.allclose(float(L[i]), 1 - (-i*cellsize - y))
    19151902        #Cleanup
    19161903        os.remove(prjfile)
     
    19431930
    19441931        import time, os
    1945         from Numeric import array, zeros, allclose, Float, concatenate
    19461932        from Scientific.IO.NetCDF import NetCDFFile
    19471933
     
    20662052        L = lines[2].strip().split()
    20672053        assert L[0].strip().lower() == 'xllcorner'
    2068         assert allclose(float(L[1].strip().lower()), 308500)
     2054        assert num.allclose(float(L[1].strip().lower()), 308500)
    20692055
    20702056        L = lines[3].strip().split()
    20712057        assert L[0].strip().lower() == 'yllcorner'
    2072         assert allclose(float(L[1].strip().lower()), 6189000)
     2058        assert num.allclose(float(L[1].strip().lower()), 6189000)
    20732059
    20742060        L = lines[4].strip().split()
    20752061        assert L[0].strip().lower() == 'cellsize'
    2076         assert allclose(float(L[1].strip().lower()), cellsize)
     2062        assert num.allclose(float(L[1].strip().lower()), cellsize)
    20772063
    20782064        L = lines[5].strip().split()
     
    20832069        for i, line in enumerate(lines[6:]):
    20842070            for j, value in enumerate( line.split() ):
    2085                 assert allclose(float(value), -(10-i+j)*cellsize,
    2086                                 atol=1.0e-12, rtol=1.0e-12)
     2071                assert num.allclose(float(value), -(10-i+j)*cellsize,
     2072                                    atol=1.0e-12, rtol=1.0e-12)
    20872073
    20882074                # Note: Equality can be obtained in this case,
     
    21342120
    21352121        import time, os
    2136         from Numeric import array, zeros, allclose, Float, concatenate
    21372122        from Scientific.IO.NetCDF import NetCDFFile
    21382123
     
    22632248        L = lines[2].strip().split()
    22642249        assert L[0].strip().lower() == 'xllcorner'
    2265         assert allclose(float(L[1].strip().lower()), 308530)
     2250        assert num.allclose(float(L[1].strip().lower()), 308530)
    22662251
    22672252        L = lines[3].strip().split()
    22682253        assert L[0].strip().lower() == 'yllcorner'
    2269         assert allclose(float(L[1].strip().lower()), 6189050)
     2254        assert num.allclose(float(L[1].strip().lower()), 6189050)
    22702255
    22712256        L = lines[4].strip().split()
    22722257        assert L[0].strip().lower() == 'cellsize'
    2273         assert allclose(float(L[1].strip().lower()), cellsize)
     2258        assert num.allclose(float(L[1].strip().lower()), cellsize)
    22742259
    22752260        L = lines[5].strip().split()
     
    23002285
    23012286        import time, os
    2302         from Numeric import array, zeros, allclose, Float, concatenate
    23032287        from Scientific.IO.NetCDF import NetCDFFile
    23042288
     
    23652349        L = lines[2].strip().split()
    23662350        assert L[0].strip().lower() == 'xllcorner'
    2367         assert allclose(float(L[1].strip().lower()), 308500)
     2351        assert num.allclose(float(L[1].strip().lower()), 308500)
    23682352
    23692353        L = lines[3].strip().split()
    23702354        assert L[0].strip().lower() == 'yllcorner'
    2371         assert allclose(float(L[1].strip().lower()), 6189000)
     2355        assert num.allclose(float(L[1].strip().lower()), 6189000)
    23722356
    23732357        L = lines[4].strip().split()
    23742358        assert L[0].strip().lower() == 'cellsize'
    2375         assert allclose(float(L[1].strip().lower()), cellsize)
     2359        assert num.allclose(float(L[1].strip().lower()), cellsize)
    23762360
    23772361        L = lines[5].strip().split()
     
    23922376
    23932377                        #print i, j, index, ':', L[i], val0, val1
    2394                         assert allclose(float(L[i]), min(val0, val1))
     2378                        assert num.allclose(float(L[i]), min(val0, val1))
    23952379
    23962380
     
    24122396
    24132397        import time, os
    2414         from Numeric import array, zeros, allclose, Float, concatenate
    24152398        from Scientific.IO.NetCDF import NetCDFFile
    24162399
     
    24792462        L = lines[2].strip().split()
    24802463        assert L[0].strip().lower() == 'xllcorner'
    2481         assert allclose(float(L[1].strip().lower()), 308500)
     2464        assert num.allclose(float(L[1].strip().lower()), 308500)
    24822465
    24832466        L = lines[3].strip().split()
    24842467        assert L[0].strip().lower() == 'yllcorner'
    2485         assert allclose(float(L[1].strip().lower()), 6189000)
     2468        assert num.allclose(float(L[1].strip().lower()), 6189000)
    24862469
    24872470        L = lines[4].strip().split()
    24882471        assert L[0].strip().lower() == 'cellsize'
    2489         assert allclose(float(L[1].strip().lower()), cellsize)
     2472        assert num.allclose(float(L[1].strip().lower()), cellsize)
    24902473
    24912474        L = lines[5].strip().split()
     
    25062489
    25072490                        #print i, j, index, ':', L[i], val0, val1
    2508                         assert allclose(float(L[i]), min(val0, val1))
     2491                        assert num.allclose(float(L[i]), min(val0, val1))
    25092492
    25102493
     
    25282511
    25292512        import time, os
    2530         from Numeric import array, zeros, allclose, Float, concatenate
    25312513        from Scientific.IO.NetCDF import NetCDFFile
    25322514
     
    25612543
    25622544        bed = domain.quantities['elevation'].vertex_values
    2563         stage = zeros(bed.shape, Float)
     2545        stage = num.zeros(bed.shape, num.Float)
    25642546
    25652547        h = 0.3
     
    26302612        L = lines[2].strip().split()
    26312613        assert L[0].strip().lower() == 'xllcorner'
    2632         assert allclose(float(L[1].strip().lower()), 308500)
     2614        assert num.allclose(float(L[1].strip().lower()), 308500)
    26332615
    26342616        L = lines[3].strip().split()
    26352617        assert L[0].strip().lower() == 'yllcorner'
    2636         assert allclose(float(L[1].strip().lower()), 6189000)
     2618        assert num.allclose(float(L[1].strip().lower()), 6189000)
    26372619
    26382620        L = lines[4].strip().split()
    26392621        assert L[0].strip().lower() == 'cellsize'
    2640         assert allclose(float(L[1].strip().lower()), cellsize)
     2622        assert num.allclose(float(L[1].strip().lower()), cellsize)
    26412623
    26422624        L = lines[5].strip().split()
     
    26532635                #print i
    26542636                if i+j >= 4:
    2655                     assert allclose(float(L[i]), -i*cellsize - y)
     2637                    assert num.allclose(float(L[i]), -i*cellsize - y)
    26562638                else:
    26572639                    #Missing values
    2658                     assert allclose(float(L[i]), -9999)
     2640                    assert num.allclose(float(L[i]), -9999)
    26592641
    26602642
     
    26732655
    26742656        import time, os
    2675         from Numeric import array, zeros, allclose, Float, concatenate
    26762657        from Scientific.IO.NetCDF import NetCDFFile
    26772658
     
    27542735
    27552736        #print grid
    2756         assert allclose(grid, ref_grid)
     2737        assert num.allclose(grid, ref_grid)
    27572738
    27582739        fid.close()
     
    27732754
    27742755        import time, os
    2775         from Numeric import array, zeros, allclose, Float, concatenate, NewAxis
    27762756        from Scientific.IO.NetCDF import NetCDFFile
    27772757        # Used for points that lie outside mesh
     
    28132793
    28142794        # Invoke interpolation for vertex points       
    2815         points = concatenate( (x[:,NewAxis],y[:,NewAxis]), axis=1 )
     2795        points = num.concatenate( (x[:,num.NewAxis],y[:,num.NewAxis]), axis=1 )
    28162796        sww2pts(self.domain.get_name(),
    28172797                quantity = 'elevation',
     
    28232803        #print 'P', point_values
    28242804        #print 'Ref', ref_point_values       
    2825         assert allclose(point_values, ref_point_values)       
     2805        assert num.allclose(point_values, ref_point_values)       
    28262806
    28272807
     
    28412821        #print 'P', point_values
    28422822        #print 'Ref', ref_point_values       
    2843         assert allclose(point_values, ref_point_values)       
     2823        assert num.allclose(point_values, ref_point_values)       
    28442824
    28452825
     
    28982878
    28992879        #Check that first coordinate is correctly represented
    2900         assert allclose(x[0], e)
    2901         assert allclose(y[0], n)
     2880        assert num.allclose(x[0], e)
     2881        assert num.allclose(y[0], n)
    29022882
    29032883        #Check first value
     
    29082888        #print ymomentum
    29092889
    2910         assert allclose(stage[0,0], first_value/100)  #Meters
     2890        assert num.allclose(stage[0,0], first_value/100)  #Meters
    29112891
    29122892        #Check fourth value
    2913         assert allclose(stage[0,3], fourth_value/100)  #Meters
     2893        assert num.allclose(stage[0,3], fourth_value/100)  #Meters
    29142894
    29152895        fid.close()
     
    29552935        ymomentum_1 = fid.variables['ymomentum'][:]
    29562936
    2957         assert allclose(stage_1[0,0], first_value/100)  #Meters
    2958         assert allclose(stage_1[0,3], fourth_value/100)  #Meters
     2937        assert num.allclose(stage_1[0,0], first_value/100)  #Meters
     2938        assert num.allclose(stage_1[0,3], fourth_value/100)  #Meters
    29592939
    29602940        fid.close()
     
    29752955        elevation = fid.variables['elevation'][:]
    29762956
    2977         assert allclose(stage_5[0,0], 5*first_value/100)  #Meters
    2978         assert allclose(stage_5[0,3], 5*fourth_value/100)  #Meters
    2979 
    2980         assert allclose(5*stage_1, stage_5)
     2957        assert num.allclose(stage_5[0,0], 5*first_value/100)  #Meters
     2958        assert num.allclose(stage_5[0,3], 5*fourth_value/100)  #Meters
     2959
     2960        assert num.allclose(5*stage_1, stage_5)
    29812961
    29822962        # Momentum will also be changed due to new depth
     
    29962976                    #print i, scale, xmomentum_1[i,j], xmomentum_5[i,j]
    29972977                   
    2998                     assert allclose(xmomentum_5[i,j], ref_xmomentum)
    2999                     assert allclose(ymomentum_5[i,j], ref_ymomentum)
     2978                    assert num.allclose(xmomentum_5[i,j], ref_xmomentum)
     2979                    assert num.allclose(ymomentum_5[i,j], ref_ymomentum)
    30002980                   
    30012981       
     
    30583038
    30593039        #Check that test coordinate is correctly represented
    3060         assert allclose(x[linear_point_index], e)
    3061         assert allclose(y[linear_point_index], n)
     3040        assert num.allclose(x[linear_point_index], e)
     3041        assert num.allclose(y[linear_point_index], n)
    30623042
    30633043        #Check test value
    30643044        stage = fid.variables['stage'][:]
    30653045
    3066         assert allclose(stage[time_index, linear_point_index], test_value/100)
     3046        assert num.allclose(stage[time_index, linear_point_index], test_value/100)
    30673047
    30683048        fid.close()
     
    33033283        third_momentum=third_speed*third_height/100
    33043284
    3305         assert allclose(ymomentum[0][0],first_momentum)  #Meters
    3306         assert allclose(ymomentum[0][2],third_momentum)  #Meters
     3285        assert num.allclose(ymomentum[0][0],first_momentum)  #Meters
     3286        assert num.allclose(ymomentum[0][2],third_momentum)  #Meters
    33073287
    33083288        fid.close()
     
    34673447        third_momentum=third_speed*third_height/100
    34683448
    3469         assert allclose(ymomentum[0][0],first_momentum)  #Meters
    3470         assert allclose(ymomentum[0][2],third_momentum)  #Meters
     3449        assert num.allclose(ymomentum[0][0],first_momentum)  #Meters
     3450        assert num.allclose(ymomentum[0][2],third_momentum)  #Meters
    34713451
    34723452        fid.close()
     
    34983478
    34993479        #Check that first coordinate is correctly represented
    3500         assert allclose(x[0], e-100000)
    3501         assert allclose(y[0], n-200000)
     3480        assert num.allclose(x[0], e-100000)
     3481        assert num.allclose(y[0], n-200000)
    35023482
    35033483        fid.close()
     
    35383518
    35393519        import time, os
    3540         from Numeric import array, zeros, allclose, Float, concatenate
    35413520        from Scientific.IO.NetCDF import NetCDFFile
    35423521
     
    35653544               extent_sww(file_and_extension_name )
    35663545
    3567         assert allclose(xmin, 0.0)
    3568         assert allclose(xmax, 1.0)
    3569         assert allclose(ymin, 0.0)
    3570         assert allclose(ymax, 1.0)
     3546        assert num.allclose(xmin, 0.0)
     3547        assert num.allclose(xmax, 1.0)
     3548        assert num.allclose(ymin, 0.0)
     3549        assert num.allclose(ymax, 1.0)
    35713550
    35723551        # FIXME (Ole): Revisit these numbers
    3573         #assert allclose(stagemin, -0.85), 'stagemin=%.4f' %stagemin
    3574         #assert allclose(stagemax, 0.15), 'stagemax=%.4f' %stagemax
     3552        #assert num.allclose(stagemin, -0.85), 'stagemin=%.4f' %stagemin
     3553        #assert num.allclose(stagemax, 0.15), 'stagemax=%.4f' %stagemax
    35753554
    35763555
     
    35853564        ################################################
    35863565        from mesh_factory import rectangular
    3587         from Numeric import array
    35883566
    35893567        #Create basic mesh
     
    36303608        ##########################################
    36313609        from data_manager import sww2domain
    3632         from Numeric import allclose
    36333610        import os
    36343611
     
    36523629            #print bit
    36533630            #print 'done'
    3654             assert allclose(eval('domain.'+bit),eval('domain2.'+bit))
     3631            assert num.allclose(eval('domain.'+bit),eval('domain2.'+bit))
    36553632
    36563633        ######################################
     
    37113688            #print eval('domain.'+bit+'-domain2.'+bit)
    37123689            msg = 'Values in the two domains are different for ' + bit
    3713             assert allclose(eval('domain.'+bit),eval('domain2.'+bit),
    3714                             rtol=1.e-5, atol=3.e-8), msg
     3690            assert num.allclose(eval('domain.'+bit),eval('domain2.'+bit),
     3691                                rtol=1.e-5, atol=3.e-8), msg
    37153692
    37163693
     
    37223699
    37233700        from mesh_factory import rectangular
    3724         from Numeric import array
    37253701
    37263702        #Create basic mesh
     
    37643740        ##################################
    37653741        from data_manager import sww2domain
    3766         from Numeric import allclose
    37673742        import os
    37683743
     
    37913766        for bit in bits:
    37923767        #    print 'testing that domain.'+bit+' has been restored'
    3793             assert allclose(eval('domain.'+bit),eval('domain2.'+bit))
     3768            assert num.allclose(eval('domain.'+bit),eval('domain2.'+bit))
    37943769
    37953770        #print filler
     
    38313806        ################################################
    38323807        from mesh_factory import rectangular
    3833         from Numeric import array
    38343808        #Create basic mesh
    38353809
     
    38753849        ##########################################
    38763850        from data_manager import sww2domain
    3877         from Numeric import allclose
    38783851        import os
    38793852
     
    39023875            #print ('domain.'+bit), eval('domain.'+bit)
    39033876            #print ('domain2.'+bit), eval('domain2.'+bit)
    3904             assert allclose(eval('domain.'+bit),eval('domain2.'+bit),rtol=1.0e-1,atol=1.e-3)
     3877            assert num.allclose(eval('domain.'+bit),eval('domain2.'+bit),rtol=1.0e-1,atol=1.e-3)
    39053878            pass
    39063879
     
    39543927        for bit in bits:
    39553928            print bit
    3956             assert allclose(eval('domain.'+bit),eval('domain2.'+bit))
     3929            assert num.allclose(eval('domain.'+bit),eval('domain2.'+bit))
    39573930
    39583931
     
    39623935
    39633936        import os
    3964         from Numeric import ones, allclose, Float, arange
    39653937        from Scientific.IO.NetCDF import NetCDFFile
    39663938
     
    39943966        fid.createDimension('number_of_points', nrows*ncols)
    39953967
    3996         fid.createVariable('elevation', Float, ('number_of_points',))
     3968        fid.createVariable('elevation', num.Float, ('number_of_points',))
    39973969
    39983970        elevation = fid.variables['elevation']
    39993971
    4000         elevation[:] = (arange(nrows*ncols))
     3972        elevation[:] = (num.arange(nrows*ncols))
    40013973
    40023974        fid.close()
     
    40213993
    40223994        #generate a stencil for computing the decimated values
    4023         stencil = ones((3,3), Float) / 9.0
     3995        stencil = num.ones((3,3), num.Float) / 9.0
    40243996
    40253997        decimate_dem(root, stencil=stencil, cellsize_new=100)
     
    40324004
    40334005        #Check values
    4034         assert allclose(elevation, ref_elevation)
     4006        assert num.allclose(elevation, ref_elevation)
    40354007
    40364008        #Cleanup
     
    40454017
    40464018        import os
    4047         from Numeric import ones, allclose, Float, arange, reshape
    40484019        from Scientific.IO.NetCDF import NetCDFFile
    40494020
     
    40784049        fid.createDimension('number_of_points', nrows*ncols)
    40794050
    4080         fid.createVariable('elevation', Float, ('number_of_points',))
     4051        fid.createVariable('elevation', num.Float, ('number_of_points',))
    40814052
    40824053        elevation = fid.variables['elevation']
    40834054
    40844055        #generate initial elevation values
    4085         elevation_tmp = (arange(nrows*ncols))
     4056        elevation_tmp = (num.arange(nrows*ncols))
    40864057        #add some NODATA values
    40874058        elevation_tmp[0]   = NODATA_value
     
    41164087
    41174088        #generate a stencil for computing the decimated values
    4118         stencil = ones((3,3), Float) / 9.0
     4089        stencil = num.ones((3,3), num.Float) / 9.0
    41194090
    41204091        decimate_dem(root, stencil=stencil, cellsize_new=100)
     
    41274098
    41284099        #Check values
    4129         assert allclose(elevation, ref_elevation)
     4100        assert num.allclose(elevation, ref_elevation)
    41304101
    41314102        #Cleanup
     
    41414112
    41424113        import time, os
    4143         from Numeric import array, zeros, allclose, Float, concatenate
    41444114        from Scientific.IO.NetCDF import NetCDFFile
    41454115
     
    41674137
    41684138        import time, os
    4169         from Numeric import array, zeros, allclose, Float, concatenate
    41704139        from Scientific.IO.NetCDF import NetCDFFile
    41714140
     
    43154284        y_ref = geo_ref.get_yllcorner()
    43164285        self.failUnless(geo_ref.get_zone() == 55,  'Failed')
    4317         assert allclose(x_ref, 587798.418) # (-38, 148)
    4318         assert allclose(y_ref, 5793123.477)# (-38, 148.5)
     4286        assert num.allclose(x_ref, 587798.418) # (-38, 148)
     4287        assert num.allclose(y_ref, 5793123.477)# (-38, 148.5)
    43194288
    43204289        #Zone:   55
    43214290        #Easting:  588095.674  Northing: 5821451.722
    43224291        #Latitude:   -37  45 ' 0.00000 ''  Longitude: 148 0 ' 0.00000 ''
    4323         assert allclose((x[0],y[0]), (588095.674 - x_ref, 5821451.722 - y_ref))
     4292        assert num.allclose((x[0],y[0]), (588095.674 - x_ref, 5821451.722 - y_ref))
    43244293
    43254294        #Zone:   55
    43264295        #Easting:  632145.632  Northing: 5820863.269
    43274296        #Latitude:   -37  45 ' 0.00000 ''  Longitude: 148  30 ' 0.00000 ''
    4328         assert allclose((x[2],y[2]), (632145.632 - x_ref, 5820863.269 - y_ref))
     4297        assert num.allclose((x[2],y[2]), (632145.632 - x_ref, 5820863.269 - y_ref))
    43294298
    43304299        #Zone:   55
    43314300        #Easting:  609748.788  Northing: 5793447.860
    43324301        #Latitude:   -38  0 ' 0.00000 ''  Longitude: 148  15 ' 0.00000 ''
    4333         assert allclose((x[4],y[4]), (609748.788  - x_ref, 5793447.86 - y_ref))
    4334 
    4335         assert allclose(z[0],9000.0 )
    4336         assert allclose(stage[0][1],0.0 )
     4302        assert num.allclose((x[4],y[4]), (609748.788  - x_ref, 5793447.86 - y_ref))
     4303
     4304        assert num.allclose(z[0],9000.0 )
     4305        assert num.allclose(stage[0][1],0.0 )
    43374306
    43384307        #(4000+1000)*60
    4339         assert allclose(xmomentum[1][1],300000.0 )
     4308        assert num.allclose(xmomentum[1][1],300000.0 )
    43404309
    43414310
     
    46254594        y_ref = geo_ref.get_yllcorner()
    46264595        self.failUnless(geo_ref.get_zone() == 55,  'Failed')
    4627         assert allclose(x_ref, 587798.418) # (-38, 148)
    4628         assert allclose(y_ref, 5793123.477)# (-38, 148.5)
     4596        assert num.allclose(x_ref, 587798.418) # (-38, 148)
     4597        assert num.allclose(y_ref, 5793123.477)# (-38, 148.5)
    46294598
    46304599        #Zone:   55
    46314600        #Easting:  588095.674  Northing: 5821451.722
    46324601        #Latitude:   -37  45 ' 0.00000 ''  Longitude: 148 0 ' 0.00000 ''
    4633         assert allclose((x[0],y[0]), (588095.674 - x_ref, 5821451.722 - y_ref))
     4602        assert num.allclose((x[0],y[0]), (588095.674 - x_ref, 5821451.722 - y_ref))
    46344603
    46354604        #Zone:   55
    46364605        #Easting:  632145.632  Northing: 5820863.269
    46374606        #Latitude:   -37  45 ' 0.00000 ''  Longitude: 148  30 ' 0.00000 ''
    4638         assert allclose((x[2],y[2]), (632145.632 - x_ref, 5820863.269 - y_ref))
     4607        assert num.allclose((x[2],y[2]), (632145.632 - x_ref, 5820863.269 - y_ref))
    46394608
    46404609        #Zone:   55
    46414610        #Easting:  609748.788  Northing: 5793447.860
    46424611        #Latitude:   -38  0 ' 0.00000 ''  Longitude: 148  15 ' 0.00000 ''
    4643         assert allclose((x[4],y[4]), (609748.788  - x_ref, 5793447.86 - y_ref))
    4644 
    4645         assert allclose(z[0],9000.0 )
    4646         assert allclose(stage[0][4],100.0 )
    4647         assert allclose(stage[0][5],100.0 )
     4612        assert num.allclose((x[4],y[4]), (609748.788  - x_ref, 5793447.86 - y_ref))
     4613
     4614        assert num.allclose(z[0],9000.0 )
     4615        assert num.allclose(stage[0][4],100.0 )
     4616        assert num.allclose(stage[0][5],100.0 )
    46484617
    46494618        #(100.0 - 9000)*10
    4650         assert allclose(xmomentum[0][4], -89000.0 )
     4619        assert num.allclose(xmomentum[0][4], -89000.0 )
    46514620
    46524621        #(100.0 - -1000.000)*10
    4653         assert allclose(xmomentum[0][5], 11000.0 )
     4622        assert num.allclose(xmomentum[0][5], 11000.0 )
    46544623
    46554624        fid.close()
     
    48214790        self.failUnless(geo_ref.get_zone() == 55,  'Failed')
    48224791
    4823         assert allclose(fid.starttime, 0.0) # (-37.45, 148.25)
    4824         assert allclose(x_ref, 610120.388) # (-37.45, 148.25)
    4825         assert allclose(y_ref,  5820863.269 )# (-37.45, 148.5)
     4792        assert num.allclose(fid.starttime, 0.0) # (-37.45, 148.25)
     4793        assert num.allclose(x_ref, 610120.388) # (-37.45, 148.25)
     4794        assert num.allclose(y_ref,  5820863.269 )# (-37.45, 148.5)
    48264795
    48274796        #Easting:  632145.632  Northing: 5820863.269
     
    48374806        #Latitude:   -37 45 ' 0.00000 ''  Longitude: 148  30 ' 0.00000 ''
    48384807        # magic number - y is close enough for me.
    4839         assert allclose(x[3], 632145.63 - x_ref)
    4840         assert allclose(y[3], 5820863.269  - y_ref + 5.22155314684e-005)
    4841 
    4842         assert allclose(z[0],9000.0 ) #z is elevation info
     4808        assert num.allclose(x[3], 632145.63 - x_ref)
     4809        assert num.allclose(y[3], 5820863.269  - y_ref + 5.22155314684e-005)
     4810
     4811        assert num.allclose(z[0],9000.0 ) #z is elevation info
    48434812        #print "z",z
    48444813        # 2 time steps, 4 points
     
    48474816
    48484817        #(100.0 - -1000.000)*10
    4849         #assert allclose(xmomentum[0][5], 11000.0 )
     4818        #assert num.allclose(xmomentum[0][5], 11000.0 )
    48504819
    48514820        fid.close()
     
    49814950
    49824951        ## 7th test
    4983         m2d = array([[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]])
     4952        m2d = num.array([[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]])
    49844953        kmin, kmax, lmin, lmax = data_manager._get_min_max_indexes(
    49854954            latitudes,longitudes,
     
    50415010        longitudes = [148,149,150,151]
    50425011
    5043         m2d = array([[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]])
     5012        m2d = num.array([[0,1,2,3],[4,5,6,7],[8,9,10,11],[12,13,14,15]])
    50445013
    50455014        # k - lat
     
    53275296        points = gsd.get_data_points(absolute=True)
    53285297       
    5329         assert allclose(points[0][0], 308728.009)
    5330         assert allclose(points[0][1], 6180432.601)
    5331         assert allclose(points[1][0],  222908.705)
    5332         assert allclose(points[1][1], 6233785.284)
     5298        assert num.allclose(points[0][0], 308728.009)
     5299        assert num.allclose(points[0][1], 6180432.601)
     5300        assert num.allclose(points[1][0],  222908.705)
     5301        assert num.allclose(points[1][1], 6233785.284)
    53335302        self.failUnless(gsd.get_geo_reference().get_zone() == 56,
    53345303                        'Bad zone error!')
     
    54335402        points = gsd.get_data_points(absolute=True)
    54345403       
    5435         assert allclose(points[0][0], 115)
    5436         assert allclose(points[0][1], 7)
    5437         assert allclose(points[1][0], 114)
    5438         assert allclose(points[1][1], 8)
    5439         assert allclose(points[2][0], 114.5)
    5440         assert allclose(points[2][1], 9)
     5404        assert num.allclose(points[0][0], 115)
     5405        assert num.allclose(points[0][1], 7)
     5406        assert num.allclose(points[1][0], 114)
     5407        assert num.allclose(points[1][1], 8)
     5408        assert num.allclose(points[2][0], 114.5)
     5409        assert num.allclose(points[2][1], 9)
    54415410        self.failUnless(gsd.get_geo_reference().get_zone() == -1,
    54425411                        'Bad zone error!')
     
    54605429       
    54615430        points = gsd.get_data_points(absolute=True)
    5462         assert allclose(points[0][0], 5.5)
    5463         assert allclose(points[0][1], 0.5)
    5464         assert allclose(points[1][0], 4.5)
    5465         assert allclose(points[1][1], 1.0)
    5466         assert allclose(points[2][0], 4.5)
    5467         assert allclose(points[2][1], 1.5)
     5431        assert num.allclose(points[0][0], 5.5)
     5432        assert num.allclose(points[0][1], 0.5)
     5433        assert num.allclose(points[1][0], 4.5)
     5434        assert num.allclose(points[1][1], 1.0)
     5435        assert num.allclose(points[2][0], 4.5)
     5436        assert num.allclose(points[2][1], 1.5)
    54685437        self.failUnless(gsd.get_geo_reference().get_zone() == -1,
    54695438                        'Bad zone error!')
     
    55085477            quantities_init[i] = ensure_numeric(quantities_init[i])
    55095478            #print "HA_init", HA_init
    5510             q_time = zeros((time_step_count, points_num), Float)
     5479            q_time = num.zeros((time_step_count, points_num), num.Float)
    55115480            for time in range(time_step_count):
    55125481                q_time[time,:] = quantities_init[i] #* time * 4
     
    55925561            quantities_init[i] = ensure_numeric(quantities_init[i])
    55935562            #print "HA_init", HA_init
    5594             q_time = zeros((time_step_count, points_num), Float)
     5563            q_time = num.zeros((time_step_count, points_num), num.Float)
    55955564            for time in range(time_step_count):
    55965565                q_time[time,:] = quantities_init[i] #* time * 4
     
    56985667        zone, e, n = redfearn(-34.5, 150.66667)
    56995668       
    5700         assert allclose(geo_reference.get_absolute([[x[0],y[0]]]), [e,n])
     5669        assert num.allclose(geo_reference.get_absolute([[x[0],y[0]]]), [e,n])
    57015670
    57025671        # Make x and y absolute
     
    57115680        ymomentum = fid.variables['ymomentum'][:]
    57125681        elevation = fid.variables['elevation'][:]
    5713         assert allclose(stage[0,0], e +tide)  #Meters
     5682        assert num.allclose(stage[0,0], e +tide)  #Meters
    57145683
    57155684        #Check the momentums - ua
     
    57235692        #print "answer_x",answer_x
    57245693        #print "actual_x",actual_x
    5725         assert allclose(answer_x, actual_x)  #Meters
     5694        assert num.allclose(answer_x, actual_x)  #Meters
    57265695
    57275696        #Check the momentums - va
     
    57345703        #print "answer_y",answer_y
    57355704        #print "actual_y",actual_y
    5736         assert allclose(answer_y, actual_y)  #Meters
    5737        
    5738         assert allclose(answer_x, actual_x)  #Meters
     5705        assert num.allclose(answer_y, actual_y)  #Meters
     5706       
     5707        assert num.allclose(answer_x, actual_x)  #Meters
    57395708       
    57405709        # check the stage values, first time step.
    57415710        # These arrays are equal since the Easting values were used as
    57425711        # the stage
    5743         assert allclose(stage[0], x +tide)  #Meters
     5712        assert num.allclose(stage[0], x +tide)  #Meters
    57445713
    57455714        # check the elevation values.
     
    57475716        # these arrays are equal since the northing values were used as
    57485717        # the elevation
    5749         assert allclose(-elevation, y)  #Meters
     5718        assert num.allclose(-elevation, y)  #Meters
    57505719       
    57515720        fid.close()
     
    58065775        answer = 115
    58075776        actual = xmomentum[0,0]
    5808         assert allclose(answer, actual)  #Meters^2/ sec
     5777        assert num.allclose(answer, actual)  #Meters^2/ sec
    58095778        answer = 230
    58105779        actual = ymomentum[0,0]
    58115780        #print "answer",answer
    58125781        #print "actual",actual
    5813         assert allclose(answer, actual)  #Meters^2/ sec
     5782        assert num.allclose(answer, actual)  #Meters^2/ sec
    58145783
    58155784        # check the stage values, first time step.
     
    58535822        time = fid.variables['time'][:]
    58545823        #print "time", time
    5855         assert allclose([0.,0.5,1.], time)
     5824        assert num.allclose([0.,0.5,1.], time)
    58565825        assert fid.starttime == 0.0
    58575826        #Check that first coordinate is correctly represented       
     
    58595828        zone, e, n = redfearn(-34.5, 150.66667)       
    58605829       
    5861         assert allclose([x[0],y[0]], [e,n])
     5830        assert num.allclose([x[0],y[0]], [e,n])
    58625831
    58635832       
     
    58675836        ymomentum = fid.variables['ymomentum'][:]
    58685837        elevation = fid.variables['elevation'][:]
    5869         assert allclose(stage[0,0], e +tide)  #Meters
     5838        assert num.allclose(stage[0,0], e +tide)  #Meters
    58705839
    58715840        #Check the momentums - ua
     
    58765845        answer = n*(e+tide+n)
    58775846        actual = xmomentum[0,0]
    5878         assert allclose(answer, actual)  #Meters
     5847        assert num.allclose(answer, actual)  #Meters
    58795848
    58805849        # check the stage values, first time step.
    58815850        # These arrays are equal since the Easting values were used as
    58825851        # the stage
    5883         assert allclose(stage[0], x +tide)  #Meters
     5852        assert num.allclose(stage[0], x +tide)  #Meters
    58845853
    58855854        # check the elevation values.
     
    58875856        # these arrays are equal since the northing values were used as
    58885857        # the elevation
    5889         assert allclose(-elevation, y)  #Meters
     5858        assert num.allclose(-elevation, y)  #Meters
    58905859       
    58915860        fid.close()
     
    59285897        #Work out the UTM coordinates for first point
    59295898        zone, e, n = redfearn(-34.5, 150.66667)
    5930         assert allclose([x[0],y[0]], [e,n])
     5899        assert num.allclose([x[0],y[0]], [e,n])
    59315900
    59325901       
     
    59365905        ymomentum = fid.variables['ymomentum'][:]
    59375906        elevation = fid.variables['elevation'][:]
    5938         assert allclose(stage[0,0], e +tide)  #Meters
     5907        assert num.allclose(stage[0,0], e +tide)  #Meters
    59395908
    59405909        #Check the momentums - ua
     
    59455914        answer = n*(e+tide+n)
    59465915        actual = xmomentum[0,0]
    5947         assert allclose(answer, actual)  #Meters
     5916        assert num.allclose(answer, actual)  #Meters
    59485917
    59495918        # check the stage values, first time step.
    59505919        # These arrays are equal since the Easting values were used as
    59515920        # the stage
    5952         assert allclose(stage[0], x +tide)  #Meters
     5921        assert num.allclose(stage[0], x +tide)  #Meters
    59535922
    59545923        # check the elevation values.
     
    59565925        # these arrays are equal since the northing values were used as
    59575926        # the elevation
    5958         assert allclose(-elevation, y)  #Meters
     5927        assert num.allclose(-elevation, y)  #Meters
    59595928       
    59605929        fid.close()
     
    59845953       
    59855954        time = fid.variables['time'][:]
    5986         assert allclose(time, [0.0]) # the time is relative
     5955        assert num.allclose(time, [0.0]) # the time is relative
    59875956        assert fid.starttime == 0.5
    59885957       
     
    60486017            if ha is None:
    60496018                this_ha = e
    6050                 quantities_init[0].append(ones(time_step_count,Float)*this_ha) # HA
     6019                quantities_init[0].append(num.ones(time_step_count,num.Float)*this_ha) # HA
    60516020            else:
    60526021                quantities_init[0].append(ha[i])
    60536022            if ua is None:
    60546023                this_ua = n
    6055                 quantities_init[1].append(ones(time_step_count,Float)*this_ua) # UA
     6024                quantities_init[1].append(num.ones(time_step_count,num.Float)*this_ua) # UA
    60566025            else:
    60576026                quantities_init[1].append(ua[i])
    60586027            if va is None:
    60596028                this_va = e
    6060                 quantities_init[2].append(ones(time_step_count,Float)*this_va) #
     6029                quantities_init[2].append(num.ones(time_step_count,num.Float)*this_va) #
    60616030            else:
    60626031                quantities_init[2].append(va[i])           
     
    60686037        files = []       
    60696038        for i, q in enumerate(quantities):
    6070             q_time = zeros((time_step_count, points_num), Float)
     6039            q_time = num.zeros((time_step_count, points_num), num.Float)
    60716040            quantities_init[i] = ensure_numeric(quantities_init[i])
    60726041            for time in range(time_step_count):
     
    61376106        lat_long_points =[(-21.5,114.5),(-21,114.5),(-21.5,115), (-21.,115.)]
    61386107        n=len(lat_long_points)
    6139         first_tstep=ones(n,Int)
    6140         last_tstep=time_step_count*ones(n,Int)
    6141         depth=20*ones(n,Float)
    6142         ha=2*ones((n,time_step_count),Float)
    6143         ua=5*ones((n,time_step_count),Float)
    6144         va=-10*ones((n,time_step_count),Float)
     6108        first_tstep=num.ones(n,num.Int)
     6109        last_tstep=time_step_count*num.ones(n,num.Int)
     6110        depth=20*num.ones(n,num.Float)
     6111        ha=2*num.ones((n,time_step_count),num.Float)
     6112        ua=5*num.ones((n,time_step_count),num.Float)
     6113        va=-10*num.ones((n,time_step_count),num.Float)
    61456114        #-ve added to take into account mux file format where south is positive.
    61466115        base_name, files = self.write_mux2(lat_long_points,
     
    61526121                                      va=va)
    61536122
    6154         weights=ones(1, Float)
     6123        weights=num.ones(1, num.Float)
    61556124        #ensure that files are indeed mux2 files
    61566125        times, latitudes, longitudes, elevation, stage, starttime = read_mux2_py([files[0]],weights)
    61576126        ua_times, ua_latitudes, ua_longitudes, ua_elevation, xvelocity,starttime_ua=read_mux2_py([files[1]],weights)
    61586127        msg='ha and ua have different gauge meta data'
    6159         assert allclose(times,ua_times) and allclose(latitudes,ua_latitudes) and allclose(longitudes,ua_longitudes) and allclose(elevation,ua_elevation) and allclose(starttime,starttime_ua), msg
     6128        assert num.allclose(times,ua_times) and num.allclose(latitudes,ua_latitudes) and num.allclose(longitudes,ua_longitudes) and num.allclose(elevation,ua_elevation) and num.allclose(starttime,starttime_ua), msg
    61606129        va_times, va_latitudes, va_longitudes, va_elevation, yvelocity, starttime_va=read_mux2_py([files[2]],weights)
    61616130        msg='ha and va have different gauge meta data'
    6162         assert allclose(times,va_times) and allclose(latitudes,va_latitudes) and allclose(longitudes,va_longitudes) and allclose(elevation,va_elevation) and allclose(starttime,starttime_va), msg
     6131        assert num.allclose(times,va_times) and num.allclose(latitudes,va_latitudes) and num.allclose(longitudes,va_longitudes) and num.allclose(elevation,va_elevation) and num.allclose(starttime,starttime_va), msg
    61636132
    61646133        self.delete_mux(files)
     
    61686137       
    61696138        msg = 'time array is incorrect'
    6170         #assert allclose(times,time_step*arange(1,time_step_count+1)),msg
    6171         assert allclose(times,time_step*arange(time_step_count)), msg
     6139        #assert allclose(times,time_step*num.arange(1,time_step_count+1)),msg
     6140        assert num.allclose(times,time_step*num.arange(time_step_count)), msg
    61726141       
    61736142        msg='Incorrect gauge positions returned'
    61746143        for i,point in enumerate(lat_long_points):
    6175             assert allclose(latitudes[i],point[0]) and allclose(longitudes[i],point[1]),msg
     6144            assert num.allclose(latitudes[i],point[0]) and num.allclose(longitudes[i],point[1]),msg
    61766145
    61776146        msg='Incorrect gauge depths returned'
    6178         assert allclose(elevation,-depth),msg
     6147        assert num.allclose(elevation,-depth),msg
    61796148        msg='incorrect gauge height time series returned'
    6180         assert allclose(stage,ha)
     6149        assert num.allclose(stage,ha)
    61816150        msg='incorrect gauge ua time series returned'
    6182         assert allclose(xvelocity,ua)
     6151        assert num.allclose(xvelocity,ua)
    61836152        msg='incorrect gauge va time series returned'
    6184         assert allclose(yvelocity,va)
     6153        assert num.allclose(yvelocity,va)
    61856154
    61866155    def test_urs2sts_read_mux2_pyII(self):
     
    61926161        lat_long_points =[(-21.5,114.5),(-21,114.5),(-21.5,115), (-21.,115.)]
    61936162        n=len(lat_long_points)
    6194         first_tstep=ones(n,Int)
    6195         last_tstep=(time_step_count)*ones(n,Int)
    6196         depth=20*ones(n,Float)
    6197         ha=2*ones((n,time_step_count),Float)
    6198         ha[0]=arange(0,time_step_count)+1
    6199         ha[1]=time_step_count-arange(1,time_step_count+1)
    6200         ha[1]=arange(time_step_count,2*time_step_count)
    6201         ha[2]=arange(2*time_step_count,3*time_step_count)
    6202         ha[3]=arange(3*time_step_count,4*time_step_count)
    6203         ua=5*ones((n,time_step_count),Float)
    6204         va=-10*ones((n,time_step_count),Float)
     6163        first_tstep=num.ones(n,num.Int)
     6164        last_tstep=(time_step_count)*num.ones(n,num.Int)
     6165        depth=20*num.ones(n,num.Float)
     6166        ha=2*num.ones((n,time_step_count),num.Float)
     6167        ha[0]=num.arange(0,time_step_count)+1
     6168        ha[1]=time_step_count-num.arange(1,time_step_count+1)
     6169        ha[1]=num.arange(time_step_count,2*time_step_count)
     6170        ha[2]=num.arange(2*time_step_count,3*time_step_count)
     6171        ha[3]=num.arange(3*time_step_count,4*time_step_count)
     6172        ua=5*num.ones((n,time_step_count),num.Float)
     6173        va=-10*num.ones((n,time_step_count),num.Float)
    62056174        #-ve added to take into account mux file format where south is positive.
    62066175        base_name, files = self.write_mux2(lat_long_points,
     
    62126181                                      va=va)
    62136182
    6214         weights=ones(1, Float)
     6183        weights=num.ones(1, num.Float)
    62156184        #ensure that files are indeed mux2 files
    62166185        times, latitudes, longitudes, elevation, stage,starttime=read_mux2_py([files[0]],weights)
    62176186        ua_times, ua_latitudes, ua_longitudes, ua_elevation, xvelocity,starttime_ua=read_mux2_py([files[1]],weights)
    62186187        msg='ha and ua have different gauge meta data'
    6219         assert allclose(times,ua_times) and allclose(latitudes,ua_latitudes) and allclose(longitudes,ua_longitudes) and allclose(elevation,ua_elevation) and allclose(starttime,starttime_ua), msg
     6188        assert num.allclose(times,ua_times) and num.allclose(latitudes,ua_latitudes) and num.allclose(longitudes,ua_longitudes) and num.allclose(elevation,ua_elevation) and num.allclose(starttime,starttime_ua), msg
    62206189        va_times, va_latitudes, va_longitudes, va_elevation, yvelocity,starttime_va=read_mux2_py([files[2]],weights)
    62216190        msg='ha and va have different gauge meta data'
    6222         assert allclose(times,va_times) and allclose(latitudes,va_latitudes) and allclose(longitudes,va_longitudes) and allclose(elevation,va_elevation) and allclose(starttime,starttime_va), msg
     6191        assert num.allclose(times,va_times) and num.allclose(latitudes,va_latitudes) and num.allclose(longitudes,va_longitudes) and num.allclose(elevation,va_elevation) and num.allclose(starttime,starttime_va), msg
    62236192
    62246193
     
    62286197        #assert times.shape[0]==time_step_count,msg
    62296198        msg = 'time array is incorrect'
    6230         #assert allclose(times,time_step*arange(1,time_step_count+1)),msg
     6199        #assert allclose(times,time_step*num.arange(1,time_step_count+1)),msg
    62316200        msg='Incorrect gauge positions returned'
    62326201        for i,point in enumerate(lat_long_points):
    6233             assert allclose(latitudes[i],point[0]) and allclose(longitudes[i],point[1]),msg
     6202            assert num.allclose(latitudes[i],point[0]) and num.allclose(longitudes[i],point[1]),msg
    62346203
    62356204        msg='Incorrect gauge depths returned'
    6236         assert allclose(elevation,-depth),msg
     6205        assert num.allclose(elevation,-depth),msg
    62376206        msg='incorrect gauge height time series returned'
    6238         assert allclose(stage,ha)
     6207        assert num.allclose(stage,ha)
    62396208        msg='incorrect gauge ua time series returned'
    6240         assert allclose(xvelocity,ua)
     6209        assert num.allclose(xvelocity,ua)
    62416210        msg='incorrect gauge va time series returned'
    6242         assert allclose(yvelocity,va)
     6211        assert num.allclose(yvelocity,va)
    62436212
    62446213    def test_urs2sts_read_mux2_pyIII(self):
     
    62506219        lat_long_points =[(-21.5,114.5),(-21,114.5),(-21.5,115), (-21.,115.)]
    62516220        n=len(lat_long_points)
    6252         first_tstep=ones(n,Int)
     6221        first_tstep=num.ones(n,num.Int)
    62536222        first_tstep[0]+=1
    62546223        first_tstep[2]+=1
    6255         last_tstep=(time_step_count)*ones(n,Int)
     6224        last_tstep=(time_step_count)*num.ones(n,num.Int)
    62566225        last_tstep[0]-=1
    62576226
    6258         depth=20*ones(n,Float)
    6259         ha=2*ones((n,time_step_count),Float)
    6260         ha[0]=arange(0,time_step_count)
    6261         ha[1]=arange(time_step_count,2*time_step_count)
    6262         ha[2]=arange(2*time_step_count,3*time_step_count)
    6263         ha[3]=arange(3*time_step_count,4*time_step_count)
    6264         ua=5*ones((n,time_step_count),Float)
    6265         va=-10*ones((n,time_step_count),Float)
     6227        depth=20*num.ones(n,num.Float)
     6228        ha=2*num.ones((n,time_step_count),num.Float)
     6229        ha[0]=num.arange(0,time_step_count)
     6230        ha[1]=num.arange(time_step_count,2*time_step_count)
     6231        ha[2]=num.arange(2*time_step_count,3*time_step_count)
     6232        ha[3]=num.arange(3*time_step_count,4*time_step_count)
     6233        ua=5*num.ones((n,time_step_count),num.Float)
     6234        va=-10*num.ones((n,time_step_count),num.Float)
    62666235        #-ve added to take into account mux file format where south is positive.
    62676236        base_name, files = self.write_mux2(lat_long_points,
     
    62736242                                      va=va)
    62746243
    6275         weights=ones(1, Float)
     6244        weights=num.ones(1, num.Float)
    62766245        #ensure that files are indeed mux2 files
    62776246        times, latitudes, longitudes, elevation, stage, starttime=read_mux2_py([files[0]],weights)
    62786247        ua_times, ua_latitudes, ua_longitudes, ua_elevation, xvelocity, starttime_ua=read_mux2_py([files[1]],weights)
    62796248        msg='ha and ua have different gauge meta data'
    6280         assert allclose(times,ua_times) and allclose(latitudes,ua_latitudes) and allclose(longitudes,ua_longitudes) and allclose(elevation,ua_elevation) and allclose(starttime,starttime_ua), msg
     6249        assert num.allclose(times,ua_times) and num.allclose(latitudes,ua_latitudes) and num.allclose(longitudes,ua_longitudes) and num.allclose(elevation,ua_elevation) and num.allclose(starttime,starttime_ua), msg
    62816250        va_times, va_latitudes, va_longitudes, va_elevation, yvelocity,starttime_va=read_mux2_py([files[2]],weights)
    62826251        msg='ha and va have different gauge meta data'
    6283         assert allclose(times,va_times) and allclose(latitudes,va_latitudes) and allclose(longitudes,va_longitudes) and allclose(elevation,va_elevation) and allclose(starttime,starttime_va), msg
     6252        assert num.allclose(times,va_times) and num.allclose(latitudes,va_latitudes) and num.allclose(longitudes,va_longitudes) and num.allclose(elevation,va_elevation) and num.allclose(starttime,starttime_va), msg
    62846253
    62856254        self.delete_mux(files)
     
    62886257        #assert times.shape[0]==time_step_count,msg
    62896258        msg = 'time array is incorrect'
    6290         #assert allclose(times,time_step*arange(1,time_step_count+1)),msg
     6259        #assert allclose(times,time_step*num.arange(1,time_step_count+1)),msg
    62916260        msg='Incorrect gauge positions returned'
    62926261        for i,point in enumerate(lat_long_points):
    6293             assert allclose(latitudes[i],point[0]) and allclose(longitudes[i],point[1]),msg
     6262            assert num.allclose(latitudes[i],point[0]) and num.allclose(longitudes[i],point[1]),msg
    62946263
    62956264
     
    63066275        va[2][0]=0.0;
    63076276        msg='Incorrect gauge depths returned'
    6308         assert allclose(elevation,-depth),msg
     6277        assert num.allclose(elevation,-depth),msg
    63096278        msg='incorrect gauge height time series returned'
    6310         assert allclose(stage,ha)
     6279        assert num.allclose(stage,ha)
    63116280        msg='incorrect gauge ua time series returned'
    6312         assert allclose(xvelocity,ua)
     6281        assert num.allclose(xvelocity,ua)
    63136282        msg='incorrect gauge va time series returned'
    6314         assert allclose(yvelocity,va)
     6283        assert num.allclose(yvelocity,va)
    63156284       
    63166285
     
    63266295        """
    63276296       
    6328         from Numeric import sin, cos
    63296297        from urs_ext import read_mux2
    63306298       
     
    63346302        time_step_count = 10
    63356303        time_step = 0.2
    6336         times_ref = arange(0, time_step_count*time_step, time_step)
     6304        times_ref = num.arange(0, time_step_count*time_step, time_step)
    63376305
    63386306        lat_long_points = [(-21.5,114.5), (-21,114.5), (-21.5,115), (-21.,115.), (-22., 117.)]
     
    63406308       
    63416309        # Create different timeseries starting and ending at different times
    6342         first_tstep=ones(n, Int)
     6310        first_tstep=num.ones(n, num.Int)
    63436311        first_tstep[0]+=2   # Point 0 starts at 2
    63446312        first_tstep[1]+=4   # Point 1 starts at 4       
    63456313        first_tstep[2]+=3   # Point 2 starts at 3
    63466314       
    6347         last_tstep=(time_step_count)*ones(n,Int)
     6315        last_tstep=(time_step_count)*num.ones(n,num.Int)
    63486316        last_tstep[0]-=1    # Point 0 ends 1 step early
    63496317        last_tstep[1]-=2    # Point 1 ends 2 steps early               
     
    63516319       
    63526320        # Create varying elevation data (positive values for seafloor)
    6353         gauge_depth=20*ones(n,Float)
     6321        gauge_depth=20*num.ones(n,num.Float)
    63546322        for i in range(n):
    63556323            gauge_depth[i] += i**2
    63566324           
    63576325        # Create data to be written to first mux file       
    6358         ha0=2*ones((n,time_step_count),Float)
    6359         ha0[0]=arange(0,time_step_count)
    6360         ha0[1]=arange(time_step_count,2*time_step_count)
    6361         ha0[2]=arange(2*time_step_count,3*time_step_count)
    6362         ha0[3]=arange(3*time_step_count,4*time_step_count)
    6363         ua0=5*ones((n,time_step_count),Float)
    6364         va0=-10*ones((n,time_step_count),Float)
     6326        ha0=2*num.ones((n,time_step_count),num.Float)
     6327        ha0[0]=num.arange(0,time_step_count)
     6328        ha0[1]=num.arange(time_step_count,2*time_step_count)
     6329        ha0[2]=num.arange(2*time_step_count,3*time_step_count)
     6330        ha0[3]=num.arange(3*time_step_count,4*time_step_count)
     6331        ua0=5*num.ones((n,time_step_count),num.Float)
     6332        va0=-10*num.ones((n,time_step_count),num.Float)
    63656333
    63666334        # Ensure data used to write mux file to be zero when gauges are
     
    64016369        # For each quantity read the associated list of source mux2 file with
    64026370        # extention associated with that quantity
    6403         file_params=-1*ones(3,Float) #[nsta,dt,nt]
     6371        file_params=-1*num.ones(3,num.Float) #[nsta,dt,nt]
    64046372        OFFSET = 5
    64056373
     
    64136381         
    64146382            for i in range(number_of_selected_stations):
    6415                 if j == 0: assert allclose(data[i][:parameters_index], ha0[permutation[i], :])
    6416                 if j == 1: assert allclose(data[i][:parameters_index], ua0[permutation[i], :])
    6417                 if j == 2: assert allclose(data[i][:parameters_index], va0[permutation[i], :])
     6383                if j == 0: assert num.allclose(data[i][:parameters_index], ha0[permutation[i], :])
     6384                if j == 1: assert num.allclose(data[i][:parameters_index], ua0[permutation[i], :])
     6385                if j == 2: assert num.allclose(data[i][:parameters_index], va0[permutation[i], :])
    64186386       
    64196387
     
    64306398        """
    64316399       
    6432         from Numeric import sin, cos
    64336400        from urs_ext import read_mux2
    64346401       
     
    64416408        time_step = 0.2
    64426409       
    6443         times_ref = arange(0, time_step_count*time_step, time_step)
     6410        times_ref = num.arange(0, time_step_count*time_step, time_step)
    64446411       
    64456412        lat_long_points = [(-21.5,114.5), (-21,114.5), (-21.5,115), (-21.,115.), (-22., 117.)]
     
    64476414       
    64486415        # Create different timeseries starting and ending at different times
    6449         first_tstep=ones(n,Int)
     6416        first_tstep=num.ones(n,num.Int)
    64506417        first_tstep[0]+=2   # Point 0 starts at 2
    64516418        first_tstep[1]+=4   # Point 1 starts at 4       
    64526419        first_tstep[2]+=3   # Point 2 starts at 3
    64536420       
    6454         last_tstep=(time_step_count)*ones(n,Int)
     6421        last_tstep=(time_step_count)*num.ones(n,num.Int)
    64556422        last_tstep[0]-=1    # Point 0 ends 1 step early
    64566423        last_tstep[1]-=2    # Point 1 ends 2 steps early               
     
    64586425       
    64596426        # Create varying elevation data (positive values for seafloor)
    6460         gauge_depth=20*ones(n,Float)
     6427        gauge_depth=20*num.ones(n,num.Float)
    64616428        for i in range(n):
    64626429            gauge_depth[i] += i**2
    64636430           
    64646431        # Create data to be written to second mux file       
    6465         ha1=ones((n,time_step_count),Float)
    6466         ha1[0]=sin(times_ref)
    6467         ha1[1]=2*sin(times_ref - 3)
    6468         ha1[2]=5*sin(4*times_ref)
    6469         ha1[3]=sin(times_ref)
    6470         ha1[4]=sin(2*times_ref-0.7)
     6432        ha1=num.ones((n,time_step_count),num.Float)
     6433        ha1[0]=num.sin(times_ref)
     6434        ha1[1]=2*num.sin(times_ref - 3)
     6435        ha1[2]=5*num.sin(4*times_ref)
     6436        ha1[3]=num.sin(times_ref)
     6437        ha1[4]=num.sin(2*times_ref-0.7)
    64716438               
    6472         ua1=zeros((n,time_step_count),Float)
    6473         ua1[0]=3*cos(times_ref)       
    6474         ua1[1]=2*sin(times_ref-0.7)   
    6475         ua1[2]=arange(3*time_step_count,4*time_step_count)
    6476         ua1[4]=2*ones(time_step_count)
    6477        
    6478         va1=zeros((n,time_step_count),Float)
    6479         va1[0]=2*cos(times_ref-0.87)       
    6480         va1[1]=3*ones(time_step_count)
    6481         va1[3]=2*sin(times_ref-0.71)       
     6439        ua1=num.zeros((n,time_step_count),num.Float)
     6440        ua1[0]=3*num.cos(times_ref)       
     6441        ua1[1]=2*num.sin(times_ref-0.7)   
     6442        ua1[2]=num.arange(3*time_step_count,4*time_step_count)
     6443        ua1[4]=2*num.ones(time_step_count)
     6444       
     6445        va1=num.zeros((n,time_step_count),num.Float)
     6446        va1[0]=2*num.cos(times_ref-0.87)       
     6447        va1[1]=3*num.ones(time_step_count)
     6448        va1[3]=2*num.sin(times_ref-0.71)       
    64826449       
    64836450        # Ensure data used to write mux file to be zero when gauges are
     
    65496516            if ha is None:
    65506517                this_ha = e
    6551                 quantities_init[0].append(ones(time_step_count,Float)*this_ha) # HA
     6518                quantities_init[0].append(num.ones(time_step_count,num.Float)*this_ha) # HA
    65526519            else:
    65536520                quantities_init[0].append(ha[i])
    65546521            if ua is None:
    65556522                this_ua = n
    6556                 quantities_init[1].append(ones(time_step_count,Float)*this_ua) # UA
     6523                quantities_init[1].append(num.ones(time_step_count,num.Float)*this_ua) # UA
    65576524            else:
    65586525                quantities_init[1].append(ua[i])
    65596526            if va is None:
    65606527                this_va = e
    6561                 quantities_init[2].append(ones(time_step_count,Float)*this_va) #
     6528                quantities_init[2].append(num.ones(time_step_count,num.Float)*this_va) #
    65626529            else:
    65636530                quantities_init[2].append(va[i])
     
    65676534            #print i, q
    65686535           
    6569             q_time = zeros((time_step_count, points_num), Float)
     6536            q_time = num.zeros((time_step_count, points_num), num.Float)
    65706537            quantities_init[i] = ensure_numeric(quantities_init[i])
    65716538            for time in range(time_step_count):
     
    66536620        # For each quantity read the associated list of source mux2 file with
    66546621        # extention associated with that quantity
    6655         file_params=-1*ones(3,Float) # [nsta,dt,nt]
     6622        file_params=-1*num.ones(3,num.Float) # [nsta,dt,nt]
    66566623        OFFSET = 5
    66576624
     
    66726639            parameters_index = data.shape[1]-OFFSET         
    66736640                 
    6674             quantity=zeros((number_of_selected_stations, parameters_index), Float)
     6641            quantity=num.zeros((number_of_selected_stations, parameters_index), num.Float)
    66756642           
    66766643           
     
    66816648
    66826649               
    6683                 if j == 0: assert allclose(data[i][:parameters_index], ha1[permutation[i], :])
    6684                 if j == 1: assert allclose(data[i][:parameters_index], ua1[permutation[i], :])
     6650                if j == 0: assert num.allclose(data[i][:parameters_index], ha1[permutation[i], :])
     6651                if j == 1: assert num.allclose(data[i][:parameters_index], ua1[permutation[i], :])
    66856652                if j == 2:
    66866653                    # FIXME (Ole): This is where the output is wrong on Win32
     
    66956662                    #print 'v ', data[i][:parameters_index][8]                   
    66966663               
    6697                     assert allclose(data[i][:parameters_index], va1[permutation[i], :])
     6664                    assert num.allclose(data[i][:parameters_index], va1[permutation[i], :])
    66986665                   
    66996666       
     
    67076674        lat_long_points =[(-21.5,114.5),(-21,114.5),(-21.5,115), (-21.,115.)]
    67086675        n=len(lat_long_points)
    6709         first_tstep=ones(n,Int)
     6676        first_tstep=num.ones(n,num.Int)
    67106677        first_tstep[0]+=1
    67116678        first_tstep[2]+=1
    6712         last_tstep=(time_step_count)*ones(n,Int)
     6679        last_tstep=(time_step_count)*num.ones(n,num.Int)
    67136680        last_tstep[0]-=1
    67146681
    6715         gauge_depth=20*ones(n,Float)
    6716         ha=2*ones((n,time_step_count),Float)
    6717         ha[0]=arange(0,time_step_count)
    6718         ha[1]=arange(time_step_count,2*time_step_count)
    6719         ha[2]=arange(2*time_step_count,3*time_step_count)
    6720         ha[3]=arange(3*time_step_count,4*time_step_count)
    6721         ua=5*ones((n,time_step_count),Float)
    6722         va=-10*ones((n,time_step_count),Float)
     6682        gauge_depth=20*num.ones(n,num.Float)
     6683        ha=2*num.ones((n,time_step_count),num.Float)
     6684        ha[0]=num.arange(0,time_step_count)
     6685        ha[1]=num.arange(time_step_count,2*time_step_count)
     6686        ha[2]=num.arange(2*time_step_count,3*time_step_count)
     6687        ha[3]=num.arange(3*time_step_count,4*time_step_count)
     6688        ua=5*num.ones((n,time_step_count),num.Float)
     6689        va=-10*num.ones((n,time_step_count),num.Float)
    67236690
    67246691        base_name, files = self.write_mux2(lat_long_points,
     
    67566723        for i in range(4):
    67576724            zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1])
    6758             assert allclose([x[i],y[i]], [e,n])
     6725            assert num.allclose([x[i],y[i]], [e,n])
    67596726
    67606727        #Check the time vector
     
    67656732            times_actual.append(time_step * i)
    67666733
    6767         assert allclose(ensure_numeric(times),
    6768                         ensure_numeric(times_actual))
     6734        assert num.allclose(ensure_numeric(times),
     6735                            ensure_numeric(times_actual))
    67696736
    67706737        #Check first value
     
    67866753        va[2][0]=0.0;
    67876754
    6788         assert allclose(transpose(ha),stage)  #Meters
     6755        assert num.allclose(num.transpose(ha),stage)  #Meters
    67896756
    67906757        #Check the momentums - ua
     
    67936760        #momentum = velocity_ua *(stage+depth)
    67946761
    6795         depth=zeros((len(lat_long_points),time_step_count),Float)
     6762        depth=num.zeros((len(lat_long_points),time_step_count),num.Float)
    67966763        for i in range(len(lat_long_points)):
    67976764            depth[i]=gauge_depth[i]+tide+ha[i]
    6798         assert allclose(transpose(ua*depth),xmomentum)
     6765        assert num.allclose(num.transpose(ua*depth),xmomentum)
    67996766
    68006767        #Check the momentums - va
     
    68036770        #momentum = velocity_va *(stage+depth)
    68046771
    6805         assert allclose(transpose(va*depth),ymomentum)
     6772        assert num.allclose(num.transpose(va*depth),ymomentum)
    68066773
    68076774        # check the elevation values.
    68086775        # -ve since urs measures depth, sww meshers height,
    6809         assert allclose(-elevation, gauge_depth)  #Meters
     6776        assert num.allclose(-elevation, gauge_depth)  #Meters
    68106777
    68116778        fid.close()
     
    68226789        lat_long_points =[(-21.,114.5),(-21.,113.5),(-21.,114.), (-21.,115.)]
    68236790        n=len(lat_long_points)
    6824         first_tstep=ones(n,Int)
     6791        first_tstep=num.ones(n,num.Int)
    68256792        first_tstep[0]+=1
    68266793        first_tstep[2]+=1
    6827         last_tstep=(time_step_count)*ones(n,Int)
     6794        last_tstep=(time_step_count)*num.ones(n,num.Int)
    68286795        last_tstep[0]-=1
    68296796
    6830         gauge_depth=20*ones(n,Float)
    6831         ha=2*ones((n,time_step_count),Float)
    6832         ha[0]=arange(0,time_step_count)
    6833         ha[1]=arange(time_step_count,2*time_step_count)
    6834         ha[2]=arange(2*time_step_count,3*time_step_count)
    6835         ha[3]=arange(3*time_step_count,4*time_step_count)
    6836         ua=5*ones((n,time_step_count),Float)
    6837         va=-10*ones((n,time_step_count),Float)
     6797        gauge_depth=20*num.ones(n,num.Float)
     6798        ha=2*num.ones((n,time_step_count),num.Float)
     6799        ha[0]=num.arange(0,time_step_count)
     6800        ha[1]=num.arange(time_step_count,2*time_step_count)
     6801        ha[2]=num.arange(2*time_step_count,3*time_step_count)
     6802        ha[3]=num.arange(3*time_step_count,4*time_step_count)
     6803        ua=5*num.ones((n,time_step_count),num.Float)
     6804        va=-10*num.ones((n,time_step_count),num.Float)
    68386805
    68396806        base_name, files = self.write_mux2(lat_long_points,
     
    68726839        for i in range(4):
    68736840            zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1], zone=50)
    6874             assert allclose([x[i],y[i]], [e,n])
     6841            assert num.allclose([x[i],y[i]], [e,n])
    68756842            assert zone==geo_reference.zone
    68766843
     
    68846851        lat_long_points =[(-21.,113.5),(-21.,114.5),(-21.,114.), (-21.,115.)]
    68856852        n=len(lat_long_points)
    6886         first_tstep=ones(n,Int)
     6853        first_tstep=num.ones(n,num.Int)
    68876854        first_tstep[0]+=1
    68886855        first_tstep[2]+=1
    6889         last_tstep=(time_step_count)*ones(n,Int)
     6856        last_tstep=(time_step_count)*num.ones(n,num.Int)
    68906857        last_tstep[0]-=1
    68916858
    6892         gauge_depth=20*ones(n,Float)
    6893         ha=2*ones((n,time_step_count),Float)
    6894         ha[0]=arange(0,time_step_count)
    6895         ha[1]=arange(time_step_count,2*time_step_count)
    6896         ha[2]=arange(2*time_step_count,3*time_step_count)
    6897         ha[3]=arange(3*time_step_count,4*time_step_count)
    6898         ua=5*ones((n,time_step_count),Float)
    6899         va=-10*ones((n,time_step_count),Float)
     6859        gauge_depth=20*num.ones(n,num.Float)
     6860        ha=2*num.ones((n,time_step_count),num.Float)
     6861        ha[0]=num.arange(0,time_step_count)
     6862        ha[1]=num.arange(time_step_count,2*time_step_count)
     6863        ha[2]=num.arange(2*time_step_count,3*time_step_count)
     6864        ha[3]=num.arange(3*time_step_count,4*time_step_count)
     6865        ua=5*num.ones((n,time_step_count),num.Float)
     6866        va=-10*num.ones((n,time_step_count),num.Float)
    69006867
    69016868        base_name, files = self.write_mux2(lat_long_points,
     
    69346901        for i in range(4):
    69356902            zone, e, n = redfearn(lat_long_points[i][0], lat_long_points[i][1], zone=50)
    6936             assert allclose([x[i],y[i]], [e,n])
     6903            assert num.allclose([x[i],y[i]], [e,n])
    69376904            assert zone==geo_reference.zone
    69386905
     
    69476914        lat_long_points =[(-21.5,114.5),(-21,114.5),(-21.5,115), (-21.,115.)]
    69486915        n=len(lat_long_points)
    6949         first_tstep=ones(n,Int)
     6916        first_tstep=num.ones(n,num.Int)
    69506917        first_tstep[0]+=1
    69516918        first_tstep[2]+=1
    6952         last_tstep=(time_step_count)*ones(n,Int)
     6919        last_tstep=(time_step_count)*num.ones(n,num.Int)
    69536920        last_tstep[0]-=1
    69546921
    6955         gauge_depth=20*ones(n,Float)
    6956         ha=2*ones((n,time_step_count),Float)
    6957         ha[0]=arange(0,time_step_count)
    6958         ha[1]=arange(time_step_count,2*time_step_count)
    6959         ha[2]=arange(2*time_step_count,3*time_step_count)
    6960         ha[3]=arange(3*time_step_count,4*time_step_count)
    6961         ua=5*ones((n,time_step_count),Float)
    6962         va=-10*ones((n,time_step_count),Float)
     6922        gauge_depth=20*num.ones(n,num.Float)
     6923        ha=2*num.ones((n,time_step_count),num.Float)
     6924        ha[0]=num.arange(0,time_step_count)
     6925        ha[1]=num.arange(time_step_count,2*time_step_count)
     6926        ha[2]=num.arange(2*time_step_count,3*time_step_count)
     6927        ha[3]=num.arange(3*time_step_count,4*time_step_count)
     6928        ua=5*num.ones((n,time_step_count),num.Float)
     6929        va=-10*num.ones((n,time_step_count),num.Float)
    69636930
    69646931        # Create two identical mux files to be combined by urs2sts
     
    70076974        #Work out the UTM coordinates for first point
    70086975        zone, e, n = redfearn(lat_long_points[0][0], lat_long_points[0][1])
    7009         assert allclose([x[0],y[0]], [e,n])
     6976        assert num.allclose([x[0],y[0]], [e,n])
    70106977
    70116978        #Check the time vector
     
    70166983            times_actual.append(time_step * i)
    70176984
    7018         assert allclose(ensure_numeric(times),
    7019                         ensure_numeric(times_actual))
     6985        assert num.allclose(ensure_numeric(times),
     6986                            ensure_numeric(times_actual))
    70206987
    70216988        #Check first value
     
    70417008        # in the two mux2 files because both have weights = 1. In this case
    70427009        # the mux2 files are the same so stage == 2.0 * ha
    7043         #print 2.0*transpose(ha) - stage
    7044         assert allclose(2.0*transpose(ha), stage)  #Meters
     7010        #print 2.0*num.transpose(ha) - stage
     7011        assert num.allclose(2.0*num.transpose(ha), stage)  #Meters
    70457012
    70467013        #Check the momentums - ua
     
    70497016        #momentum = velocity_ua *(stage+depth)
    70507017
    7051         depth=zeros((len(lat_long_points),time_step_count),Float)
     7018        depth=num.zeros((len(lat_long_points),time_step_count),num.Float)
    70527019        for i in range(len(lat_long_points)):
    70537020            depth[i]=gauge_depth[i]+tide+2.0*ha[i]
     
    70567023        # The xmomentum stored in the .sts file should be the sum of the ua
    70577024        # in the two mux2 files multiplied by the depth.
    7058         assert allclose(2.0*transpose(ua*depth), xmomentum)
     7025        assert num.allclose(2.0*num.transpose(ua*depth), xmomentum)
    70597026
    70607027        #Check the momentums - va
     
    70657032        # The ymomentum stored in the .sts file should be the sum of the va
    70667033        # in the two mux2 files multiplied by the depth.
    7067         assert allclose(2.0*transpose(va*depth), ymomentum)
     7034        assert num.allclose(2.0*num.transpose(va*depth), ymomentum)
    70687035
    70697036        # check the elevation values.
    70707037        # -ve since urs measures depth, sww meshers height,
    7071         assert allclose(-elevation, gauge_depth)  #Meters
     7038        assert num.allclose(-elevation, gauge_depth)  #Meters
    70727039
    70737040        fid.close()
     
    70817048           over waveheight, easting and northing velocity
    70827049        """
    7083         from Numeric import asarray,transpose,sqrt,argmax,argmin,arange,Float,\
    7084             compress,zeros,fabs,take,size
    70857050       
    70867051        # Get path where this test is run
     
    70937058       
    70947059        # Start times by source and station taken manually from urs header files
    7095         time_start_z = array([[10.0,11.5,13,14.5,17.7],
    7096                               [9.8,11.2,12.7,14.2,17.4],
    7097                               [9.5,10.9,12.4,13.9,17.1]])
     7060        time_start_z = num.array([[10.0,11.5,13,14.5,17.7],
     7061                                  [9.8,11.2,12.7,14.2,17.4],
     7062                                  [9.5,10.9,12.4,13.9,17.1]])
    70987063
    70997064        time_start_e = time_start_n = time_start_z
     
    71377102            msg = 'sts starttime for source %d was %f. Should have been %f'\
    71387103                %(source_number, sts_starttime, starttime)
    7139             assert allclose(sts_starttime, starttime), msg             
     7104            assert num.allclose(sts_starttime, starttime), msg             
    71407105
    71417106            # For each station, compare urs2sts output to known urs output
     
    71837148                msg = 'stage start time from urs file is not the same as the '
    71847149                msg += 'header file for source %i and station %i' %(source_number,j)
    7185                 assert allclose(index_start_urs_z,start_times_z[j]/delta_t), msg
     7150                assert num.allclose(index_start_urs_z,start_times_z[j]/delta_t), msg
    71867151
    71877152                msg = 'e velocity start time from urs file is not the same as the '
    71887153                msg += 'header file for source %i and station %i' %(source_number,j)
    7189                 assert allclose(index_start_urs_e,start_times_e[j]/delta_t), msg
     7154                assert num.allclose(index_start_urs_e,start_times_e[j]/delta_t), msg
    71907155
    71917156                msg = 'n velocity start time from urs file is not the same as the '
    71927157                msg += 'header file for source %i and station %i' %(source_number,j)
    7193                 assert allclose(index_start_urs_n,start_times_n[j]/delta_t), msg
     7158                assert num.allclose(index_start_urs_n,start_times_n[j]/delta_t), msg
    71947159               
    71957160                # get index for start and end time for sts quantities
     
    72187183                # check that urs stage and sts stage are the same
    72197184                msg = 'urs stage is not equal to sts stage for for source %i and station %i' %(source_number,j)
    7220                 assert allclose(urs_stage[index_start_urs_z:index_end_urs_z],
     7185                assert num.allclose(urs_stage[index_start_urs_z:index_end_urs_z],
    72217186                                sts_stage[index_start_stage:index_end_stage],
    72227187                                rtol=1.0e-6, atol=1.0e-5 ), msg                               
     
    72247189                # check that urs e velocity and sts xmomentum are the same
    72257190                msg = 'urs e velocity is not equivalent to sts x momentum for for source %i and station %i' %(source_number,j)
    7226                 assert allclose(urs_e[index_start_urs_e:index_end_urs_e]*(urs_stage[index_start_urs_e:index_end_urs_e]-elevation[j]),
     7191                assert num.allclose(urs_e[index_start_urs_e:index_end_urs_e]*(urs_stage[index_start_urs_e:index_end_urs_e]-elevation[j]),
    72277192                                sts_xmom[index_start_x:index_end_x],
    72287193                                rtol=1.0e-5, atol=1.0e-4 ), msg
     
    72327197                #print 'sts momentum', sts_ymom[index_start_y:index_end_y]                                                             
    72337198                msg = 'urs n velocity is not equivalent to sts y momentum for source %i and station %i' %(source_number,j)
    7234                 assert allclose(urs_n[index_start_urs_n:index_end_urs_n]*(urs_stage[index_start_urs_n:index_end_urs_n]-elevation[j]),
     7199                assert num.allclose(urs_n[index_start_urs_n:index_end_urs_n]*(urs_stage[index_start_urs_n:index_end_urs_n]-elevation[j]),
    72357200                                sts_ymom[index_start_y:index_end_y],
    72367201                                rtol=1.0e-5, atol=1.0e-4 ), msg
     
    72467211           over waveheight, easting and northing velocity
    72477212        """
    7248         from Numeric import asarray,transpose,sqrt,argmax,argmin,arange,Float,\
    7249             compress,zeros,fabs,take,size
    72507213
    72517214        # combined
    7252         time_start_z = array([9.5,10.9,12.4,13.9,17.1])
     7215        time_start_z = num.array([9.5,10.9,12.4,13.9,17.1])
    72537216        time_start_e = time_start_n = time_start_z
    72547217         
     
    72867249        msg = 'Permutation was not stored correctly. I got '
    72877250        msg += str(stored_permutation)
    7288         assert allclose(stored_permutation, permutation), msg       
     7251        assert num.allclose(stored_permutation, permutation), msg       
    72897252
    72907253        # get quantity data from sts file
     
    73037266        msg = 'sts starttime was %f. Should have been %f'\
    73047267            %(sts_starttime, starttime)
    7305         assert allclose(sts_starttime, starttime), msg
     7268        assert num.allclose(sts_starttime, starttime), msg
    73067269   
    73077270        #stations = [1,2,3]
     
    73487311            msg = 'stage start time from urs file is not the same as the '
    73497312            msg += 'header file at station %i' %(j)
    7350             assert allclose(index_start_urs_z,start_times_z/delta_t), msg
     7313            assert num.allclose(index_start_urs_z,start_times_z/delta_t), msg
    73517314
    73527315            msg = 'e velocity start time from urs file is not the same as the '
    73537316            msg += 'header file at station %i' %(j)
    7354             assert allclose(index_start_urs_e,start_times_e/delta_t), msg
     7317            assert num.allclose(index_start_urs_e,start_times_e/delta_t), msg
    73557318
    73567319            msg = 'n velocity start time from urs file is not the same as the '
    73577320            msg += 'header file at station %i' %(j)
    7358             assert allclose(index_start_urs_n,start_times_n/delta_t), msg
     7321            assert num.allclose(index_start_urs_n,start_times_n/delta_t), msg
    73597322               
    73607323            # get index for start and end time for sts quantities
     
    73927355            #print 'diff', max(urs_stage[index_start_urs_z:index_end_urs_z]-sts_stage[index_start_stage:index_end_stage])
    73937356            #print 'index', index_start_stage, index_end_stage, len(sts_stage)
    7394             assert allclose(urs_stage[index_start_urs_z:index_end_urs_z],
     7357            assert num.allclose(urs_stage[index_start_urs_z:index_end_urs_z],
    73957358                            sts_stage[index_start_stage:index_end_stage],
    73967359                                rtol=1.0e-5, atol=1.0e-4 ), msg                               
     
    73987361            # check that urs e velocity and sts xmomentum are the same         
    73997362            msg = 'urs e velocity is not equivalent to sts xmomentum for station %i' %j
    7400             assert allclose(urs_e[index_start_urs_e:index_end_urs_e]*(urs_stage[index_start_urs_e:index_end_urs_e]-elevation[j]),
     7363            assert num.allclose(urs_e[index_start_urs_e:index_end_urs_e]*(urs_stage[index_start_urs_e:index_end_urs_e]-elevation[j]),
    74017364                            sts_xmom[index_start_x:index_end_x],
    74027365                            rtol=1.0e-5, atol=1.0e-4 ), msg
     
    74047367            # check that urs n velocity and sts ymomentum are the same                           
    74057368            msg = 'urs n velocity is not equivalent to sts ymomentum for station %i' %j
    7406             assert allclose(urs_n[index_start_urs_n:index_end_urs_n]*(urs_stage[index_start_urs_n:index_end_urs_n]-elevation[j]),
     7369            assert num.allclose(urs_n[index_start_urs_n:index_end_urs_n]*(urs_stage[index_start_urs_n:index_end_urs_n]-elevation[j]),
    74077370                            sts_ymom[index_start_y:index_end_y],
    74087371                            rtol=1.0e-5, atol=1.0e-4 ), msg
     
    74237386        lat_long_points =[(-21.5,114.5),(-21,114.5),(-21.5,115), (-21.,115.)]
    74247387        n=len(lat_long_points)
    7425         first_tstep=ones(n,Int)
     7388        first_tstep=num.ones(n,num.Int)
    74267389        first_tstep[0]+=1
    74277390        first_tstep[2]+=1
    7428         last_tstep=(time_step_count)*ones(n,Int)
     7391        last_tstep=(time_step_count)*num.ones(n,num.Int)
    74297392        last_tstep[0]-=1
    74307393
    7431         gauge_depth=20*ones(n,Float)
    7432         ha=2*ones((n,time_step_count),Float)
    7433         ha[0]=arange(0,time_step_count)
    7434         ha[1]=arange(time_step_count,2*time_step_count)
    7435         ha[2]=arange(2*time_step_count,3*time_step_count)
    7436         ha[3]=arange(3*time_step_count,4*time_step_count)
    7437         ua=5*ones((n,time_step_count),Float)
    7438         va=-10*ones((n,time_step_count),Float)
     7394        gauge_depth=20*num.ones(n,num.Float)
     7395        ha=2*num.ones((n,time_step_count),num.Float)
     7396        ha[0]=num.arange(0,time_step_count)
     7397        ha[1]=num.arange(time_step_count,2*time_step_count)
     7398        ha[2]=num.arange(2*time_step_count,3*time_step_count)
     7399        ha[3]=num.arange(3*time_step_count,4*time_step_count)
     7400        ua=5*num.ones((n,time_step_count),num.Float)
     7401        va=-10*num.ones((n,time_step_count),num.Float)
    74397402
    74407403        # Create two identical mux files to be combined by urs2sts
     
    74907453        msg = 'Permutation was not stored correctly. I got '
    74917454        msg += str(stored_permutation)
    7492         assert allclose(stored_permutation, permutation), msg
     7455        assert num.allclose(stored_permutation, permutation), msg
    74937456       
    74947457
     
    75157478
    75167479            #print i, [x[i],y[i]], [e,n]
    7517             assert allclose([x[i],y[i]], [e,n])
     7480            assert num.allclose([x[i],y[i]], [e,n])
    75187481           
    75197482                       
     
    75257488            times_actual.append(time_step * i)
    75267489
    7527         assert allclose(ensure_numeric(times),
    7528                         ensure_numeric(times_actual))
     7490        assert num.allclose(ensure_numeric(times),
     7491                            ensure_numeric(times_actual))
    75297492                       
    75307493
     
    75527515        # in the two mux2 files because both have weights = 1. In this case
    75537516        # the mux2 files are the same so stage == 2.0 * ha
    7554         #print 2.0*transpose(ha) - stage
    7555        
    7556         ha_permutation = take(ha, permutation)
    7557         ua_permutation = take(ua, permutation)         
    7558         va_permutation = take(va, permutation)                 
    7559         gauge_depth_permutation = take(gauge_depth, permutation)                         
    7560 
    7561        
    7562         assert allclose(2.0*transpose(ha_permutation)+tide, stage)  # Meters
     7517        #print 2.0*num.transpose(ha) - stage
     7518       
     7519        ha_permutation = num.take(ha, permutation)
     7520        ua_permutation = num.take(ua, permutation)         
     7521        va_permutation = num.take(va, permutation)                 
     7522        gauge_depth_permutation = num.take(gauge_depth, permutation)                         
     7523
     7524       
     7525        assert num.allclose(2.0*num.transpose(ha_permutation)+tide, stage)  # Meters
    75637526
    75647527        #Check the momentums - ua
     
    75677530        #momentum = velocity_ua *(stage+depth)
    75687531
    7569         depth=zeros((len(lat_long_points),time_step_count),Float)
     7532        depth=num.zeros((len(lat_long_points),time_step_count),num.Float)
    75707533        for i in range(len(lat_long_points)):
    75717534            depth[i]=gauge_depth[i]+tide+2.0*ha[i]
    75727535            #2.0*ha necessary because using two files with weights=1 are used
    75737536           
    7574         depth_permutation = take(depth, permutation)                     
     7537        depth_permutation = num.take(depth, permutation)                     
    75757538       
    75767539
    75777540        # The xmomentum stored in the .sts file should be the sum of the ua
    75787541        # in the two mux2 files multiplied by the depth.
    7579         assert allclose(2.0*transpose(ua_permutation*depth_permutation), xmomentum)
     7542        assert num.allclose(2.0*num.transpose(ua_permutation*depth_permutation), xmomentum)
    75807543
    75817544        #Check the momentums - va
     
    75867549        # The ymomentum stored in the .sts file should be the sum of the va
    75877550        # in the two mux2 files multiplied by the depth.
    7588         assert allclose(2.0*transpose(va_permutation*depth_permutation), ymomentum)
     7551        assert num.allclose(2.0*num.transpose(va_permutation*depth_permutation), ymomentum)
    75897552
    75907553        # check the elevation values.
    75917554        # -ve since urs measures depth, sww meshers height,
    7592         assert allclose(-gauge_depth_permutation, elevation)  #Meters
     7555        assert num.allclose(-gauge_depth_permutation, elevation)  #Meters
    75937556
    75947557        fid.close()
     
    76107573        lat_long_points =[(-21.5,114.5),(-21,114.5),(-21.5,115), (-21.,115.)]
    76117574        n=len(lat_long_points)
    7612         first_tstep=ones(n,Int)
     7575        first_tstep=num.ones(n,num.Int)
    76137576        first_tstep[0]+=1
    76147577        first_tstep[2]+=1
    7615         last_tstep=(time_step_count)*ones(n,Int)
     7578        last_tstep=(time_step_count)*num.ones(n,num.Int)
    76167579        last_tstep[0]-=1
    76177580
    7618         gauge_depth=20*ones(n,Float)
    7619         ha=2*ones((n,time_step_count),Float)
    7620         ha[0]=arange(0,time_step_count)
    7621         ha[1]=arange(time_step_count,2*time_step_count)
    7622         ha[2]=arange(2*time_step_count,3*time_step_count)
    7623         ha[3]=arange(3*time_step_count,4*time_step_count)
    7624         ua=5*ones((n,time_step_count),Float)
    7625         va=-10*ones((n,time_step_count),Float)
     7581        gauge_depth=20*num.ones(n,num.Float)
     7582        ha=2*num.ones((n,time_step_count),num.Float)
     7583        ha[0]=num.arange(0,time_step_count)
     7584        ha[1]=num.arange(time_step_count,2*time_step_count)
     7585        ha[2]=num.arange(2*time_step_count,3*time_step_count)
     7586        ha[3]=num.arange(3*time_step_count,4*time_step_count)
     7587        ua=5*num.ones((n,time_step_count),num.Float)
     7588        va=-10*num.ones((n,time_step_count),num.Float)
    76267589
    76277590        # Create two identical mux files to be combined by urs2sts
     
    76797642        """
    76807643       
    7681         from Numeric import sin, cos
    7682                
    76837644        tide = 1.5
    76847645        time_step_count = 10
    76857646        time_step = 0.2
    76867647       
    7687         times_ref = arange(0, time_step_count*time_step, time_step)
     7648        times_ref = num.arange(0, time_step_count*time_step, time_step)
    76887649        #print 'time vector', times_ref
    76897650       
     
    77087669       
    77097670        # Create different timeseries starting and ending at different times
    7710         first_tstep=ones(n,Int)
     7671        first_tstep=num.ones(n,num.Int)
    77117672        first_tstep[0]+=2   # Point 0 starts at 2
    77127673        first_tstep[1]+=4   # Point 1 starts at 4       
    77137674        first_tstep[2]+=3   # Point 2 starts at 3
    77147675       
    7715         last_tstep=(time_step_count)*ones(n,Int)
     7676        last_tstep=(time_step_count)*num.ones(n,num.Int)
    77167677        last_tstep[0]-=1    # Point 0 ends 1 step early
    77177678        last_tstep[1]-=2    # Point 1 ends 2 steps early               
     
    77267687       
    77277688        # Create varying elevation data (positive values for seafloor)
    7728         gauge_depth=20*ones(n,Float)
     7689        gauge_depth=20*num.ones(n,num.Float)
    77297690        for i in range(n):
    77307691            gauge_depth[i] += i**2
     
    77337694       
    77347695        # Create data to be written to first mux file       
    7735         ha0=2*ones((n,time_step_count),Float)
    7736         ha0[0]=arange(0,time_step_count)
    7737         ha0[1]=arange(time_step_count,2*time_step_count)
    7738         ha0[2]=arange(2*time_step_count,3*time_step_count)
    7739         ha0[3]=arange(3*time_step_count,4*time_step_count)
    7740         ua0=5*ones((n,time_step_count),Float)
    7741         va0=-10*ones((n,time_step_count),Float)
     7696        ha0=2*num.ones((n,time_step_count),num.Float)
     7697        ha0[0]=num.arange(0,time_step_count)
     7698        ha0[1]=num.arange(time_step_count,2*time_step_count)
     7699        ha0[2]=num.arange(2*time_step_count,3*time_step_count)
     7700        ha0[3]=num.arange(3*time_step_count,4*time_step_count)
     7701        ua0=5*num.ones((n,time_step_count),num.Float)
     7702        va0=-10*num.ones((n,time_step_count),num.Float)
    77427703
    77437704        # Ensure data used to write mux file to be zero when gauges are
     
    77707731                                             
    77717732        # Create data to be written to second mux file       
    7772         ha1=ones((n,time_step_count),Float)
    7773         ha1[0]=sin(times_ref)
    7774         ha1[1]=2*sin(times_ref - 3)
    7775         ha1[2]=5*sin(4*times_ref)
    7776         ha1[3]=sin(times_ref)
    7777         ha1[4]=sin(2*times_ref-0.7)
     7733        ha1=num.ones((n,time_step_count),num.Float)
     7734        ha1[0]=num.sin(times_ref)
     7735        ha1[1]=2*num.sin(times_ref - 3)
     7736        ha1[2]=5*num.sin(4*times_ref)
     7737        ha1[3]=num.sin(times_ref)
     7738        ha1[4]=num.sin(2*times_ref-0.7)
    77787739               
    7779         ua1=zeros((n,time_step_count),Float)
    7780         ua1[0]=3*cos(times_ref)       
    7781         ua1[1]=2*sin(times_ref-0.7)   
    7782         ua1[2]=arange(3*time_step_count,4*time_step_count)
    7783         ua1[4]=2*ones(time_step_count)
    7784        
    7785         va1=zeros((n,time_step_count),Float)
    7786         va1[0]=2*cos(times_ref-0.87)       
    7787         va1[1]=3*ones(time_step_count)
    7788         va1[3]=2*sin(times_ref-0.71)       
     7740        ua1=num.zeros((n,time_step_count),num.Float)
     7741        ua1[0]=3*num.cos(times_ref)       
     7742        ua1[1]=2*num.sin(times_ref-0.7)   
     7743        ua1[2]=num.arange(3*time_step_count,4*time_step_count)
     7744        ua1[4]=2*num.ones(time_step_count)
     7745       
     7746        va1=num.zeros((n,time_step_count),num.Float)
     7747        va1[0]=2*num.cos(times_ref-0.87)       
     7748        va1[1]=3*num.ones(time_step_count)
     7749        va1[3]=2*num.sin(times_ref-0.71)       
    77897750       
    77907751       
     
    78497810        msg = 'Permutation was not stored correctly. I got '
    78507811        msg += str(stored_permutation)
    7851         assert allclose(stored_permutation, permutation), msg
     7812        assert num.allclose(stored_permutation, permutation), msg
    78527813       
    78537814
     
    78737834
    78747835            #print i, [x[i],y[i]], [e,n]
    7875             assert allclose([x[i],y[i]], [e,n])
     7836            assert num.allclose([x[i],y[i]], [e,n])
    78767837           
    78777838                       
    78787839        # Check the time vector
    78797840        times = fid.variables['time'][:]
    7880         assert allclose(ensure_numeric(times),
    7881                         ensure_numeric(times_ref))
     7841        assert num.allclose(ensure_numeric(times),
     7842                            ensure_numeric(times_ref))
    78827843                       
    78837844
     
    78977858        # quantities written to the mux2 files subject to the permutation vector.
    78987859       
    7899         ha_ref = take(ha0, permutation)
    7900         ua_ref = take(ua0, permutation)       
    7901         va_ref = take(va0, permutation)               
    7902 
    7903         gauge_depth_ref = take(gauge_depth, permutation)                     
    7904        
    7905         assert allclose(transpose(ha_ref)+tide, stage0)  # Meters
     7860        ha_ref = num.take(ha0, permutation)
     7861        ua_ref = num.take(ua0, permutation)       
     7862        va_ref = num.take(va0, permutation)               
     7863
     7864        gauge_depth_ref = num.take(gauge_depth, permutation)                     
     7865       
     7866        assert num.allclose(num.transpose(ha_ref)+tide, stage0)  # Meters
    79067867       
    79077868       
     
    79127873        #momentum = velocity_ua *(stage+depth)
    79137874
    7914         depth_ref = zeros((len(permutation), time_step_count), Float)
     7875        depth_ref = num.zeros((len(permutation), time_step_count), num.Float)
    79157876        for i in range(len(permutation)):
    79167877            depth_ref[i]=gauge_depth_ref[i]+tide+ha_ref[i]
     
    79197880        # The xmomentum stored in the .sts file should be the sum of the ua
    79207881        # in the two mux2 files multiplied by the depth.
    7921         assert allclose(transpose(ua_ref*depth_ref), xmomentum0)
     7882        assert num.allclose(num.transpose(ua_ref*depth_ref), xmomentum0)
    79227883
    79237884        #Check the momentums - va
     
    79327893        #print transpose(va_ref*depth_ref)
    79337894        #print ymomentum
    7934         assert allclose(transpose(va_ref*depth_ref), ymomentum0)       
     7895        assert num.allclose(num.transpose(va_ref*depth_ref), ymomentum0)       
    79357896
    79367897        # check the elevation values.
    79377898        # -ve since urs measures depth, sww meshers height,
    7938         assert allclose(-gauge_depth_ref, elevation0)
     7899        assert num.allclose(-gauge_depth_ref, elevation0)
    79397900
    79407901        fid.close()
     
    79607921        msg = 'Permutation was not stored correctly. I got '
    79617922        msg += str(stored_permutation)
    7962         assert allclose(stored_permutation, permutation), msg
     7923        assert num.allclose(stored_permutation, permutation), msg
    79637924       
    79647925        # Make x and y absolute
     
    79817942
    79827943            #print i, [x[i],y[i]], [e,n]
    7983             assert allclose([x[i],y[i]], [e,n])
     7944            assert num.allclose([x[i],y[i]], [e,n])
    79847945           
    79857946                       
    79867947        # Check the time vector
    79877948        times = fid.variables['time'][:]
    7988         assert allclose(ensure_numeric(times),
    7989                         ensure_numeric(times_ref))
     7949        assert num.allclose(ensure_numeric(times),
     7950                            ensure_numeric(times_ref))
    79907951                       
    79917952
     
    80057966        # quantities written to the mux2 files subject to the permutation vector.
    80067967       
    8007         ha_ref = take(ha1, permutation)
    8008         ua_ref = take(ua1, permutation)       
    8009         va_ref = take(va1, permutation)               
    8010 
    8011         gauge_depth_ref = take(gauge_depth, permutation)                         
     7968        ha_ref = num.take(ha1, permutation)
     7969        ua_ref = num.take(ua1, permutation)       
     7970        va_ref = num.take(va1, permutation)               
     7971
     7972        gauge_depth_ref = num.take(gauge_depth, permutation)                         
    80127973
    80137974
     
    80177978       
    80187979
    8019         assert allclose(transpose(ha_ref)+tide, stage1)  # Meters
     7980        assert num.allclose(num.transpose(ha_ref)+tide, stage1)  # Meters
    80207981        #import sys; sys.exit()
    80217982
     
    80257986        #momentum = velocity_ua *(stage+depth)
    80267987
    8027         depth_ref = zeros((len(permutation), time_step_count), Float)
     7988        depth_ref = num.zeros((len(permutation), time_step_count), num.Float)
    80287989        for i in range(len(permutation)):
    80297990            depth_ref[i]=gauge_depth_ref[i]+tide+ha_ref[i]
     
    80327993        # The xmomentum stored in the .sts file should be the sum of the ua
    80337994        # in the two mux2 files multiplied by the depth.
    8034         assert allclose(transpose(ua_ref*depth_ref), xmomentum1)
     7995        assert num.allclose(num.transpose(ua_ref*depth_ref), xmomentum1)
    80357996
    80367997        #Check the momentums - va
     
    80458006        #print transpose(va_ref*depth_ref)
    80468007        #print ymomentum
    8047         assert allclose(transpose(va_ref*depth_ref), ymomentum1)       
     8008        assert num.allclose(num.transpose(va_ref*depth_ref), ymomentum1)       
    80488009
    80498010        # check the elevation values.
    80508011        # -ve since urs measures depth, sww meshers height,
    8051         assert allclose(-gauge_depth_ref, elevation1)
     8012        assert num.allclose(-gauge_depth_ref, elevation1)
    80528013
    80538014        fid.close()
     
    80918052
    80928053            #print i, [x[i],y[i]], [e,n]
    8093             assert allclose([x[i],y[i]], [e,n])
     8054            assert num.allclose([x[i],y[i]], [e,n])
    80948055           
    80958056                       
    80968057        # Check the time vector
    80978058        times = fid.variables['time'][:]
    8098         assert allclose(ensure_numeric(times),
    8099                         ensure_numeric(times_ref))
     8059        assert num.allclose(ensure_numeric(times),
     8060                            ensure_numeric(times_ref))
    81008061                       
    81018062
     
    81138074        # quantities written to the mux2 files subject to the permutation vector.
    81148075       
    8115         ha_ref = weights[0]*take(ha0, permutation) + weights[1]*take(ha1, permutation)
    8116         ua_ref = weights[0]*take(ua0, permutation) + weights[1]*take(ua1, permutation)       
    8117         va_ref = weights[0]*take(va0, permutation) + weights[1]*take(va1, permutation)               
    8118 
    8119         gauge_depth_ref = take(gauge_depth, permutation)                         
     8076        ha_ref = weights[0]*num.take(ha0, permutation) + weights[1]*num.take(ha1, permutation)
     8077        ua_ref = weights[0]*num.take(ua0, permutation) + weights[1]*num.take(ua1, permutation)       
     8078        va_ref = weights[0]*num.take(va0, permutation) + weights[1]*num.take(va1, permutation)               
     8079
     8080        gauge_depth_ref = num.take(gauge_depth, permutation)                         
    81208081
    81218082
     
    81248085        #print transpose(ha_ref)+tide - stage
    81258086
    8126         assert allclose(transpose(ha_ref)+tide, stage)  # Meters
     8087        assert num.allclose(num.transpose(ha_ref)+tide, stage)  # Meters
    81278088
    81288089        #Check the momentums - ua
     
    81318092        #momentum = velocity_ua *(stage+depth)
    81328093
    8133         depth_ref = zeros((len(permutation), time_step_count), Float)
     8094        depth_ref = num.zeros((len(permutation), time_step_count), num.Float)
    81348095        for i in range(len(permutation)):
    81358096            depth_ref[i]=gauge_depth_ref[i]+tide+ha_ref[i]
     
    81408101        # The xmomentum stored in the .sts file should be the sum of the ua
    81418102        # in the two mux2 files multiplied by the depth.
    8142         assert allclose(transpose(ua_ref*depth_ref), xmomentum)
     8103        assert num.allclose(num.transpose(ua_ref*depth_ref), xmomentum)
    81438104
    81448105        #Check the momentums - va
     
    81548115        #print ymomentum
    81558116
    8156         assert allclose(transpose(va_ref*depth_ref), ymomentum)
     8117        assert num.allclose(num.transpose(va_ref*depth_ref), ymomentum)
    81578118
    81588119        # check the elevation values.
    81598120        # -ve since urs measures depth, sww meshers height,
    8160         assert allclose(-gauge_depth_ref, elevation)  #Meters
     8121        assert num.allclose(-gauge_depth_ref, elevation)  #Meters
    81618122
    81628123        fid.close()
     
    81738134
    81748135        stage_man = weights[0]*(stage0-tide) + weights[1]*(stage1-tide) + tide
    8175         assert allclose(stage_man, stage)
     8136        assert num.allclose(stage_man, stage)
    81768137       
    81778138       
     
    82008161        lat_long_points =bounding_polygon[0:3]
    82018162        n=len(lat_long_points)
    8202         first_tstep=ones(n,Int)
    8203         last_tstep=(time_step_count)*ones(n,Int)
     8163        first_tstep=num.ones(n,num.Int)
     8164        last_tstep=(time_step_count)*num.ones(n,num.Int)
    82048165
    82058166        h = 20       
     
    82078168        u = 10
    82088169        v = -10
    8209         gauge_depth=h*ones(n,Float)
    8210         ha=w*ones((n,time_step_count),Float)
    8211         ua=u*ones((n,time_step_count),Float)
    8212         va=v*ones((n,time_step_count),Float)
     8170        gauge_depth=h*num.ones(n,num.Float)
     8171        ha=w*num.ones((n,time_step_count),num.Float)
     8172        ua=u*num.ones((n,time_step_count),num.Float)
     8173        va=v*num.ones((n,time_step_count),num.Float)
    82138174        base_name, files = self.write_mux2(lat_long_points,
    82148175                                           time_step_count, time_step,
     
    82578218                qd = Bd.evaluate(vol_id, edge_id) # Dirichlet boundary
    82588219
    8259                 assert allclose(qf, qd)
     8220                assert num.allclose(qf, qd)
    82608221               
    82618222       
     
    82638224        finaltime=time_step*(time_step_count-1)
    82648225        yieldstep=time_step
    8265         temp_fbound=zeros(int(finaltime/yieldstep)+1,Float)
     8226        temp_fbound=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    82668227
    82678228        for i, t in enumerate(domain_fbound.evolve(yieldstep=yieldstep,
     
    82808241                if isinstance(B, File_boundary):
    82818242                    #print j, val
    8282                     assert allclose(val, w + tide)
     8243                    assert num.allclose(val, w + tide)
    82838244
    82848245
     
    82958256
    82968257        domain_drchlt.set_boundary({'ocean': Bd,'otherocean': Br})
    8297         temp_drchlt=zeros(int(finaltime/yieldstep)+1,Float)
     8258        temp_drchlt=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    82988259
    82998260        for i, t in enumerate(domain_drchlt.evolve(yieldstep=yieldstep,
     
    83058266        #print domain_drchlt.quantities['stage'].vertex_values
    83068267                   
    8307         assert allclose(temp_fbound,temp_drchlt)
    8308        
    8309         assert allclose(domain_fbound.quantities['stage'].vertex_values,
    8310                         domain_drchlt.quantities['stage'].vertex_values)
     8268        assert num.allclose(temp_fbound,temp_drchlt)
     8269       
     8270        assert num.allclose(domain_fbound.quantities['stage'].vertex_values,
     8271                            domain_drchlt.quantities['stage'].vertex_values)
    83118272                       
    8312         assert allclose(domain_fbound.quantities['xmomentum'].vertex_values,
    8313                         domain_drchlt.quantities['xmomentum'].vertex_values)                       
     8273        assert num.allclose(domain_fbound.quantities['xmomentum'].vertex_values,
     8274                            domain_drchlt.quantities['xmomentum'].vertex_values)                       
    83148275                       
    8315         assert allclose(domain_fbound.quantities['ymomentum'].vertex_values,
    8316                         domain_drchlt.quantities['ymomentum'].vertex_values)                                               
     8276        assert num.allclose(domain_fbound.quantities['ymomentum'].vertex_values,
     8277                            domain_drchlt.quantities['ymomentum'].vertex_values)                                               
    83178278       
    83188279       
     
    83508311        lat_long_points = bounding_polygon[0:3]
    83518312        n=len(lat_long_points)
    8352         first_tstep=ones(n,Int)
    8353         last_tstep=(time_step_count)*ones(n,Int)
     8313        first_tstep=num.ones(n,num.Int)
     8314        last_tstep=(time_step_count)*num.ones(n,num.Int)
    83548315
    83558316        h = 20       
     
    83578318        u = 10
    83588319        v = -10
    8359         gauge_depth=h*ones(n,Float)
    8360         ha=w*ones((n,time_step_count),Float)
    8361         ua=u*ones((n,time_step_count),Float)
    8362         va=v*ones((n,time_step_count),Float)
     8320        gauge_depth=h*num.ones(n,num.Float)
     8321        ha=w*num.ones((n,time_step_count),num.Float)
     8322        ua=u*num.ones((n,time_step_count),num.Float)
     8323        va=v*num.ones((n,time_step_count),num.Float)
    83638324        base_name, files = self.write_mux2(lat_long_points,
    83648325                                           time_step_count, time_step,
     
    84158376                qd = Bd.evaluate(vol_id, edge_id) # Dirichlet boundary
    84168377
    8417                 assert allclose(qf, qd)
     8378                assert num.allclose(qf, qd)
    84188379               
    84198380       
     
    84228383        finaltime = data_finaltime + 10 # Let model time exceed available data
    84238384        yieldstep = time_step
    8424         temp_fbound=zeros(int(finaltime/yieldstep)+1, Float)
     8385        temp_fbound=num.zeros(int(finaltime/yieldstep)+1, num.Float)
    84258386
    84268387        for i, t in enumerate(domain_fbound.evolve(yieldstep=yieldstep,
     
    84398400                if isinstance(B, File_boundary):
    84408401                    #print j, val
    8441                     assert allclose(val, w + tide)
     8402                    assert num.allclose(val, w + tide)
    84428403
    84438404
     
    84548415
    84558416        domain_drchlt.set_boundary({'ocean': Bd,'otherocean': Br})
    8456         temp_drchlt=zeros(int(finaltime/yieldstep)+1,Float)
     8417        temp_drchlt=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    84578418
    84588419        for i, t in enumerate(domain_drchlt.evolve(yieldstep=yieldstep,
     
    84648425        #print domain_drchlt.quantities['stage'].vertex_values
    84658426                   
    8466         assert allclose(temp_fbound,temp_drchlt)
    8467        
    8468         assert allclose(domain_fbound.quantities['stage'].vertex_values,
    8469                         domain_drchlt.quantities['stage'].vertex_values)
     8427        assert num.allclose(temp_fbound,temp_drchlt)
     8428       
     8429        assert num.allclose(domain_fbound.quantities['stage'].vertex_values,
     8430                            domain_drchlt.quantities['stage'].vertex_values)
    84708431                       
    8471         assert allclose(domain_fbound.quantities['xmomentum'].vertex_values,
    8472                         domain_drchlt.quantities['xmomentum'].vertex_values)                       
     8432        assert num.allclose(domain_fbound.quantities['xmomentum'].vertex_values,
     8433                            domain_drchlt.quantities['xmomentum'].vertex_values)                       
    84738434                       
    8474         assert allclose(domain_fbound.quantities['ymomentum'].vertex_values,
    8475                         domain_drchlt.quantities['ymomentum'].vertex_values)                                               
     8435        assert num.allclose(domain_fbound.quantities['ymomentum'].vertex_values,
     8436                            domain_drchlt.quantities['ymomentum'].vertex_values)                                               
    84768437       
    84778438       
     
    85088469        lat_long_points = bounding_polygon[0:3]
    85098470        n=len(lat_long_points)
    8510         first_tstep=ones(n,Int)
    8511         last_tstep=(time_step_count)*ones(n,Int)
     8471        first_tstep=num.ones(n,num.Int)
     8472        last_tstep=(time_step_count)*num.ones(n,num.Int)
    85128473
    85138474        h = 20       
     
    85158476        u = 10
    85168477        v = -10
    8517         gauge_depth=h*ones(n,Float)
    8518         ha=w*ones((n,time_step_count),Float)
    8519         ua=u*ones((n,time_step_count),Float)
    8520         va=v*ones((n,time_step_count),Float)
     8478        gauge_depth=h*num.ones(n,num.Float)
     8479        ha=w*num.ones((n,time_step_count),num.Float)
     8480        ua=u*num.ones((n,time_step_count),num.Float)
     8481        va=v*num.ones((n,time_step_count),num.Float)
    85218482        base_name, files = self.write_mux2(lat_long_points,
    85228483                                           time_step_count, time_step,
     
    85778538               
    85788539                msg = 'Got %s, should have been %s' %(qf, qd)
    8579                 assert allclose(qf, qd), msg
     8540                assert num.allclose(qf, qd), msg
    85808541               
    85818542        # Evolve
     
    85838544        finaltime = data_finaltime + 10 # Let model time exceed available data
    85848545        yieldstep = time_step
    8585         temp_fbound=zeros(int(finaltime/yieldstep)+1, Float)
     8546        temp_fbound=num.zeros(int(finaltime/yieldstep)+1, num.Float)
    85868547
    85878548        for i, t in enumerate(domain_fbound.evolve(yieldstep=yieldstep,
     
    86008561                if isinstance(B, Field_boundary):
    86018562                    msg = 'Got %f should have been %f' %(val, w+tide)
    8602                     assert allclose(val, w + tide), msg
     8563                    assert num.allclose(val, w + tide), msg
    86038564
    86048565
     
    86278588        lat_long_points.insert(0,[6.0,97.01])
    86288589        n=len(lat_long_points)
    8629         first_tstep=ones(n,Int)
    8630         last_tstep=(time_step_count)*ones(n,Int)
    8631         gauge_depth=20*ones(n,Float)
    8632         ha=2*ones((n,time_step_count),Float)
    8633         ua=10*ones((n,time_step_count),Float)
    8634         va=-10*ones((n,time_step_count),Float)
     8590        first_tstep=num.ones(n,num.Int)
     8591        last_tstep=(time_step_count)*num.ones(n,num.Int)
     8592        gauge_depth=20*num.ones(n,num.Float)
     8593        ha=2*num.ones((n,time_step_count),num.Float)
     8594        ua=10*num.ones((n,time_step_count),num.Float)
     8595        va=-10*num.ones((n,time_step_count),num.Float)
    86358596        base_name, files = self.write_mux2(lat_long_points,
    86368597                                           time_step_count,
     
    86748635        finaltime=time_step*(time_step_count-1)
    86758636        yieldstep=time_step
    8676         temp_fbound=zeros(int(finaltime/yieldstep)+1,Float)
     8637        temp_fbound=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    86778638       
    86788639        for i, t in enumerate(domain_fbound.evolve(yieldstep=yieldstep,
     
    86868647        Bd = Dirichlet_boundary([2.0+tide,220+10*tide,-220-10*tide])
    86878648        domain_drchlt.set_boundary({'ocean': Bd,'otherocean': Br})
    8688         temp_drchlt=zeros(int(finaltime/yieldstep)+1,Float)
     8649        temp_drchlt=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    86898650
    86908651        for i, t in enumerate(domain_drchlt.evolve(yieldstep=yieldstep,
     
    86948655
    86958656
    8696         assert allclose(temp_fbound,temp_drchlt)           
     8657        assert num.allclose(temp_fbound,temp_drchlt)           
    86978658           
    86988659        #print domain_fbound.quantities['stage'].vertex_values
     
    87008661                   
    87018662           
    8702         assert allclose(domain_fbound.quantities['stage'].vertex_values,
    8703                         domain_drchlt.quantities['stage'].vertex_values)
     8663        assert num.allclose(domain_fbound.quantities['stage'].vertex_values,
     8664                            domain_drchlt.quantities['stage'].vertex_values)
    87048665                       
    8705         assert allclose(domain_fbound.quantities['xmomentum'].vertex_values,
    8706                         domain_drchlt.quantities['xmomentum'].vertex_values)
     8666        assert num.allclose(domain_fbound.quantities['xmomentum'].vertex_values,
     8667                            domain_drchlt.quantities['xmomentum'].vertex_values)
    87078668                       
    8708         assert allclose(domain_fbound.quantities['ymomentum'].vertex_values,
    8709                         domain_drchlt.quantities['ymomentum'].vertex_values)
     8669        assert num.allclose(domain_fbound.quantities['ymomentum'].vertex_values,
     8670                            domain_drchlt.quantities['ymomentum'].vertex_values)
    87108671           
    87118672           
     
    87338694        time_step = 2
    87348695        n=len(lat_long_points)
    8735         first_tstep=ones(n,Int)
    8736         last_tstep=(time_step_count)*ones(n,Int)
    8737         gauge_depth=20*ones(n,Float)
    8738         ha=2*ones((n,time_step_count),Float)
    8739         ua=10*ones((n,time_step_count),Float)
    8740         va=-10*ones((n,time_step_count),Float)
     8696        first_tstep=num.ones(n,num.Int)
     8697        last_tstep=(time_step_count)*num.ones(n,num.Int)
     8698        gauge_depth=20*num.ones(n,num.Float)
     8699        ha=2*num.ones((n,time_step_count),num.Float)
     8700        ua=10*num.ones((n,time_step_count),num.Float)
     8701        va=-10*num.ones((n,time_step_count),num.Float)
    87418702        base_name, files = self.write_mux2(lat_long_points,
    87428703                                           time_step_count,
     
    88008761            show()
    88018762
    8802         assert allclose(bounding_polygon_utm,boundary_polygon)
     8763        assert num.allclose(bounding_polygon_utm,boundary_polygon)
    88038764
    88048765
     
    88248785        finaltime=time_step*(time_step_count-1)
    88258786        yieldstep=time_step
    8826         temp_fbound=zeros(int(finaltime/yieldstep)+1,Float)
     8787        temp_fbound=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    88278788   
    88288789        for i, t in enumerate(domain_fbound.evolve(yieldstep=yieldstep,
     
    88378798        Bd = Dirichlet_boundary([2.0+tide,220+10*tide,-220-10*tide])
    88388799        domain_drchlt.set_boundary({'ocean': Bd,'otherocean': Br})
    8839         temp_drchlt=zeros(int(finaltime/yieldstep)+1,Float)
     8800        temp_drchlt=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    88408801       
    88418802        for i, t in enumerate(domain_drchlt.evolve(yieldstep=yieldstep,
     
    88488809        #print domain_drchlt.quantities['stage'].vertex_values
    88498810                   
    8850         assert allclose(temp_fbound,temp_drchlt)
    8851 
    8852        
    8853         assert allclose(domain_fbound.quantities['stage'].vertex_values,
    8854                         domain_drchlt.quantities['stage'].vertex_values)
     8811        assert num.allclose(temp_fbound,temp_drchlt)
     8812
     8813       
     8814        assert num.allclose(domain_fbound.quantities['stage'].vertex_values,
     8815                            domain_drchlt.quantities['stage'].vertex_values)
    88558816                       
    8856         assert allclose(domain_fbound.quantities['xmomentum'].vertex_values,
    8857                         domain_drchlt.quantities['xmomentum'].vertex_values)                       
     8817        assert num.allclose(domain_fbound.quantities['xmomentum'].vertex_values,
     8818                            domain_drchlt.quantities['xmomentum'].vertex_values)                       
    88588819                       
    8859         assert allclose(domain_fbound.quantities['ymomentum'].vertex_values,
    8860                         domain_drchlt.quantities['ymomentum'].vertex_values)
     8820        assert num.allclose(domain_fbound.quantities['ymomentum'].vertex_values,
     8821                            domain_drchlt.quantities['ymomentum'].vertex_values)
    88618822       
    88628823        # Use known Dirichlet condition (if sufficient timesteps have been taken)
     
    88928853        from anuga.pmesh.mesh_interface import create_mesh_from_regions
    88938854
    8894         from Numeric import sin, cos
    8895 
    88968855        lat_long_points=[[6.01,97.0],[6.02,97.0],[6.05,96.9],[6.0,97.0]]
    88978856        bounding_polygon=[[6.0,97.0],[6.01,97.0],[6.02,97.0],[6.02,97.02],[6.00,97.02]]
     
    88998858        time_step_count = 50
    89008859        time_step = 0.1
    8901         times_ref = arange(0, time_step_count*time_step, time_step)
     8860        times_ref = num.arange(0, time_step_count*time_step, time_step)
    89028861       
    89038862        n=len(lat_long_points)
    8904         first_tstep=ones(n,Int)
    8905         last_tstep=(time_step_count)*ones(n,Int)
    8906        
    8907         gauge_depth=20*ones(n,Float)
    8908        
    8909         ha1=ones((n,time_step_count),Float)
    8910         ua1=3.*ones((n,time_step_count),Float)
    8911         va1=2.*ones((n,time_step_count),Float)
     8863        first_tstep=num.ones(n,num.Int)
     8864        last_tstep=(time_step_count)*num.ones(n,num.Int)
     8865       
     8866        gauge_depth=20*num.ones(n,num.Float)
     8867       
     8868        ha1=num.ones((n,time_step_count),num.Float)
     8869        ua1=3.*num.ones((n,time_step_count),num.Float)
     8870        va1=2.*num.ones((n,time_step_count),num.Float)
    89128871        for i in range(n):
    8913             ha1[i]=sin(times_ref)
     8872            ha1[i]=num.sin(times_ref)
    89148873       
    89158874       
     
    89978956            show()
    89988957
    8999         assert allclose(bounding_polygon_utm,boundary_polygon)
     8958        assert num.allclose(bounding_polygon_utm,boundary_polygon)
    90008959
    90018960
     
    90248983        finaltime=time_step*(time_step_count-1)
    90258984        yieldstep=time_step
    9026         temp_fbound=zeros(int(finaltime/yieldstep)+1,Float)
     8985        temp_fbound=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    90278986   
    90288987        for i, t in enumerate(domain_fbound.evolve(yieldstep=yieldstep,
     
    90368995        Br = Reflective_boundary(domain_time)
    90378996        Bw=Time_boundary(domain=domain_time,
    9038                          f=lambda t: [sin(t)+tide,3.*(20.+sin(t)+tide),2.*(20.+sin(t)+tide)])
     8997                         f=lambda t: [num.sin(t)+tide,3.*(20.+num.sin(t)+tide),2.*(20.+num.sin(t)+tide)])
    90398998        domain_time.set_boundary({'ocean': Bw,'otherocean': Br})
    90408999       
    9041         temp_time=zeros(int(finaltime/yieldstep)+1,Float)
     9000        temp_time=num.zeros(int(finaltime/yieldstep)+1,num.Float)
    90429001        for i, t in enumerate(domain_time.evolve(yieldstep=yieldstep,
    90439002                                                   finaltime=finaltime,
     
    90539012        #print domain_time.quantities['stage'].vertex_values
    90549013       
    9055         assert allclose(temp_fbound, temp_time)               
    9056         assert allclose(domain_fbound.quantities['stage'].vertex_values,
    9057                         domain_time.quantities['stage'].vertex_values)
     9014        assert num.allclose(temp_fbound, temp_time)               
     9015        assert num.allclose(domain_fbound.quantities['stage'].vertex_values,
     9016                            domain_time.quantities['stage'].vertex_values)
    90589017                       
    9059         assert allclose(domain_fbound.quantities['xmomentum'].vertex_values,
    9060                         domain_time.quantities['xmomentum'].vertex_values)                       
     9018        assert num.allclose(domain_fbound.quantities['xmomentum'].vertex_values,
     9019                            domain_time.quantities['xmomentum'].vertex_values)                       
    90619020                       
    9062         assert allclose(domain_fbound.quantities['ymomentum'].vertex_values,
    9063                         domain_time.quantities['ymomentum'].vertex_values)                                               
     9021        assert num.allclose(domain_fbound.quantities['ymomentum'].vertex_values,
     9022                            domain_time.quantities['ymomentum'].vertex_values)                                               
    90649023       
    90659024
     
    91869145            found = False
    91879146            for result in results:
    9188                 if allclose(point, result):
     9147                if num.allclose(point, result):
    91899148                    found = True
    91909149                    break
     
    92789237            found = False
    92799238            for result in results:
    9280                 if allclose(point, result):
     9239                if num.allclose(point, result):
    92819240                    found = True
    92829241                    break
     
    93549313            for lat_lon, dep in map(None, lat_long_points, urs.lonlatdep):
    93559314                    _ , e, n = redfearn(lat_lon[0], lat_lon[1])
    9356                     assert allclose(n, dep[2])
     9315                    assert num.allclose(n, dep[2])
    93579316                       
    93589317            count = 0
     
    93679326                    if file[-5:] == WAVEHEIGHT_MUX_LABEL[-5:] or \
    93689327                           file[-5:] == NORTH_VELOCITY_LABEL[-5:] :
    9369                         assert allclose(e, quantity)
     9328                        assert num.allclose(e, quantity)
    93709329                    if file[-5:] == EAST_VELOCITY_LABEL[-5:]:
    9371                         assert allclose(n, quantity)
     9330                        assert num.allclose(n, quantity)
    93729331            assert count == time_step_count
    93739332                     
     
    94079366        #Work out the UTM coordinates for first point
    94089367        zone, e, n = redfearn(lat_long[0][0], lat_long[0][1])
    9409         assert allclose([x[0],y[0]], [e,n])
     9368        assert num.allclose([x[0],y[0]], [e,n])
    94109369
    94119370        #Check the time vector
     
    94169375            times_actual.append(time_step * i)
    94179376       
    9418         assert allclose(ensure_numeric(times),
    9419                         ensure_numeric(times_actual))
     9377        assert num.allclose(ensure_numeric(times),
     9378                            ensure_numeric(times_actual))
    94209379       
    94219380        #Check first value
     
    94249383        ymomentum = fid.variables['ymomentum'][:]
    94259384        elevation = fid.variables['elevation'][:]
    9426         assert allclose(stage[0,0], e +tide)  #Meters
     9385        assert num.allclose(stage[0,0], e +tide)  #Meters
    94279386
    94289387
     
    94379396        #print "answer_x",answer_x
    94389397        #print "actual_x",actual_x
    9439         assert allclose(answer_x, actual_x)  #Meters
     9398        assert num.allclose(answer_x, actual_x)  #Meters
    94409399       
    94419400        #Check the momentums - va
     
    94499408        #print "answer_y",answer_y
    94509409        #print "actual_y",actual_y
    9451         assert allclose(answer_y, actual_y)  #Meters
     9410        assert num.allclose(answer_y, actual_y)  #Meters
    94529411
    94539412        # check the stage values, first time step.
    94549413        # These arrays are equal since the Easting values were used as
    94559414        # the stage
    9456         assert allclose(stage[0], x +tide)  #Meters
     9415        assert num.allclose(stage[0], x +tide)  #Meters
    94579416        # check the elevation values.
    94589417        # -ve since urs measures depth, sww meshers height,
    94599418        # these arrays are equal since the northing values were used as
    94609419        # the elevation
    9461         assert allclose(-elevation, y)  #Meters
     9420        assert num.allclose(-elevation, y)  #Meters
    94629421       
    94639422        fid.close()
     
    94999458        #Work out the UTM coordinates for first point
    95009459        zone, e, n = redfearn(lat_long[0][0], lat_long[0][1])
    9501         assert allclose([x[0],y[0]], [e,n])
     9460        assert num.allclose([x[0],y[0]], [e,n])
    95029461
    95039462        #Check the time vector
     
    95089467            times_actual.append(time_step * i)
    95099468       
    9510         assert allclose(ensure_numeric(times),
    9511                         ensure_numeric(times_actual))
     9469        assert num.allclose(ensure_numeric(times),
     9470                            ensure_numeric(times_actual))
    95129471       
    95139472        #Check first value
     
    95169475        ymomentum = fid.variables['ymomentum'][:]
    95179476        elevation = fid.variables['elevation'][:]
    9518         assert allclose(stage[0,0], e +tide)  #Meters
     9477        assert num.allclose(stage[0,0], e +tide)  #Meters
    95199478
    95209479        #Check the momentums - ua
     
    95289487        #print "answer_x",answer_x
    95299488        #print "actual_x",actual_x
    9530         assert allclose(answer_x, actual_x)  #Meters
     9489        assert num.allclose(answer_x, actual_x)  #Meters
    95319490       
    95329491        #Check the momentums - va
     
    95409499        #print "answer_y",answer_y
    95419500        #print "actual_y",actual_y
    9542         assert allclose(answer_y, actual_y)  #Meters
     9501        assert num.allclose(answer_y, actual_y)  #Meters
    95439502
    95449503        # check the stage values, first time step.
    95459504        # These arrays are equal since the Easting values were used as
    95469505        # the stage
    9547         assert allclose(stage[0], x +tide)  #Meters
     9506        assert num.allclose(stage[0], x +tide)  #Meters
    95489507        # check the elevation values.
    95499508        # -ve since urs measures depth, sww meshers height,
    95509509        # these arrays are equal since the northing values were used as
    95519510        # the elevation
    9552         assert allclose(-elevation, y)  #Meters
     9511        assert num.allclose(-elevation, y)  #Meters
    95539512       
    95549513        fid.close()
     
    95899548        #Work out the UTM coordinates for first point
    95909549        zone, e, n = redfearn(lat_long[0][0], lat_long[0][1])
    9591         assert allclose([x[0],y[0]], [e,n])
     9550        assert num.allclose([x[0],y[0]], [e,n])
    95929551
    95939552        #Check the time vector
     
    95989557            times_actual.append(time_step * i)
    95999558       
    9600         assert allclose(ensure_numeric(times),
    9601                         ensure_numeric(times_actual))
     9559        assert num.allclose(ensure_numeric(times),
     9560                            ensure_numeric(times_actual))
    96029561       
    96039562        #Check first value
     
    96069565        ymomentum = fid.variables['ymomentum'][:]
    96079566        elevation = fid.variables['elevation'][:]
    9608         assert allclose(stage[0,0], e +tide)  #Meters
     9567        assert num.allclose(stage[0,0], e +tide)  #Meters
    96099568
    96109569        #Check the momentums - ua
     
    96189577        #print "answer_x",answer_x
    96199578        #print "actual_x",actual_x
    9620         assert allclose(answer_x, actual_x)  #Meters
     9579        assert num.allclose(answer_x, actual_x)  #Meters
    96219580       
    96229581        #Check the momentums - va
     
    96309589        #print "answer_y",answer_y
    96319590        #print "actual_y",actual_y
    9632         assert allclose(answer_y, actual_y)  #Meters
     9591        assert num.allclose(answer_y, actual_y)  #Meters
    96339592
    96349593        # check the stage values, first time step.
    96359594        # These arrays are equal since the Easting values were used as
    96369595        # the stage
    9637         assert allclose(stage[0], x +tide)  #Meters
     9596        assert num.allclose(stage[0], x +tide)  #Meters
    96389597        # check the elevation values.
    96399598        # -ve since urs measures depth, sww meshers height,
    96409599        # these arrays are equal since the northing values were used as
    96419600        # the elevation
    9642         assert allclose(-elevation, y)  #Meters
     9601        assert num.allclose(-elevation, y)  #Meters
    96439602       
    96449603        fid.close()
     
    96929651        number_of_volumes = fid.variables['volumes']
    96939652        #print "number_of_volumes",len(number_of_volumes)
    9694         assert allclose(16, len(number_of_volumes))
     9653        assert num.allclose(16, len(number_of_volumes))
    96959654       
    96969655        fid.close()
     
    97459704        volumes_again = fid.variables['volumes']
    97469705        #print "number_of_volumes",len(volumes_again)
    9747         assert allclose(len(volumes_again),
    9748                         len(volumes))
     9706        assert num.allclose(len(volumes_again),
     9707                            len(volumes))
    97499708        fid.close()
    97509709        os.remove(sww_file)
     
    97859744        #Work out the UTM coordinates for first point
    97869745        zone, e, n = redfearn(lat_long[0][0], lat_long[0][1])
    9787         assert allclose([x[0],y[0]], [e,n])
     9746        assert num.allclose([x[0],y[0]], [e,n])
    97889747
    97899748        #Check the time vector
     
    97929751        times_actual = [0,100,200,300]
    97939752       
    9794         assert allclose(ensure_numeric(times),
    9795                         ensure_numeric(times_actual))
     9753        assert num.allclose(ensure_numeric(times),
     9754                            ensure_numeric(times_actual))
    97969755       
    97979756               #Check first value
     
    98009759        ymomentum = fid.variables['ymomentum'][:]
    98019760        elevation = fid.variables['elevation'][:]
    9802         assert allclose(stage[0,0], e +tide)  #Meters
     9761        assert num.allclose(stage[0,0], e +tide)  #Meters
    98039762
    98049763        #Check the momentums - ua
     
    98129771        #print "answer_x",answer_x
    98139772        #print "actual_x",actual_x
    9814         assert allclose(answer_x, actual_x)  #Meters
     9773        assert num.allclose(answer_x, actual_x)  #Meters
    98159774       
    98169775        #Check the momentums - va
     
    98249783        #print "answer_y",answer_y
    98259784        #print "actual_y",actual_y
    9826         assert allclose(answer_y, actual_y)  #Meters
     9785        assert num.allclose(answer_y, actual_y)  #Meters
    98279786
    98289787        # check the stage values, first time step.
    98299788        # These arrays are equal since the Easting values were used as
    98309789        # the stage
    9831         assert allclose(stage[0], x +tide)  #Meters
     9790        assert num.allclose(stage[0], x +tide)  #Meters
    98329791        # check the elevation values.
    98339792        # -ve since urs measures depth, sww meshers height,
    98349793        # these arrays are equal since the northing values were used as
    98359794        # the elevation
    9836         assert allclose(-elevation, y)  #Meters
     9795        assert num.allclose(-elevation, y)  #Meters
    98379796       
    98389797        fid.close()
     
    98739832       
    98749833        times_actual = [0,100,200,300,400,500]
    9875         assert allclose(ensure_numeric(times),
    9876                         ensure_numeric(times_actual))
     9834        assert num.allclose(ensure_numeric(times),
     9835                            ensure_numeric(times_actual))
    98779836       
    98789837        #Check first value
    98799838        stage = fid.variables['stage'][:]
    9880         assert allclose(stage[0], x +tide)
     9839        assert num.allclose(stage[0], x +tide)
    98819840       
    98829841        fid.close()
     
    100089967        filename = tempfile.mktemp("_data_manager.sww")
    100099968        outfile = NetCDFFile(filename, netcdf_mode_w)
    10010         points_utm = array([[0.,0.],[1.,1.], [0.,1.]])
     9969        points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]])
    100119970        volumes = (0,1,2)
    100129971        elevation = [0,1,2]
     
    100199978        sww.store_header(outfile, times, number_of_volumes,
    100209979                         number_of_points, description='fully sick testing',
    10021                          verbose=self.verbose,sww_precision=Float)
     9980                         verbose=self.verbose,sww_precision=num.Float)
    100229981        sww.store_triangulation(outfile, points_utm, volumes,
    100239982                                elevation,  new_origin=new_origin,
     
    100309989        fid.close()
    100319990
    10032         assert allclose(array(map(None, x,y)), points_utm)
     9991        assert num.allclose(num.array(map(None, x,y)), points_utm)
    100339992        os.remove(filename)
    100349993
     
    100409999        filename = tempfile.mktemp("_data_manager.sww")
    1004110000        outfile = NetCDFFile(filename, netcdf_mode_w)
    10042         points_utm = array([[0.,0.],[1.,1.], [0.,1.]])
     10001        points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]])
    1004310002        volumes = (0,1,2)
    1004410003        elevation = [0,1,2]
     
    1005110010        sww.store_header(outfile, times, number_of_volumes,
    1005210011                         number_of_points, description='fully sick testing',
    10053                          verbose=self.verbose,sww_precision=Float)
     10012                         verbose=self.verbose,sww_precision=num.Float)
    1005410013        sww.store_triangulation(outfile, points_utm, volumes,
    1005510014                                elevation,  new_origin=new_origin,
     
    1006510024        fid.close()
    1006610025
    10067         assert allclose(array(map(None, x,y)), points_utm)
     10026        assert num.allclose(num.array(map(None, x,y)), points_utm)
    1006810027        os.remove(filename)
    1006910028
     
    1007510034        filename = tempfile.mktemp("_data_manager.sww")
    1007610035        outfile = NetCDFFile(filename, netcdf_mode_w)
    10077         points_utm = array([[0.,0.],[1.,1.], [0.,1.]])
     10036        points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]])
    1007810037        volumes = (0,1,2)
    1007910038        elevation = [0,1,2]
     
    1008710046        sww.store_header(outfile, times, number_of_volumes,
    1008810047                         number_of_points, description='fully sick testing',
    10089                          verbose=self.verbose,sww_precision=Float)
     10048                         verbose=self.verbose,sww_precision=num.Float)
    1009010049        sww.store_triangulation(outfile, points_utm, volumes,
    1009110050                                elevation,  new_origin=new_origin,
     
    1010210061
    1010310062        absolute = Geo_reference(56, 0,0)
    10104         assert allclose(array( \
     10063        assert num.allclose(num.array(
    1010510064            absolute.change_points_geo_ref(map(None, x,y),
    1010610065                                           new_origin)),points_utm)
     
    1011410073        filename = tempfile.mktemp("_data_manager.sww")
    1011510074        outfile = NetCDFFile(filename, netcdf_mode_w)
    10116         points_utm = array([[0.,0.],[1.,1.], [0.,1.]])
     10075        points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]])
    1011710076        volumes = (0,1,2)
    1011810077        elevation = [0,1,2]
     
    1012610085        sww.store_header(outfile, times, number_of_volumes,
    1012710086                         number_of_points, description='fully sick testing',
    10128                          verbose=self.verbose,sww_precision=Float)
     10087                         verbose=self.verbose,sww_precision=num.Float)
    1012910088        sww.store_triangulation(outfile, points_utm, volumes,
    1013010089                                elevation,  new_origin=new_origin,
     
    1014110100        fid.close()
    1014210101
    10143         assert allclose(array(map(None, x,y)), points_utm)
     10102        assert num.allclose(num.array(map(None, x,y)), points_utm)
    1014410103        os.remove(filename)
    1014510104       
     
    1015010109        filename = tempfile.mktemp("_data_manager.sww")
    1015110110        outfile = NetCDFFile(filename, netcdf_mode_w)
    10152         points_utm = array([[0.,0.],[1.,1.], [0.,1.]])
     10111        points_utm = num.array([[0.,0.],[1.,1.], [0.,1.]])
    1015310112        volumes = (0,1,2)
    1015410113        elevation = [0,1,2]
     
    1016210121        sww.store_header(outfile, times, number_of_volumes,
    1016310122                         number_of_points, description='fully sick testing',
    10164                          verbose=self.verbose,sww_precision=Float)
     10123                         verbose=self.verbose,sww_precision=num.Float)
    1016510124        sww.store_triangulation(outfile, points_utm, volumes,
    1016610125                                elevation,  new_origin=new_origin,
     
    1017910138
    1018010139        absolute = Geo_reference(56, 0,0)
    10181         assert allclose(array( \
     10140        assert num.allclose(num.array(
    1018210141            absolute.change_points_geo_ref(map(None, x,y),
    1018310142                                           new_origin)),points_utm)
     
    1020310162        os.remove(fileName)
    1020410163       
    10205         assert allclose(x[:,0], [1.0, 0.0,4.0, 1.0])
     10164        assert num.allclose(x[:,0], [1.0, 0.0,4.0, 1.0])
    1020610165       
    1020710166    def test_get_data_from_file1(self):
     
    1022510184#        print '1x',x[:,0]
    1022610185       
    10227         assert allclose(x[:,0], [1.3, 0.0,4.5, 1.0])
     10186        assert num.allclose(x[:,0], [1.3, 0.0,4.5, 1.0])
    1022810187       
    1022910188    def test_store_parameters(self):
     
    1040710366
    1040810367        import time, os
    10409         from Numeric import array, zeros, allclose, Float, concatenate
    1041010368        from Scientific.IO.NetCDF import NetCDFFile
    1041110369
     
    1045310411        location = get_maximum_inundation_location(swwfile)
    1045410412        #print 'Runup, location', runup, location
    10455         assert allclose(runup, 11) or allclose(runup, 12) # old limiters
    10456         assert allclose(location[0], 15) or allclose(location[0], 10)
     10413        assert num.allclose(runup, 11) or num.allclose(runup, 12) # old limiters
     10414        assert num.allclose(location[0], 15) or num.allclose(location[0], 10)
    1045710415
    1045810416        # Check final runup
     
    1046010418        location = get_maximum_inundation_location(swwfile, time_interval=[45,50])
    1046110419        # print 'Runup, location:',runup, location       
    10462         assert allclose(runup, 1)
    10463         assert allclose(location[0], 65)
     10420        assert num.allclose(runup, 1)
     10421        assert num.allclose(location[0], 65)
    1046410422
    1046510423        # Check runup restricted to a polygon
     
    1046810426        location = get_maximum_inundation_location(swwfile, polygon=p)
    1046910427        #print runup, location       
    10470         assert allclose(runup, 4)
    10471         assert allclose(location[0], 50)               
     10428        assert num.allclose(runup, 4)
     10429        assert num.allclose(location[0], 50)               
    1047210430
    1047310431        # Check that mimimum_storable_height works
     
    1051210470        runup = get_maximum_inundation_elevation(swwfile)
    1051310471        location = get_maximum_inundation_location(swwfile)
    10514         assert allclose(runup, 11) or allclose(runup, 12) # old limiters
    10515         assert allclose(location[0], 15+E) or allclose(location[0], 10+E)
     10472        assert num.allclose(runup, 11) or num.allclose(runup, 12) # old limiters
     10473        assert num.allclose(location[0], 15+E) or num.allclose(location[0], 10+E)
    1051610474
    1051710475        # Check final runup
    1051810476        runup = get_maximum_inundation_elevation(swwfile, time_interval=[45,50])
    1051910477        location = get_maximum_inundation_location(swwfile, time_interval=[45,50])
    10520         assert allclose(runup, 1)
    10521         assert allclose(location[0], 65+E)
     10478        assert num.allclose(runup, 1)
     10479        assert num.allclose(location[0], 65+E)
    1052210480
    1052310481        # Check runup restricted to a polygon
    10524         p = array([[50,1], [99,1], [99,49], [50,49]]) + array([E, N])
     10482        p = num.array([[50,1], [99,1], [99,49], [50,49]]) + num.array([E, N])
    1052510483
    1052610484        runup = get_maximum_inundation_elevation(swwfile, polygon=p)
    1052710485        location = get_maximum_inundation_location(swwfile, polygon=p)
    10528         assert allclose(runup, 4)
    10529         assert allclose(location[0], 50+E)               
     10486        assert num.allclose(runup, 4)
     10487        assert num.allclose(location[0], 50+E)               
    1053010488
    1053110489
     
    1054110499       
    1054210500        import time, os
    10543         from Numeric import array, zeros, allclose, Float, concatenate
    1054410501        from Scientific.IO.NetCDF import NetCDFFile
    1054510502
     
    1058310540
    1058410541        # Check that mesh has been recovered
    10585         assert alltrue(mesh.triangles == domain.triangles)
    10586         assert allclose(mesh.nodes, domain.nodes)
     10542        assert num.alltrue(mesh.triangles == domain.triangles)
     10543        assert num.allclose(mesh.nodes, domain.nodes)
    1058710544
    1058810545        # Check that time has been recovered
    10589         assert allclose(time, range(t_end+1))
     10546        assert num.allclose(time, range(t_end+1))
    1059010547
    1059110548        # Check that quantities have been recovered
    1059210549        # (sww files use single precision)
    1059310550        z=domain.get_quantity('elevation').get_values(location='unique vertices')
    10594         assert allclose(quantities['elevation'], z)
     10551        assert num.allclose(quantities['elevation'], z)
    1059510552
    1059610553        for q in ['stage', 'xmomentum', 'ymomentum']:
     
    1060210559
    1060310560            msg = 'Quantity %s failed to be recovered' %q
    10604             assert allclose(q_ref, q_sww, atol=1.0e-6), msg
     10561            assert num.allclose(q_ref, q_sww, atol=1.0e-6), msg
    1060510562           
    1060610563        # Cleanup
     
    1062910586
    1063010587        import time, os
    10631         from Numeric import array, zeros, allclose, Float, concatenate
    1063210588        from Scientific.IO.NetCDF import NetCDFFile
    1063310589
     
    1068310639        for t in range(t_end+1):
    1068410640            for i in range(3):
    10685                 assert allclose(f(t, i), [1, 2, 0])
     10641                assert num.allclose(f(t, i), [1, 2, 0])
    1068610642           
    1068710643
     
    1069410650                                                     verbose=False)
    1069510651
    10696             assert allclose(Q, uh*width)
     10652            assert num.allclose(Q, uh*width)
    1069710653
    1069810654
     
    1071010666
    1071110667            #print i, Q, (width-start_point[1])
    10712             assert allclose(Q, uh*(width-start_point[1]))
     10668            assert num.allclose(Q, uh*(width-start_point[1]))
    1071310669
    1071410670
     
    1072010676
    1072110677        #print i, Q
    10722         assert allclose(Q, 0)       
     10678        assert num.allclose(Q, 0)       
    1072310679
    1072410680
     
    1072910685                                                 verbose=False)
    1073010686
    10731         assert allclose(Q, uh*width)       
     10687        assert num.allclose(Q, uh*width)       
    1073210688       
    1073310689
     
    1075610712
    1075710713        import time, os
    10758         from Numeric import array, zeros, allclose, Float, concatenate
    1075910714        from Scientific.IO.NetCDF import NetCDFFile
    1076010715
     
    1081810773            for i in range(3):
    1081910774                #print i, t, f(t, i)           
    10820                 assert allclose(f(t, i), [w, uh, 0])
     10775                assert num.allclose(f(t, i), [w, uh, 0])
    1082110776           
    1082210777
     
    1083110786                                                     verbose=False)
    1083210787
    10833             assert allclose(Q, uh*width)
     10788            assert num.allclose(Q, uh*width)
    1083410789
    1083510790
     
    1085910814
    1086010815        import time, os
    10861         from Numeric import array, zeros, allclose, Float, concatenate
    1086210816        from Scientific.IO.NetCDF import NetCDFFile
    1086310817
     
    1091910873            for i in range(3):
    1092010874                #print i, t, f(t, i)
    10921                 assert allclose(f(t, i), [w, uh, 0])
     10875                assert num.allclose(f(t, i), [w, uh, 0])
    1092210876           
    1092310877
     
    1093310887                                                       kind='specific',
    1093410888                                                       verbose=False)
    10935             assert allclose(Es, h + 0.5*u*u/g)
     10889            assert num.allclose(Es, h + 0.5*u*u/g)
    1093610890           
    1093710891            time, Et = get_energy_through_cross_section(swwfile,
     
    1093910893                                                        kind='total',
    1094010894                                                        verbose=False)
    10941             assert allclose(Et, w + 0.5*u*u/g)           
     10895            assert num.allclose(Et, w + 0.5*u*u/g)           
    1094210896
    1094310897           
     
    1102710981    def test_points2polygon(self): 
    1102810982        att_dict = {}
    11029         pointlist = array([[1.0, 0.0],[0.0, 1.0],[0.0, 0.0]])
    11030         att_dict['elevation'] = array([10.1, 0.0, 10.4])
    11031         att_dict['brightness'] = array([10.0, 1.0, 10.4])
     10983        pointlist = num.array([[1.0, 0.0],[0.0, 1.0],[0.0, 0.0]])
     10984        att_dict['elevation'] = num.array([10.1, 0.0, 10.4])
     10985        att_dict['brightness'] = num.array([10.0, 1.0, 10.4])
    1103210986       
    1103310987        fileName = tempfile.mktemp(".csv")
     
    1111611070            assert int(values[id]) == int(floors[id])
    1111711071            assert len(polygons[id]) == len(known_polys[id])
    11118             assert allclose(polygons[id], known_polys[id])
     11072            assert num.allclose(polygons[id], known_polys[id])
    1111911073
    1112011074
  • anuga_core/source/anuga/shallow_water/test_eq.py

    r5180 r6157  
    11import unittest
    2 from Numeric import allclose
     2import Numeric as num
    33from eqf import earthquake_tsunami, Okada_func
     4
    45
    56class Test_eq(unittest.TestCase):
     
    2829                       slip=slip, rake=rake, test=test)
    2930
    30         assert allclose(z.length, length)
    31         assert allclose(z.width, width)
    32         assert allclose(z.x0, x0)
    33         assert allclose(z.y0, y0)
    34         assert allclose(z.strike, strike)
    35         assert allclose(z.depth, depth)
    36         assert allclose(z.slip, slip)
    37         assert allclose(z.dip, dip)
    38         assert allclose(z.rake, rake)
     31        assert num.allclose(z.length, length)
     32        assert num.allclose(z.width, width)
     33        assert num.allclose(z.x0, x0)
     34        assert num.allclose(z.y0, y0)
     35        assert num.allclose(z.strike, strike)
     36        assert num.allclose(z.depth, depth)
     37        assert num.allclose(z.slip, slip)
     38        assert num.allclose(z.dip, dip)
     39        assert num.allclose(z.rake, rake)
    3940
    4041        #print 'in test', z.test
    41         assert allclose(z.test, -2205.904774487)
     42        assert num.allclose(z.test, -2205.904774487)
    4243       
    4344        #print 'hello finished okada'
  • anuga_core/source/anuga/shallow_water/test_most2nc.py

    r6086 r6157  
    11import unittest
    2 from Numeric import allclose, asarray
     2import Numeric as num
    33from Scientific.IO.NetCDF import NetCDFFile
    44import most2nc
     
    4141           ,[-5.,  -6.,  -7.,  -8.]\
    4242           ,[-1.,  -2.,  -3.,  -4.]]
    43         z = asarray(z)
     43        z = num.asarray(z)
    4444
    45         assert allclose(z,elevation)
     45        assert num.allclose(z,elevation)
    4646        import os
    4747        os.remove('test.nc')
  • anuga_core/source/anuga/shallow_water/test_shallow_water_domain.py

    r6122 r6157  
    22
    33import unittest, os
    4 from math import sqrt, pi
     4from math import pi
    55import tempfile
    66
    77from anuga.config import g, epsilon
    88from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a
    9 from Numeric import allclose, alltrue, array, zeros, ones, Float, take
     9import Numeric as num
    1010from anuga.utilities.numerical_tools import mean
    1111from anuga.utilities.polygon import is_inside_polygon
     
    2121# For test_fitting_using_shallow_water_domain example
    2222def linear_function(point):
    23     point = array(point)
     23    point = num.array(point)
    2424    return point[:,0]+point[:,1]
    2525
     
    3333
    3434    def __call__(self, x, y):
    35         from Numeric import zeros, Float
    3635
    3736        N = len(x)
    3837        assert N == len(y)
    3938
    40         z = zeros(N, Float)
     39        z = num.zeros(N, num.Float)
    4140        for i in range(N):
    4241            z[i] = -x[i]/2  #General slope
     
    10099            x0 = 1.1; y0 = 0.35
    101100            #if x[i] < -0.2 and y < 0.5:
    102             if sqrt((2*(x[i]-x0))**2 + (2*(y[i]-y0))**2) < 0.2:
    103                 z[i] = sqrt(((x[i]-x0))**2 + ((y[i]-y0))**2)-1.0
     101            if num.sqrt((2*(x[i]-x0))**2 + (2*(y[i]-y0))**2) < 0.2:
     102                z[i] = num.sqrt(((x[i]-x0))**2 + ((y[i]-y0))**2)-1.0
    104103
    105104            #Tiny channel draining hole
     
    139138
    140139    def __call__(self, x, y):
    141         from Numeric import zeros, Float
    142140
    143141        N = len(x)
    144142        assert N == len(y)
    145143
    146         z = zeros(N, Float)
     144        z = num.zeros(N, num.Float)
    147145        for i in range(N):
    148146            z[i] = -x[i]  #General slope
     
    178176    from math import exp, cos, pi
    179177
    180     x = array(x)
    181     y = array(y)
     178    x = num.array(x)
     179    y = num.array(y)
    182180
    183181    N = len(x)
     
    186184    for k in range(N):
    187185
    188         r = sqrt(x[k]**2 + y[k]**2)
     186        r = num.sqrt(x[k]**2 + y[k]**2)
    189187
    190188        factor = exp( -(r-0.15)**2 )
     
    208206    from math import atan, pi
    209207
    210     x = array(x)
    211     y = array(y)
     208    x = num.array(x)
     209    y = num.array(y)
    212210
    213211    N = len(x)
     
    215213
    216214    for k in range(N):
    217         r = sqrt(x[k]**2 + y[k]**2)
     215        r = num.sqrt(x[k]**2 + y[k]**2)
    218216
    219217        angle = atan(y[k]/x[k])
     
    242240
    243241    def test_rotate(self):
    244         normal = array([0.0,-1.0])
    245 
    246         q = array([1.0,2.0,3.0])
     242        normal = num.array([0.0,-1.0])
     243
     244        q = num.array([1.0,2.0,3.0])
    247245
    248246        r = rotate(q, normal, direction = 1)
     
    252250
    253251        w = rotate(r, normal, direction = -1)
    254         assert allclose(w, q)
     252        assert num.allclose(w, q)
    255253
    256254        #Check error check
    257255        try:
    258             rotate(r, array([1,1,1]) )
     256            rotate(r, num.array([1,1,1]) )
    259257        except:
    260258            pass
     
    265263    # Individual flux tests
    266264    def test_flux_zero_case(self):
    267         ql = zeros( 3, Float )
    268         qr = zeros( 3, Float )
    269         normal = zeros( 2, Float )
    270         edgeflux = zeros( 3, Float )
     265        ql = num.zeros( 3, num.Float )
     266        qr = num.zeros( 3, num.Float )
     267        normal = num.zeros( 2, num.Float )
     268        edgeflux = num.zeros( 3, num.Float )
    271269        zl = zr = 0.
    272270        H0 = 0.0
     
    274272        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)
    275273
    276         assert allclose(edgeflux, [0,0,0])
     274        assert num.allclose(edgeflux, [0,0,0])
    277275        assert max_speed == 0.
    278276
     
    280278        w = 2.0
    281279
    282         normal = array([1.,0])
    283         ql = array([w, 0, 0])
    284         qr = array([w, 0, 0])
    285         edgeflux = zeros(3, Float)       
     280        normal = num.array([1.,0])
     281        ql = num.array([w, 0, 0])
     282        qr = num.array([w, 0, 0])
     283        edgeflux = num.zeros(3, num.Float)       
    286284        zl = zr = 0.
    287285        h = w - (zl+zr)/2
     
    289287
    290288        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)       
    291         assert allclose(edgeflux, [0., 0.5*g*h**2, 0.])
    292         assert max_speed == sqrt(g*h)
     289        assert num.allclose(edgeflux, [0., 0.5*g*h**2, 0.])
     290        assert max_speed == num.sqrt(g*h)
    293291
    294292    #def test_flux_slope(self):
     
    310308    def test_flux1(self):
    311309        #Use data from previous version of abstract_2d_finite_volumes
    312         normal = array([1.,0])
    313         ql = array([-0.2, 2, 3])
    314         qr = array([-0.2, 2, 3])
     310        normal = num.array([1.,0])
     311        ql = num.array([-0.2, 2, 3])
     312        qr = num.array([-0.2, 2, 3])
    315313        zl = zr = -0.5
    316         edgeflux = zeros(3, Float)               
     314        edgeflux = num.zeros(3, num.Float)               
    317315
    318316        H0 = 0.0
     
    320318        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)       
    321319
    322         assert allclose(edgeflux, [2.,13.77433333, 20.])
    323         assert allclose(max_speed, 8.38130948661)
     320        assert num.allclose(edgeflux, [2.,13.77433333, 20.])
     321        assert num.allclose(max_speed, 8.38130948661)
    324322
    325323
    326324    def test_flux2(self):
    327325        #Use data from previous version of abstract_2d_finite_volumes
    328         normal = array([0., -1.])
    329         ql = array([-0.075, 2, 3])
    330         qr = array([-0.075, 2, 3])
     326        normal = num.array([0., -1.])
     327        ql = num.array([-0.075, 2, 3])
     328        qr = num.array([-0.075, 2, 3])
    331329        zl = zr = -0.375
    332330
    333         edgeflux = zeros(3, Float)               
     331        edgeflux = num.zeros(3, num.Float)               
    334332        H0 = 0.0
    335333        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)       
    336334
    337         assert allclose(edgeflux, [-3.,-20.0, -30.441])
    338         assert allclose(max_speed, 11.7146428199)
     335        assert num.allclose(edgeflux, [-3.,-20.0, -30.441])
     336        assert num.allclose(max_speed, 11.7146428199)
    339337
    340338    def test_flux3(self):
    341339        #Use data from previous version of abstract_2d_finite_volumes
    342         normal = array([-sqrt(2)/2, sqrt(2)/2])
    343         ql = array([-0.075, 2, 3])
    344         qr = array([-0.075, 2, 3])
     340        normal = num.array([-num.sqrt(2)/2, num.sqrt(2)/2])
     341        ql = num.array([-0.075, 2, 3])
     342        qr = num.array([-0.075, 2, 3])
    345343        zl = zr = -0.375
    346344
    347         edgeflux = zeros(3, Float)               
     345        edgeflux = num.zeros(3, num.Float)               
    348346        H0 = 0.0
    349347        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)       
    350348
    351         assert allclose(edgeflux, [sqrt(2)/2, 4.40221112, 7.3829019])
    352         assert allclose(max_speed, 4.0716654239)
     349        assert num.allclose(edgeflux, [num.sqrt(2)/2, 4.40221112, 7.3829019])
     350        assert num.allclose(max_speed, 4.0716654239)
    353351
    354352    def test_flux4(self):
    355353        #Use data from previous version of abstract_2d_finite_volumes
    356         normal = array([-sqrt(2)/2, sqrt(2)/2])
    357         ql = array([-0.34319278, 0.10254161, 0.07273855])
    358         qr = array([-0.30683287, 0.1071986, 0.05930515])
     354        normal = num.array([-num.sqrt(2)/2, num.sqrt(2)/2])
     355        ql = num.array([-0.34319278, 0.10254161, 0.07273855])
     356        qr = num.array([-0.30683287, 0.1071986, 0.05930515])
    359357        zl = zr = -0.375
    360358
    361         edgeflux = zeros(3, Float)               
     359        edgeflux = num.zeros(3, num.Float)               
    362360        H0 = 0.0
    363361        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)               
    364362
    365         assert allclose(edgeflux, [-0.04072676, -0.07096636, -0.01604364])
    366         assert allclose(max_speed, 1.31414103233)
     363        assert num.allclose(edgeflux, [-0.04072676, -0.07096636, -0.01604364])
     364        assert num.allclose(max_speed, 1.31414103233)
    367365
    368366    def test_flux_computation(self):   
     
    391389       
    392390        domain.compute_fluxes()
    393         assert allclose(domain.get_quantity('stage').explicit_update[1], 0) # Central triangle
     391        assert num.allclose(domain.get_quantity('stage').explicit_update[1], 0) # Central triangle
    394392       
    395393
     
    682680            # changeset:5846.
    683681            msg = 'Time boundary not evaluated correctly'
    684             assert allclose(t, q[0]), msg
     682            assert num.allclose(t, q[0]), msg
    685683           
    686684       
     
    706704        domain.check_integrity()
    707705
    708         assert allclose(domain.neighbours, [[-1,1,-1], [2,3,0], [-1,-1,1],[1,-1,-1]])
    709         assert allclose(domain.neighbour_edges, [[-1,2,-1], [2,0,1], [-1,-1,0],[1,-1,-1]])
     706        assert num.allclose(domain.neighbours, [[-1,1,-1], [2,3,0], [-1,-1,1],[1,-1,-1]])
     707        assert num.allclose(domain.neighbour_edges, [[-1,2,-1], [2,0,1], [-1,-1,0],[1,-1,-1]])
    710708
    711709        zl=zr=0. # Assume flat bed
    712710
    713         edgeflux = zeros(3, Float)       
    714         edgeflux0 = zeros(3, Float)
    715         edgeflux1 = zeros(3, Float)
    716         edgeflux2 = zeros(3, Float)                               
     711        edgeflux = num.zeros(3, num.Float)       
     712        edgeflux0 = num.zeros(3, num.Float)
     713        edgeflux1 = num.zeros(3, num.Float)
     714        edgeflux2 = num.zeros(3, num.Float)                               
    717715        H0 = 0.0       
    718716
     
    728726        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)                               
    729727
    730         assert allclose(edgeflux0 + edgeflux, 0.)
     728        assert num.allclose(edgeflux0 + edgeflux, 0.)
    731729
    732730        # Flux across upper edge of volume 1
     
    741739        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)                                               
    742740
    743         assert allclose(edgeflux1 + edgeflux, 0.)       
     741        assert num.allclose(edgeflux1 + edgeflux, 0.)       
    744742       
    745743
     
    754752        normal = domain.get_normal(0,1)
    755753        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux, epsilon, g, H0)                                                       
    756         assert allclose(edgeflux2 + edgeflux, 0.)
     754        assert num.allclose(edgeflux2 + edgeflux, 0.)
    757755
    758756
     
    762760        e2 = domain.edgelengths[1, 2]
    763761
    764         assert allclose(e0*edgeflux0+e1*edgeflux1+e2*edgeflux2, 0.)
     762        assert num.allclose(e0*edgeflux0+e1*edgeflux1+e2*edgeflux2, 0.)
    765763
    766764        # Now check that compute_flux yields zeros as well
     
    769767        for name in ['stage', 'xmomentum', 'ymomentum']:
    770768            #print name, domain.quantities[name].explicit_update
    771             assert allclose(domain.quantities[name].explicit_update[1], 0)
     769            assert num.allclose(domain.quantities[name].explicit_update[1], 0)
    772770
    773771
     
    799797        zl=zr=0. #Assume flat bed
    800798
    801         edgeflux = zeros(3, Float)       
    802         edgeflux0 = zeros(3, Float)
    803         edgeflux1 = zeros(3, Float)
    804         edgeflux2 = zeros(3, Float)                               
     799        edgeflux = num.zeros(3, num.Float)       
     800        edgeflux0 = num.zeros(3, num.Float)
     801        edgeflux1 = num.zeros(3, num.Float)
     802        edgeflux2 = num.zeros(3, num.Float)                               
    805803        H0 = 0.0       
    806804       
     
    808806        # Flux across right edge of volume 1
    809807        normal = domain.get_normal(1,0) #Get normal 0 of triangle 1
    810         assert allclose(normal, [1, 0])
     808        assert num.allclose(normal, [1, 0])
    811809       
    812810        ql = domain.get_conserved_quantities(vol_id=1, edge=0)
    813         assert allclose(ql, [val1, 0, 0])
     811        assert num.allclose(ql, [val1, 0, 0])
    814812       
    815813        qr = domain.get_conserved_quantities(vol_id=2, edge=2)
    816         assert allclose(qr, [val2, 0, 0])
     814        assert num.allclose(qr, [val2, 0, 0])
    817815
    818816        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux0, epsilon, g, H0)                                                       
    819817
    820818        # Flux across edge in the east direction (as per normal vector)
    821         assert allclose(edgeflux0, [-15.3598804, 253.71111111, 0.])
    822         assert allclose(max_speed, 9.21592824046)
     819        assert num.allclose(edgeflux0, [-15.3598804, 253.71111111, 0.])
     820        assert num.allclose(max_speed, 9.21592824046)
    823821
    824822
    825823        #Flux across edge in the west direction (opposite sign for xmomentum)
    826824        normal_opposite = domain.get_normal(2,2) #Get normal 2 of triangle 2
    827         assert allclose(normal_opposite, [-1, 0])
     825        assert num.allclose(normal_opposite, [-1, 0])
    828826
    829827        max_speed = flux_function(normal_opposite, ql, qr, zl, zr, edgeflux, epsilon, g, H0)                                             
    830828        #flux_opposite, max_speed = flux_function([-1, 0], ql, qr, zl, zr)
    831         assert allclose(edgeflux, [-15.3598804, -253.71111111, 0.])
     829        assert num.allclose(edgeflux, [-15.3598804, -253.71111111, 0.])
    832830       
    833831
     
    838836        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux1, epsilon, g, H0)                                                               
    839837
    840         assert allclose(edgeflux1, [2.4098563, 0., 123.04444444])
    841         assert allclose(max_speed, 7.22956891292)
     838        assert num.allclose(edgeflux1, [2.4098563, 0., 123.04444444])
     839        assert num.allclose(max_speed, 7.22956891292)
    842840
    843841        #Flux across lower left hypotenuse of volume 1
     
    847845        max_speed = flux_function(normal, ql, qr, zl, zr, edgeflux2, epsilon, g, H0)       
    848846
    849         assert allclose(edgeflux2, [9.63942522, -61.59685738, -61.59685738])
    850         assert allclose(max_speed, 7.22956891292)
     847        assert num.allclose(edgeflux2, [9.63942522, -61.59685738, -61.59685738])
     848        assert num.allclose(max_speed, 7.22956891292)
    851849
    852850        #Scale, add up and check that compute_fluxes is correct for vol 1
     
    856854
    857855        total_flux = -(e0*edgeflux0+e1*edgeflux1+e2*edgeflux2)/domain.areas[1]
    858         assert allclose(total_flux, [-0.68218178, -166.6, -35.93333333])
     856        assert num.allclose(total_flux, [-0.68218178, -166.6, -35.93333333])
    859857
    860858
    861859        domain.compute_fluxes()
    862860
    863         #assert allclose(total_flux, domain.explicit_update[1,:])
     861        #assert num.allclose(total_flux, domain.explicit_update[1,:])
    864862        for i, name in enumerate(['stage', 'xmomentum', 'ymomentum']):
    865             assert allclose(total_flux[i],
    866                             domain.quantities[name].explicit_update[1])
     863            assert num.allclose(total_flux[i],
     864                                domain.quantities[name].explicit_update[1])
    867865
    868866        #assert allclose(domain.explicit_update, [
     
    872870        #    [-35.68522449, 0., 69.68888889]])
    873871
    874         assert allclose(domain.quantities['stage'].explicit_update,
    875                         [0., -0.68218178, -111.77316251, -35.68522449])
    876         assert allclose(domain.quantities['xmomentum'].explicit_update,
    877                         [-69.68888889, -166.6, 69.68888889, 0])
    878         assert allclose(domain.quantities['ymomentum'].explicit_update,
    879                         [-69.68888889, -35.93333333, 0., 69.68888889])
     872        assert num.allclose(domain.quantities['stage'].explicit_update,
     873                            [0., -0.68218178, -111.77316251, -35.68522449])
     874        assert num.allclose(domain.quantities['xmomentum'].explicit_update,
     875                            [-69.68888889, -166.6, 69.68888889, 0])
     876        assert num.allclose(domain.quantities['ymomentum'].explicit_update,
     877                            [-69.68888889, -35.93333333, 0., 69.68888889])
    880878
    881879
     
    907905
    908906        zl=zr=0 #Assume flat zero bed
    909         edgeflux = zeros(3, Float)       
    910         edgeflux0 = zeros(3, Float)
    911         edgeflux1 = zeros(3, Float)
    912         edgeflux2 = zeros(3, Float)                               
     907        edgeflux = num.zeros(3, num.Float)       
     908        edgeflux0 = num.zeros(3, num.Float)
     909        edgeflux1 = num.zeros(3, num.Float)
     910        edgeflux2 = num.zeros(3, num.Float)                               
    913911        H0 = 0.0       
    914912       
    915913
    916         domain.set_quantity('elevation', zl*ones( (4,3) ))
     914        domain.set_quantity('elevation', zl*num.ones( (4,3) ))
    917915
    918916
     
    963961        domain.compute_fluxes()
    964962        for i, name in enumerate(['stage', 'xmomentum', 'ymomentum']):
    965             assert allclose(total_flux[i],
    966                             domain.quantities[name].explicit_update[1])
     963            assert num.allclose(total_flux[i],
     964                                domain.quantities[name].explicit_update[1])
    967965        #assert allclose(total_flux, domain.explicit_update[1,:])
    968966
     
    990988
    991989        zl=zr=-3.75 #Assume constant bed (must be less than stage)
    992         domain.set_quantity('elevation', zl*ones( (4,3) ))
    993 
    994 
    995         edgeflux = zeros(3, Float)       
    996         edgeflux0 = zeros(3, Float)
    997         edgeflux1 = zeros(3, Float)
    998         edgeflux2 = zeros(3, Float)                               
     990        domain.set_quantity('elevation', zl*num.ones( (4,3) ))
     991
     992
     993        edgeflux = num.zeros(3, num.Float)       
     994        edgeflux0 = num.zeros(3, num.Float)
     995        edgeflux1 = num.zeros(3, num.Float)
     996        edgeflux2 = num.zeros(3, num.Float)                               
    999997        H0 = 0.0       
    1000998       
     
    10461044        domain.compute_fluxes()
    10471045        for i, name in enumerate(['stage', 'xmomentum', 'ymomentum']):
    1048             assert allclose(total_flux[i],
    1049                             domain.quantities[name].explicit_update[1])
     1046            assert num.allclose(total_flux[i],
     1047                                domain.quantities[name].explicit_update[1])
    10501048
    10511049
     
    10731071
    10741072        zl=zr=4  #Too large
    1075         domain.set_quantity('elevation', zl*ones( (4,3) ))
     1073        domain.set_quantity('elevation', zl*num.ones( (4,3) ))
    10761074        domain.set_quantity('stage', [[val0, val0-1, val0-2],
    10771075                                      [val1, val1+1, val1],
     
    11071105
    11081106        zl=zr=5
    1109         domain.set_quantity('elevation', zl*ones( (4,3) ))
     1107        domain.set_quantity('elevation', zl*num.ones( (4,3) ))
    11101108        domain.set_quantity('stage', [[val0, val0-1, val0-2],
    11111109                                      [val1, val1+1, val1],
     
    11201118
    11211119        indices = domain.get_wet_elements()
    1122         assert allclose(indices, [1,2])
     1120        assert num.allclose(indices, [1,2])
    11231121
    11241122        indices = domain.get_wet_elements(indices=[0,1,3])
    1125         assert allclose(indices, [1])
     1123        assert num.allclose(indices, [1])
    11261124       
    11271125
     
    11481146
    11491147        indices = domain.get_wet_elements()
    1150         assert allclose(indices, [0])
     1148        assert num.allclose(indices, [0])
    11511149
    11521150        q = domain.get_maximum_inundation_elevation()
    1153         assert allclose(q, domain.get_quantity('elevation').get_values(location='centroids')[0])
     1151        assert num.allclose(q, domain.get_quantity('elevation').get_values(location='centroids')[0])
    11541152
    11551153        x, y = domain.get_maximum_inundation_location()
    1156         assert allclose([x, y], domain.get_centroid_coordinates()[0])
     1154        assert num.allclose([x, y], domain.get_centroid_coordinates()[0])
    11571155
    11581156
     
    11821180
    11831181        indices = domain.get_wet_elements()
    1184         assert allclose(indices, [0,1,2])
     1182        assert num.allclose(indices, [0,1,2])
    11851183
    11861184        q = domain.get_maximum_inundation_elevation()
    1187         assert allclose(q, 4)       
     1185        assert num.allclose(q, 4)       
    11881186
    11891187        x, y = domain.get_maximum_inundation_location()
    1190         assert allclose([x, y], domain.get_centroid_coordinates()[1])       
     1188        assert num.allclose([x, y], domain.get_centroid_coordinates()[1])       
    11911189       
    11921190
     
    12421240        z = domain.get_quantity('elevation').\
    12431241            get_values(location='centroids', indices=indices)
    1244         assert alltrue(z<initial_runup_height)
     1242        assert num.alltrue(z<initial_runup_height)
    12451243
    12461244        q = domain.get_maximum_inundation_elevation()
    1247         assert allclose(q, initial_runup_height, rtol = 1.0/N) # First order accuracy
     1245        assert num.allclose(q, initial_runup_height, rtol = 1.0/N) # First order accuracy
    12481246
    12491247        x, y = domain.get_maximum_inundation_location()
    12501248
    12511249        qref = domain.get_quantity('elevation').get_values(interpolation_points = [[x, y]])
    1252         assert allclose(q, qref)
     1250        assert num.allclose(q, qref)
    12531251
    12541252
     
    12561254        wet_elevations = domain.get_quantity('elevation').get_values(location='centroids',
    12571255                                                                     indices=wet_elements)
    1258         assert alltrue(wet_elevations<initial_runup_height)
    1259         assert allclose(wet_elevations, z)       
     1256        assert num.alltrue(wet_elevations<initial_runup_height)
     1257        assert num.allclose(wet_elevations, z)       
    12601258
    12611259
     
    12801278            get_values(location='centroids', indices=indices)
    12811279
    1282         assert alltrue(z<initial_runup_height)
     1280        assert num.alltrue(z<initial_runup_height)
    12831281
    12841282        q = domain.get_maximum_inundation_elevation()
    1285         assert allclose(q, initial_runup_height, rtol = 1.0/N) # First order accuracy
     1283        assert num.allclose(q, initial_runup_height, rtol = 1.0/N) # First order accuracy
    12861284       
    12871285        x, y = domain.get_maximum_inundation_location()
    12881286        qref = domain.get_quantity('elevation').get_values(interpolation_points = [[x, y]])
    1289         assert allclose(q, qref)       
     1287        assert num.allclose(q, qref)       
    12901288
    12911289
     
    13121310            get_values(location='centroids', indices=indices)
    13131311
    1314         assert alltrue(z<final_runup_height)
     1312        assert num.alltrue(z<final_runup_height)
    13151313
    13161314        q = domain.get_maximum_inundation_elevation()
    1317         assert allclose(q, final_runup_height, rtol = 1.0/N) # First order accuracy
     1315        assert num.allclose(q, final_runup_height, rtol = 1.0/N) # First order accuracy
    13181316
    13191317        x, y = domain.get_maximum_inundation_location()
    13201318        qref = domain.get_quantity('elevation').get_values(interpolation_points = [[x, y]])
    1321         assert allclose(q, qref)       
     1319        assert num.allclose(q, qref)       
    13221320
    13231321
     
    13251323        wet_elevations = domain.get_quantity('elevation').get_values(location='centroids',
    13261324                                                                     indices=wet_elements)
    1327         assert alltrue(wet_elevations<final_runup_height)
    1328         assert allclose(wet_elevations, z)       
     1325        assert num.alltrue(wet_elevations<final_runup_height)
     1326        assert num.allclose(wet_elevations, z)       
    13291327       
    13301328
     
    13941392        z = domain.get_quantity('elevation').\
    13951393            get_values(location='centroids', indices=indices)
    1396         assert alltrue(z<initial_runup_height)
     1394        assert num.alltrue(z<initial_runup_height)
    13971395
    13981396        q_ref = domain.get_maximum_inundation_elevation()
    1399         assert allclose(q_ref, initial_runup_height, rtol = 1.0/N) # First order accuracy
     1397        assert num.allclose(q_ref, initial_runup_height, rtol = 1.0/N) # First order accuracy
    14001398
    14011399       
     
    14141412        q = get_maximum_inundation_elevation('runup_test.sww')
    14151413        msg = 'We got %f, should have been %f' %(q, q_ref)
    1416         assert allclose(q, q_ref, rtol=1.0/N), msg
     1414        assert num.allclose(q, q_ref, rtol=1.0/N), msg
    14171415
    14181416
    14191417        q = get_maximum_inundation_elevation('runup_test.sww')
    14201418        msg = 'We got %f, should have been %f' %(q, initial_runup_height)
    1421         assert allclose(q, initial_runup_height, rtol = 1.0/N), msg
     1419        assert num.allclose(q, initial_runup_height, rtol = 1.0/N), msg
    14221420
    14231421
     
    14361434                                             time_interval=[0.0, 3.0])       
    14371435        msg = 'We got %f, should have been %f' %(q, initial_runup_height)
    1438         assert allclose(q, initial_runup_height, rtol = 1.0/N), msg
    1439         assert allclose(-loc[0]/2, q) # From topography formula         
     1436        assert num.allclose(q, initial_runup_height, rtol = 1.0/N), msg
     1437        assert num.allclose(-loc[0]/2, q) # From topography formula         
    14401438       
    14411439
     
    14641462            get_values(location='centroids', indices=indices)
    14651463
    1466         assert alltrue(z<final_runup_height)
     1464        assert num.alltrue(z<final_runup_height)
    14671465
    14681466        q = domain.get_maximum_inundation_elevation()
    1469         assert allclose(q, final_runup_height, rtol = 1.0/N) # First order accuracy
     1467        assert num.allclose(q, final_runup_height, rtol = 1.0/N) # First order accuracy
    14701468
    14711469        q, loc = get_maximum_inundation_data('runup_test.sww', time_interval=[3.0, 3.0])
    14721470        msg = 'We got %f, should have been %f' %(q, final_runup_height)
    1473         assert allclose(q, final_runup_height, rtol=1.0/N), msg
     1471        assert num.allclose(q, final_runup_height, rtol=1.0/N), msg
    14741472        #print 'loc', loc, q       
    1475         assert allclose(-loc[0]/2, q) # From topography formula         
     1473        assert num.allclose(-loc[0]/2, q) # From topography formula         
    14761474
    14771475        q = get_maximum_inundation_elevation('runup_test.sww')
    14781476        loc = get_maximum_inundation_location('runup_test.sww')       
    14791477        msg = 'We got %f, should have been %f' %(q, q_max)
    1480         assert allclose(q, q_max, rtol=1.0/N), msg
     1478        assert num.allclose(q, q_max, rtol=1.0/N), msg
    14811479        #print 'loc', loc, q
    1482         assert allclose(-loc[0]/2, q) # From topography formula
     1480        assert num.allclose(-loc[0]/2, q) # From topography formula
    14831481
    14841482       
     
    14861484        q = get_maximum_inundation_elevation('runup_test.sww', time_interval=[0, 3])
    14871485        msg = 'We got %f, should have been %f' %(q, q_max)
    1488         assert allclose(q, q_max, rtol=1.0/N), msg
     1486        assert num.allclose(q, q_max, rtol=1.0/N), msg
    14891487
    14901488
     
    14951493                                             time_interval=[0, 3])
    14961494        msg = 'We got %f, should have been %f' %(q, q_max)
    1497         assert allclose(q, q_max, rtol=1.0/N), msg
     1495        assert num.allclose(q, q_max, rtol=1.0/N), msg
    14981496
    14991497       
     
    15031501                                             time_interval=[0, 3])
    15041502        msg = 'We got %f, should have been %f' %(q, -0.475)
    1505         assert allclose(q, -0.475, rtol=1.0/N), msg
     1503        assert num.allclose(q, -0.475, rtol=1.0/N), msg
    15061504        assert is_inside_polygon(loc, polygon)
    1507         assert allclose(-loc[0]/2, q) # From topography formula         
     1505        assert num.allclose(-loc[0]/2, q) # From topography formula         
    15081506
    15091507
     
    15581556
    15591557        import time, os
    1560         from Numeric import array, zeros, allclose, Float, concatenate
    15611558        from Scientific.IO.NetCDF import NetCDFFile
    15621559
     
    16141611            vh_t = ymomentum.get_values(interpolation_points)           
    16151612           
    1616             assert allclose(w_t, w)
    1617             assert allclose(uh_t, uh)           
    1618             assert allclose(vh_t, 0.0)                       
     1613            assert num.allclose(w_t, w)
     1614            assert num.allclose(uh_t, uh)           
     1615            assert num.allclose(vh_t, 0.0)                       
    16191616           
    16201617           
     
    16281625                                                          verbose=False)
    16291626
    1630                 assert allclose(Q, uh*width)
     1627                assert num.allclose(Q, uh*width)
    16311628
    16321629
     
    16551652
    16561653        import time, os
    1657         from Numeric import array, zeros, allclose, Float, concatenate
    16581654        from Scientific.IO.NetCDF import NetCDFFile
    16591655
     
    17111707            vh_t = ymomentum.get_values(interpolation_points)           
    17121708           
    1713             assert allclose(w_t, w)
    1714             assert allclose(uh_t, uh)           
    1715             assert allclose(vh_t, 0.0)                       
     1709            assert num.allclose(w_t, w)
     1710            assert num.allclose(uh_t, uh)           
     1711            assert num.allclose(vh_t, 0.0)                       
    17161712           
    17171713           
     
    17261722                                                             verbose=False)
    17271723                                                     
    1728                 assert allclose(Es, h + 0.5*u*u/g)
     1724                assert num.allclose(Es, h + 0.5*u*u/g)
    17291725           
    17301726                Et = domain.get_energy_through_cross_section(cross_section,
    17311727                                                             kind='total',
    17321728                                                             verbose=False)
    1733                 assert allclose(Et, w + 0.5*u*u/g)           
     1729                assert num.allclose(Et, w + 0.5*u*u/g)           
    17341730
    17351731           
     
    18461842       
    18471843       
    1848         assert allclose(gauge_values[0], G0)
    1849         assert allclose(gauge_values[1], G1)
    1850         assert allclose(gauge_values[2], G2)
    1851         assert allclose(gauge_values[3], G3)       
     1844        assert num.allclose(gauge_values[0], G0)
     1845        assert num.allclose(gauge_values[1], G1)
     1846        assert num.allclose(gauge_values[2], G2)
     1847        assert num.allclose(gauge_values[3], G3)       
    18521848
    18531849
     
    19011897
    19021898        #  Check that update arrays are initialised to zero
    1903         assert allclose(domain.get_quantity('stage').explicit_update, 0)
    1904         assert allclose(domain.get_quantity('xmomentum').explicit_update, 0)
    1905         assert allclose(domain.get_quantity('ymomentum').explicit_update, 0)               
     1899        assert num.allclose(domain.get_quantity('stage').explicit_update, 0)
     1900        assert num.allclose(domain.get_quantity('xmomentum').explicit_update, 0)
     1901        assert num.allclose(domain.get_quantity('ymomentum').explicit_update, 0)               
    19061902
    19071903
     
    19171913        domain.compute_fluxes()
    19181914
    1919         assert allclose(stage_ref, domain.get_quantity('stage').explicit_update)
    1920         assert allclose(xmom_ref, domain.get_quantity('xmomentum').explicit_update)
    1921         assert allclose(ymom_ref, domain.get_quantity('ymomentum').explicit_update)
     1915        assert num.allclose(stage_ref, domain.get_quantity('stage').explicit_update)
     1916        assert num.allclose(xmom_ref, domain.get_quantity('xmomentum').explicit_update)
     1917        assert num.allclose(ymom_ref, domain.get_quantity('ymomentum').explicit_update)
    19221918       
    19231919   
     
    19691965
    19701966            if t == 0.0:
    1971                 assert allclose(stage, initial_stage)
     1967                assert num.allclose(stage, initial_stage)
    19721968            else:
    1973                 assert not allclose(stage, initial_stage)
     1969                assert not num.allclose(stage, initial_stage)
    19741970
    19751971
     
    20092005
    20102006        for name in domain.conserved_quantities:
    2011             assert allclose(domain.quantities[name].explicit_update, 0)
    2012             assert allclose(domain.quantities[name].semi_implicit_update, 0)
     2007            assert num.allclose(domain.quantities[name].explicit_update, 0)
     2008            assert num.allclose(domain.quantities[name].semi_implicit_update, 0)
    20132009
    20142010        domain.compute_forcing_terms()
    20152011
    2016         assert allclose(domain.quantities['stage'].explicit_update, 0)
    2017         assert allclose(domain.quantities['xmomentum'].explicit_update, -g*h*3)
    2018         assert allclose(domain.quantities['ymomentum'].explicit_update, 0)
     2012        assert num.allclose(domain.quantities['stage'].explicit_update, 0)
     2013        assert num.allclose(domain.quantities['xmomentum'].explicit_update, -g*h*3)
     2014        assert num.allclose(domain.quantities['ymomentum'].explicit_update, 0)
    20192015
    20202016
     
    20492045
    20502046        for name in domain.conserved_quantities:
    2051             assert allclose(domain.quantities[name].explicit_update, 0)
    2052             assert allclose(domain.quantities[name].semi_implicit_update, 0)
     2047            assert num.allclose(domain.quantities[name].explicit_update, 0)
     2048            assert num.allclose(domain.quantities[name].semi_implicit_update, 0)
    20532049
    20542050        domain.compute_forcing_terms()
    20552051
    2056         assert allclose(domain.quantities['stage'].explicit_update, 0)
    2057         assert allclose(domain.quantities['xmomentum'].explicit_update, -g*h*3)
    2058         assert allclose(domain.quantities['ymomentum'].explicit_update, 0)
    2059 
    2060         assert allclose(domain.quantities['stage'].semi_implicit_update, 0)
    2061         assert allclose(domain.quantities['xmomentum'].semi_implicit_update, 0)
    2062         assert allclose(domain.quantities['ymomentum'].semi_implicit_update, 0)
     2052        assert num.allclose(domain.quantities['stage'].explicit_update, 0)
     2053        assert num.allclose(domain.quantities['xmomentum'].explicit_update, -g*h*3)
     2054        assert num.allclose(domain.quantities['ymomentum'].explicit_update, 0)
     2055
     2056        assert num.allclose(domain.quantities['stage'].semi_implicit_update, 0)
     2057        assert num.allclose(domain.quantities['xmomentum'].semi_implicit_update, 0)
     2058        assert num.allclose(domain.quantities['ymomentum'].semi_implicit_update, 0)
    20632059
    20642060        #Create some momentum for friction to work with
     
    20672063
    20682064        domain.compute_forcing_terms()
    2069         assert allclose(domain.quantities['stage'].semi_implicit_update, 0)
    2070         assert allclose(domain.quantities['xmomentum'].semi_implicit_update, S)
    2071         assert allclose(domain.quantities['ymomentum'].semi_implicit_update, 0)
     2065        assert num.allclose(domain.quantities['stage'].semi_implicit_update, 0)
     2066        assert num.allclose(domain.quantities['xmomentum'].semi_implicit_update, S)
     2067        assert num.allclose(domain.quantities['ymomentum'].semi_implicit_update, 0)
    20722068
    20732069        #A more complex example
     
    20842080        domain.compute_forcing_terms()
    20852081
    2086         assert allclose(domain.quantities['stage'].semi_implicit_update, 0)
    2087         assert allclose(domain.quantities['xmomentum'].semi_implicit_update, 3*S)
    2088         assert allclose(domain.quantities['ymomentum'].semi_implicit_update, 4*S)
     2082        assert num.allclose(domain.quantities['stage'].semi_implicit_update, 0)
     2083        assert num.allclose(domain.quantities['xmomentum'].semi_implicit_update, 3*S)
     2084        assert num.allclose(domain.quantities['ymomentum'].semi_implicit_update, 4*S)
    20892085
    20902086    def test_constant_wind_stress(self):
     
    21332129
    21342130        #Compute wind stress
    2135         S = const * sqrt(u**2 + v**2)
    2136 
    2137         assert allclose(domain.quantities['stage'].explicit_update, 0)
    2138         assert allclose(domain.quantities['xmomentum'].explicit_update, S*u)
    2139         assert allclose(domain.quantities['ymomentum'].explicit_update, S*v)
     2131        S = const * num.sqrt(u**2 + v**2)
     2132
     2133        assert num.allclose(domain.quantities['stage'].explicit_update, 0)
     2134        assert num.allclose(domain.quantities['xmomentum'].explicit_update, S*u)
     2135        assert num.allclose(domain.quantities['ymomentum'].explicit_update, S*v)
    21402136
    21412137
     
    22002196
    22012197            #Compute wind stress
    2202             S = const * sqrt(u**2 + v**2)
    2203 
    2204             assert allclose(domain.quantities['stage'].explicit_update[k], 0)
    2205             assert allclose(domain.quantities['xmomentum'].explicit_update[k], S*u)
    2206             assert allclose(domain.quantities['ymomentum'].explicit_update[k], S*v)
     2198            S = const * num.sqrt(u**2 + v**2)
     2199
     2200            assert num.allclose(domain.quantities['stage'].explicit_update[k], 0)
     2201            assert num.allclose(domain.quantities['xmomentum'].explicit_update[k], S*u)
     2202            assert num.allclose(domain.quantities['ymomentum'].explicit_update[k], S*v)
    22072203
    22082204
     
    23132309
    23142310        #Compute wind stress
    2315         S = const * sqrt(u**2 + v**2)
     2311        S = const * num.sqrt(u**2 + v**2)
    23162312
    23172313        for k in range(N):
    2318             assert allclose(domain.quantities['stage'].explicit_update[k], 0)
    2319             assert allclose(domain.quantities['xmomentum'].explicit_update[k], S*u)
    2320             assert allclose(domain.quantities['ymomentum'].explicit_update[k], S*v)
     2314            assert num.allclose(domain.quantities['stage'].explicit_update[k], 0)
     2315            assert num.allclose(domain.quantities['xmomentum'].explicit_update[k], S*u)
     2316            assert num.allclose(domain.quantities['ymomentum'].explicit_update[k], S*v)
    23212317
    23222318
     
    24212417
    24222418        #Compute wind stress
    2423         S = const * sqrt(u**2 + v**2)
     2419        S = const * num.sqrt(u**2 + v**2)
    24242420
    24252421        for k in range(N):
    2426             assert allclose(domain.quantities['stage'].explicit_update[k], 0)
    2427             assert allclose(domain.quantities['xmomentum'].explicit_update[k], S*u)
    2428             assert allclose(domain.quantities['ymomentum'].explicit_update[k], S*v)
     2422            assert num.allclose(domain.quantities['stage'].explicit_update[k], 0)
     2423            assert num.allclose(domain.quantities['xmomentum'].explicit_update[k], S*u)
     2424            assert num.allclose(domain.quantities['ymomentum'].explicit_update[k], S*v)
    24292425
    24302426
     
    25262522
    25272523        domain.compute_forcing_terms()
    2528         assert allclose(domain.quantities['stage'].explicit_update, 2.0/1000)
     2524        assert num.allclose(domain.quantities['stage'].explicit_update, 2.0/1000)
    25292525
    25302526
     
    25612557                     polygon = [[1,1], [2,1], [2,2], [1,2]])
    25622558
    2563         assert allclose(R.exchange_area, 1)
     2559        assert num.allclose(R.exchange_area, 1)
    25642560       
    25652561        domain.forcing_terms.append(R)
     
    25682564        #print domain.quantities['stage'].explicit_update
    25692565       
    2570         assert allclose(domain.quantities['stage'].explicit_update[1],
    2571                         2.0/1000)
    2572         assert allclose(domain.quantities['stage'].explicit_update[0], 0)
    2573         assert allclose(domain.quantities['stage'].explicit_update[2:], 0)       
     2566        assert num.allclose(domain.quantities['stage'].explicit_update[1],
     2567                            2.0/1000)
     2568        assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
     2569        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    25742570       
    25752571
     
    26052601                     polygon = [[1,1], [2,1], [2,2], [1,2]])
    26062602
    2607         assert allclose(R.exchange_area, 1)
     2603        assert num.allclose(R.exchange_area, 1)
    26082604       
    26092605        domain.forcing_terms.append(R)
     
    26152611        #print domain.quantities['stage'].explicit_update
    26162612       
    2617         assert allclose(domain.quantities['stage'].explicit_update[1],
    2618                         (3*domain.time+7)/1000)
    2619         assert allclose(domain.quantities['stage'].explicit_update[0], 0)
    2620         assert allclose(domain.quantities['stage'].explicit_update[2:], 0)       
     2613        assert num.allclose(domain.quantities['stage'].explicit_update[1],
     2614                            (3*domain.time+7)/1000)
     2615        assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
     2616        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    26212617       
    26222618
     
    26252621    def test_time_dependent_rainfall_using_starttime(self):
    26262622   
    2627         rainfall_poly = ensure_numeric([[1,1], [2,1], [2,2], [1,2]], Float)   
     2623        rainfall_poly = ensure_numeric([[1,1], [2,1], [2,2], [1,2]], num.Float)   
    26282624
    26292625        a = [0.0, 0.0]
     
    26552651                     polygon=rainfall_poly)                     
    26562652
    2657         assert allclose(R.exchange_area, 1)
     2653        assert num.allclose(R.exchange_area, 1)
    26582654       
    26592655        domain.forcing_terms.append(R)
     
    26692665
    26702666        #print domain.get_time()
    2671         assert allclose(domain.quantities['stage'].explicit_update[1],
    2672                         (3*domain.get_time()+7)/1000)
    2673         assert allclose(domain.quantities['stage'].explicit_update[1],
    2674                         (3*(domain.time + domain.starttime)+7)/1000)
     2667        assert num.allclose(domain.quantities['stage'].explicit_update[1],
     2668                            (3*domain.get_time()+7)/1000)
     2669        assert num.allclose(domain.quantities['stage'].explicit_update[1],
     2670                            (3*(domain.time + domain.starttime)+7)/1000)
    26752671
    26762672        # Using internal time her should fail
    2677         assert not allclose(domain.quantities['stage'].explicit_update[1],
    2678                         (3*domain.time+7)/1000)               
    2679 
    2680         assert allclose(domain.quantities['stage'].explicit_update[0], 0)
    2681         assert allclose(domain.quantities['stage'].explicit_update[2:], 0)       
     2673        assert not num.allclose(domain.quantities['stage'].explicit_update[1],
     2674                                (3*domain.time+7)/1000)               
     2675
     2676        assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
     2677        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    26822678       
    26832679
     
    26962692
    26972693       
    2698         rainfall_poly = ensure_numeric([[1,1], [2,1], [2,2], [1,2]], Float)
     2694        rainfall_poly = ensure_numeric([[1,1], [2,1], [2,2], [1,2]], num.Float)
    26992695        rainfall_poly += [x0, y0]
    27002696
     
    27282724                     polygon=rainfall_poly)
    27292725
    2730         assert allclose(R.exchange_area, 1)
     2726        assert num.allclose(R.exchange_area, 1)
    27312727       
    27322728        domain.forcing_terms.append(R)
     
    27422738
    27432739        #print domain.get_time()
    2744         assert allclose(domain.quantities['stage'].explicit_update[1],
    2745                         (3*domain.get_time()+7)/1000)
    2746         assert allclose(domain.quantities['stage'].explicit_update[1],
    2747                         (3*(domain.time + domain.starttime)+7)/1000)
     2740        assert num.allclose(domain.quantities['stage'].explicit_update[1],
     2741                            (3*domain.get_time()+7)/1000)
     2742        assert num.allclose(domain.quantities['stage'].explicit_update[1],
     2743                            (3*(domain.time + domain.starttime)+7)/1000)
    27482744
    27492745        # Using internal time her should fail
    2750         assert not allclose(domain.quantities['stage'].explicit_update[1],
    2751                         (3*domain.time+7)/1000)               
    2752 
    2753         assert allclose(domain.quantities['stage'].explicit_update[0], 0)
    2754         assert allclose(domain.quantities['stage'].explicit_update[2:], 0)       
     2746        assert not num.allclose(domain.quantities['stage'].explicit_update[1],
     2747                                (3*domain.time+7)/1000)               
     2748
     2749        assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
     2750        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    27552751       
    27562752
     
    28012797                     default_rate=5.0)
    28022798
    2803         assert allclose(R.exchange_area, 1)
     2799        assert num.allclose(R.exchange_area, 1)
    28042800       
    28052801        domain.forcing_terms.append(R)
     
    28112807        #print domain.quantities['stage'].explicit_update
    28122808       
    2813         assert allclose(domain.quantities['stage'].explicit_update[1], (3*domain.time+7)/1000)
    2814         assert allclose(domain.quantities['stage'].explicit_update[0], 0)
    2815         assert allclose(domain.quantities['stage'].explicit_update[2:], 0)       
     2809        assert num.allclose(domain.quantities['stage'].explicit_update[1], (3*domain.time+7)/1000)
     2810        assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
     2811        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    28162812
    28172813
     
    28212817        #print domain.quantities['stage'].explicit_update
    28222818       
    2823         assert allclose(domain.quantities['stage'].explicit_update[1], 5.0/1000) # Default value
    2824         assert allclose(domain.quantities['stage'].explicit_update[0], 0)
    2825         assert allclose(domain.quantities['stage'].explicit_update[2:], 0)       
     2819        assert num.allclose(domain.quantities['stage'].explicit_update[1], 5.0/1000) # Default value
     2820        assert num.allclose(domain.quantities['stage'].explicit_update[0], 0)
     2821        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    28262822       
    28272823
     
    28762872                     default_rate=5.0)
    28772873
    2878         assert allclose(R.exchange_area, 1)
     2874        assert num.allclose(R.exchange_area, 1)
    28792875       
    28802876        domain.forcing_terms.append(R)
     
    29232919        #print domain.quantities['stage'].explicit_update
    29242920       
    2925         assert allclose(domain.quantities['stage'].explicit_update[1], 2.0/pi)
    2926         assert allclose(domain.quantities['stage'].explicit_update[0], 2.0/pi)
    2927         assert allclose(domain.quantities['stage'].explicit_update[2:], 0)       
     2921        assert num.allclose(domain.quantities['stage'].explicit_update[1], 2.0/pi)
     2922        assert num.allclose(domain.quantities['stage'].explicit_update[0], 2.0/pi)
     2923        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    29282924
    29292925
     
    29592955        domain.compute_forcing_terms()
    29602956       
    2961         assert allclose(domain.quantities['stage'].explicit_update[1], 2.0/pi)
    2962         assert allclose(domain.quantities['stage'].explicit_update[0], 2.0/pi)
    2963         assert allclose(domain.quantities['stage'].explicit_update[2:], 0)       
     2957        assert num.allclose(domain.quantities['stage'].explicit_update[1], 2.0/pi)
     2958        assert num.allclose(domain.quantities['stage'].explicit_update[0], 2.0/pi)
     2959        assert num.allclose(domain.quantities['stage'].explicit_update[2:], 0)       
    29642960       
    29652961
     
    30513047        # Check that update values are correct
    30523048        for x in domain.quantities['stage'].explicit_update:
    3053             assert allclose(x, 2.0/pi) or allclose(x, 0.0)
     3049            assert num.allclose(x, 2.0/pi) or num.allclose(x, 0.0)
    30543050
    30553051       
     
    30583054        initial_volume = domain.quantities['stage'].get_integral()
    30593055       
    3060         assert allclose(initial_volume, width*length*stage)
     3056        assert num.allclose(initial_volume, width*length*stage)
    30613057       
    30623058        for t in domain.evolve(yieldstep = 0.05, finaltime = 5.0):
    30633059            volume =  domain.quantities['stage'].get_integral()
    3064             assert allclose (volume, initial_volume)
     3060            assert num.allclose (volume, initial_volume)
    30653061           
    30663062           
     
    30783074                volume = domain.quantities['stage'].get_integral()
    30793075               
    3080                 assert allclose (volume, predicted_volume)           
     3076                assert num.allclose (volume, predicted_volume)           
    30813077                predicted_volume = predicted_volume + 2.0/pi/100/dt # Why 100?
    30823078           
     
    30973093               
    30983094                print t, volume, predicted_volume
    3099                 assert allclose (volume, predicted_volume)           
     3095                assert num.allclose (volume, predicted_volume)           
    31003096                predicted_volume = predicted_volume - 2.0/pi/100/dt # Why 100?           
    31013097           
     
    31183114               
    31193115                print t, volume
    3120                 assert allclose (volume, initial_volume)           
     3116                assert num.allclose (volume, initial_volume)           
    31213117
    31223118           
     
    31443140
    31453141        zl=zr=-3.75 #Assume constant bed (must be less than stage)
    3146         domain.set_quantity('elevation', zl*ones( (4,3) ))
     3142        domain.set_quantity('elevation', zl*num.ones( (4,3) ))
    31473143        domain.set_quantity('stage', [[val0, val0-1, val0-2],
    31483144                                      [val1, val1+1, val1],
     
    31583154        C = domain.quantities['stage'].centroid_values
    31593155        for i in range(3):
    3160             assert allclose( domain.quantities['stage'].vertex_values[:,i], C)
     3156            assert num.allclose( domain.quantities['stage'].vertex_values[:,i], C)
    31613157
    31623158
    31633159    def test_first_order_limiter_variable_z(self):
    31643160        #Check that first order limiter follows bed_slope
    3165         from Numeric import alltrue, greater_equal
    31663161        from anuga.config import epsilon
    31673162
     
    31963191        #Check that some stages are not above elevation (within eps)
    31973192        #- so that the limiter has something to work with
    3198         assert not alltrue(alltrue(greater_equal(L,E-epsilon)))
     3193        assert not num.alltrue(num.alltrue(num.greater_equal(L,E-epsilon)))
    31993194
    32003195        domain._order_ = 1
     
    32023197
    32033198        #Check that all stages are above elevation (within eps)
    3204         assert alltrue(alltrue(greater_equal(L,E-epsilon)))
     3199        assert num.alltrue(num.alltrue(num.greater_equal(L,E-epsilon)))
    32053200
    32063201
     
    32353230        domain._order_ = 1
    32363231        domain.distribute_to_vertices_and_edges()
    3237         assert allclose(L[1], val1)
     3232        assert num.allclose(L[1], val1)
    32383233
    32393234        #Second order
     
    32463241        domain.beta_vh_dry = 0.9
    32473242        domain.distribute_to_vertices_and_edges()
    3248         assert allclose(L[1], [2.2, 4.9, 4.9])
     3243        assert num.allclose(L[1], [2.2, 4.9, 4.9])
    32493244
    32503245
     
    32773272        a, b = domain.quantities['stage'].get_gradients()
    32783273               
    3279         assert allclose(a[1], 3.33333334)
    3280         assert allclose(b[1], 0.0)
     3274        assert num.allclose(a[1], 3.33333334)
     3275        assert num.allclose(b[1], 0.0)
    32813276
    32823277        domain._order_ = 1
    32833278        domain.distribute_to_vertices_and_edges()
    3284         assert allclose(L[1], 1.77777778)
     3279        assert num.allclose(L[1], 1.77777778)
    32853280
    32863281        domain._order_ = 2
     
    32923287        domain.beta_vh_dry = 0.9
    32933288        domain.distribute_to_vertices_and_edges()
    3294         assert allclose(L[1], [0.57777777, 2.37777778, 2.37777778])
     3289        assert num.allclose(L[1], [0.57777777, 2.37777778, 2.37777778])
    32953290
    32963291
     
    33223317        domain.quantities['stage'].compute_gradients()
    33233318        a, b = domain.quantities['stage'].get_gradients()
    3324         assert allclose(a[1], 25.18518519)
    3325         assert allclose(b[1], 3.33333333)
     3319        assert num.allclose(a[1], 25.18518519)
     3320        assert num.allclose(b[1], 3.33333333)
    33263321
    33273322        domain._order_ = 1
    33283323        domain.distribute_to_vertices_and_edges()
    3329         assert allclose(L[1], 4.9382716)
     3324        assert num.allclose(L[1], 4.9382716)
    33303325
    33313326        domain._order_ = 2
     
    33373332        domain.beta_vh_dry = 0.9
    33383333        domain.distribute_to_vertices_and_edges()
    3339         assert allclose(L[1], [1.07160494, 6.46058131, 7.28262855])
     3334        assert num.allclose(L[1], [1.07160494, 6.46058131, 7.28262855])
    33403335
    33413336
     
    33773372        volumes = []
    33783373        for i in range(len(L)):
    3379             volumes.append(sum(L[i])/3)
    3380             assert allclose(volumes[i], domain.quantities['stage'].centroid_values[i]) 
     3374            volumes.append(num.sum(L[i])/3)
     3375            assert num.allclose(volumes[i], domain.quantities['stage'].centroid_values[i]) 
    33813376       
    33823377       
     
    33853380        domain.tight_slope_limiters = 0
    33863381        domain.distribute_to_vertices_and_edges()
    3387         assert allclose(L[1], [0.1, 20.1, 20.1])
     3382        assert num.allclose(L[1], [0.1, 20.1, 20.1])
    33883383        for i in range(len(L)):
    3389             assert allclose(volumes[i], sum(L[i])/3)                   
     3384            assert num.allclose(volumes[i], num.sum(L[i])/3)                   
    33903385       
    33913386        domain.tight_slope_limiters = 1 # Allow triangle to be flatter (closer to bed)
    33923387        domain.distribute_to_vertices_and_edges()
    3393         assert allclose(L[1], [0.298, 20.001, 20.001])
     3388        assert num.allclose(L[1], [0.298, 20.001, 20.001])
    33943389        for i in range(len(L)):
    3395             assert allclose(volumes[i], sum(L[i])/3)   
     3390            assert num.allclose(volumes[i], num.sum(L[i])/3)   
    33963391
    33973392        domain._order_ = 2
     
    33993394        domain.tight_slope_limiters = 0
    34003395        domain.distribute_to_vertices_and_edges()
    3401         assert allclose(L[1], [0.1, 20.1, 20.1])       
     3396        assert num.allclose(L[1], [0.1, 20.1, 20.1])       
    34023397        for i in range(len(L)):
    3403             assert allclose(volumes[i], sum(L[i])/3)           
     3398            assert num.allclose(volumes[i], num.sum(L[i])/3)           
    34043399       
    34053400        domain.tight_slope_limiters = 1 # Allow triangle to be flatter (closer to bed)
    34063401        domain.distribute_to_vertices_and_edges()
    3407         assert allclose(L[1], [0.298, 20.001, 20.001])
     3402        assert num.allclose(L[1], [0.298, 20.001, 20.001])
    34083403        for i in range(len(L)):
    3409             assert allclose(volumes[i], sum(L[i])/3)   
     3404            assert num.allclose(volumes[i], num.sum(L[i])/3)   
    34103405       
    34113406
     
    34473442        volumes = []
    34483443        for i in range(len(L)):
    3449             volumes.append(sum(L[i])/3)
    3450             assert allclose(volumes[i], domain.quantities['stage'].centroid_values[i]) 
     3444            volumes.append(num.sum(L[i])/3)
     3445            assert num.allclose(volumes[i], domain.quantities['stage'].centroid_values[i]) 
    34513446       
    34523447        #print E
     
    34553450        domain.tight_slope_limiters = 0
    34563451        domain.distribute_to_vertices_and_edges()
    3457         assert allclose(L[1], [4.1, 16.1, 20.1])       
     3452        assert num.allclose(L[1], [4.1, 16.1, 20.1])       
    34583453        for i in range(len(L)):
    3459             assert allclose(volumes[i], sum(L[i])/3)
     3454            assert num.allclose(volumes[i], num.sum(L[i])/3)
    34603455       
    34613456               
    34623457        domain.tight_slope_limiters = 1 # Allow triangle to be flatter (closer to bed)
    34633458        domain.distribute_to_vertices_and_edges()
    3464         assert allclose(L[1], [4.2386, 16.0604, 20.001])
     3459        assert num.allclose(L[1], [4.2386, 16.0604, 20.001])
    34653460        for i in range(len(L)):
    3466             assert allclose(volumes[i], sum(L[i])/3)   
     3461            assert num.allclose(volumes[i], num.sum(L[i])/3)   
    34673462       
    34683463
     
    34713466        domain.tight_slope_limiters = 0   
    34723467        domain.distribute_to_vertices_and_edges()
    3473         assert allclose(L[1], [4.1, 16.1, 20.1])
     3468        assert num.allclose(L[1], [4.1, 16.1, 20.1])
    34743469        for i in range(len(L)):
    3475             assert allclose(volumes[i], sum(L[i])/3)   
     3470            assert num.allclose(volumes[i], num.sum(L[i])/3)   
    34763471       
    34773472        domain.tight_slope_limiters = 1 # Allow triangle to be flatter (closer to bed)
    34783473        domain.distribute_to_vertices_and_edges()
    34793474        #print L[1]
    3480         assert allclose(L[1], [4.23370103, 16.06529897, 20.001]) or\
    3481                allclose(L[1], [4.18944138, 16.10955862, 20.001]) or\
    3482                allclose(L[1], [4.19351461, 16.10548539, 20.001]) # old limiters
     3475        assert num.allclose(L[1], [4.23370103, 16.06529897, 20.001]) or\
     3476               num.allclose(L[1], [4.18944138, 16.10955862, 20.001]) or\
     3477               num.allclose(L[1], [4.19351461, 16.10548539, 20.001]) # old limiters
    34833478       
    34843479        for i in range(len(L)):
    3485             assert allclose(volumes[i], sum(L[i])/3)
     3480            assert num.allclose(volumes[i], num.sum(L[i])/3)
    34863481
    34873482
     
    35463541        #print Y[1,:]
    35473542
    3548         assert allclose(L[1,:], [-0.00825735775384,
    3549                                  -0.00801881482869,
    3550                                  0.0272445025825])
    3551         assert allclose(X[1,:], [0.0143507718962,
    3552                                  0.0142502147066,
    3553                                  0.00931268339717])
    3554         assert allclose(Y[1,:], [-0.000117062180693,
    3555                                  7.94434448109e-005,
    3556                                  -0.000151505429018])
     3543        assert num.allclose(L[1,:], [-0.00825735775384,
     3544                                     -0.00801881482869,
     3545                                     0.0272445025825])
     3546        assert num.allclose(X[1,:], [0.0143507718962,
     3547                                     0.0142502147066,
     3548                                     0.00931268339717])
     3549        assert num.allclose(Y[1,:], [-0.000117062180693,
     3550                                     7.94434448109e-005,
     3551                                     -0.000151505429018])
    35573552
    35583553
     
    35913586
    35923587        #Assert that quantities are conserved
    3593         from Numeric import sum
    35943588        for k in range(len(domain)):
    3595             assert allclose (ref_centroid_values[k],
    3596                              sum(stage.vertex_values[k,:])/3)
     3589            assert num.allclose (ref_centroid_values[k],
     3590                                 num.sum(stage.vertex_values[k,:])/3)
    35973591
    35983592
     
    36173611        for k in range(len(domain)):
    36183612            #print ref_vertex_values[k,:], stage.vertex_values[k,:]
    3619             assert not allclose (ref_vertex_values[k,:], stage.vertex_values[k,:])
     3613            assert not num.allclose (ref_vertex_values[k,:], stage.vertex_values[k,:])
    36203614        #and assert that quantities are still conserved
    3621         from Numeric import sum
    36223615        for k in range(len(domain)):
    3623             assert allclose (ref_centroid_values[k],
    3624                              sum(stage.vertex_values[k,:])/3)
     3616            assert num.allclose (ref_centroid_values[k],
     3617                                 num.sum(stage.vertex_values[k,:])/3)
    36253618
    36263619
    36273620        # Check actual results
    3628         assert allclose (stage.vertex_values,
    3629                          [[2,2,2],
    3630                           [1.93333333, 2.03333333, 6.03333333],
    3631                           [6.93333333, 4.53333333, 4.53333333],
    3632                           [5.33333333, 5.33333333, 5.33333333]])
     3621        assert num.allclose (stage.vertex_values,
     3622                             [[2,2,2],
     3623                              [1.93333333, 2.03333333, 6.03333333],
     3624                              [6.93333333, 4.53333333, 4.53333333],
     3625                              [5.33333333, 5.33333333, 5.33333333]])
    36333626
    36343627
     
    36663659
    36673660        #Assert that quantities are conserved
    3668         from Numeric import sum
    36693661        for k in range(len(domain)):
    3670             assert allclose (ref_centroid_values[k],
    3671                              sum(stage.vertex_values[k,:])/3)
     3662            assert num.allclose (ref_centroid_values[k],
     3663                                 num.sum(stage.vertex_values[k,:])/3)
    36723664
    36733665
     
    36923684        for k in range(len(domain)):
    36933685            #print ref_vertex_values[k,:], stage.vertex_values[k,:]
    3694             assert not allclose (ref_vertex_values[k,:], stage.vertex_values[k,:])
     3686            assert not num.allclose (ref_vertex_values[k,:], stage.vertex_values[k,:])
    36953687        #and assert that quantities are still conserved
    3696         from Numeric import sum
    36973688        for k in range(len(domain)):
    3698             assert allclose (ref_centroid_values[k],
    3699                              sum(stage.vertex_values[k,:])/3)
     3689            assert num.allclose (ref_centroid_values[k],
     3690                                 num.sum(stage.vertex_values[k,:])/3)
    37003691
    37013692
     
    37173708        """
    37183709        import copy
    3719         from Numeric import sqrt, absolute
    37203710
    37213711        a = [0.0, 0.0]
     
    37713761
    37723762        # Verify interpolation
    3773         assert allclose(stage.centroid_values[1], 1.5233)
    3774         assert allclose(elevation.centroid_values[1], 1.2452667)
    3775         assert allclose(xmomentum.centroid_values[1], -0.0058)
    3776         assert allclose(ymomentum.centroid_values[1], 0.089)
     3763        assert num.allclose(stage.centroid_values[1], 1.5233)
     3764        assert num.allclose(elevation.centroid_values[1], 1.2452667)
     3765        assert num.allclose(xmomentum.centroid_values[1], -0.0058)
     3766        assert num.allclose(ymomentum.centroid_values[1], 0.089)
    37773767
    37783768        # Derived quantities
     
    37873777   
    37883778        # Verify against Onslow example (14 Nov 2007)
    3789         assert allclose(depth.centroid_values[1], 0.278033)
    3790         assert allclose(u.centroid_values[1], -0.0208608)
    3791         assert allclose(v.centroid_values[1], 0.3201055)
    3792 
    3793         assert allclose(denom.centroid_values[1],
    3794                         sqrt(depth.centroid_values[1]*g))
    3795 
    3796         assert allclose(u.centroid_values[1]/denom.centroid_values[1],
    3797                         -0.012637746977)
    3798         assert allclose(Fx.centroid_values[1],
    3799                         u.centroid_values[1]/denom.centroid_values[1])
     3779        assert num.allclose(depth.centroid_values[1], 0.278033)
     3780        assert num.allclose(u.centroid_values[1], -0.0208608)
     3781        assert num.allclose(v.centroid_values[1], 0.3201055)
     3782
     3783        assert num.allclose(denom.centroid_values[1],
     3784                            num.sqrt(depth.centroid_values[1]*g))
     3785
     3786        assert num.allclose(u.centroid_values[1]/denom.centroid_values[1],
     3787                            -0.012637746977)
     3788        assert num.allclose(Fx.centroid_values[1],
     3789                            u.centroid_values[1]/denom.centroid_values[1])
    38003790
    38013791        # Check that Froude numbers are small at centroids.
    3802         assert allclose(Fx.centroid_values[1], -0.012637746977)
    3803         assert allclose(Fy.centroid_values[1], 0.193924048435)
     3792        assert num.allclose(Fx.centroid_values[1], -0.012637746977)
     3793        assert num.allclose(Fy.centroid_values[1], 0.193924048435)
    38043794
    38053795
    38063796        # But Froude numbers are huge at some vertices and edges
    3807         assert allclose(Fx.vertex_values[1,:], [-5.85888475e+01,
    3808                                                 -1.27775313e+01,
    3809                                                 -2.78511420e-03])
    3810 
    3811         assert allclose(Fx.edge_values[1,:], [-6.89150773e-03,
    3812                                               -7.38672488e-03,
    3813                                               -2.35626238e+01])
    3814 
    3815         assert allclose(Fy.vertex_values[1,:], [8.99035764e+02,
    3816                                                 2.27440057e+02,
    3817                                                 3.75568430e-02])
    3818 
    3819         assert allclose(Fy.edge_values[1,:], [1.05748998e-01,
    3820                                               1.06035244e-01,
    3821                                               3.88346947e+02])
     3797        assert num.allclose(Fx.vertex_values[1,:], [-5.85888475e+01,
     3798                                                    -1.27775313e+01,
     3799                                                    -2.78511420e-03])
     3800
     3801        assert num.allclose(Fx.edge_values[1,:], [-6.89150773e-03,
     3802                                                  -7.38672488e-03,
     3803                                                  -2.35626238e+01])
     3804
     3805        assert num.allclose(Fy.vertex_values[1,:], [8.99035764e+02,
     3806                                                    2.27440057e+02,
     3807                                                    3.75568430e-02])
     3808
     3809        assert num.allclose(Fy.edge_values[1,:], [1.05748998e-01,
     3810                                                  1.06035244e-01,
     3811                                                  3.88346947e+02])
    38223812       
    38233813       
     
    38443834        #print u.centroid_values[1]
    38453835       
    3846         assert alltrue(absolute(u.vertex_values[1,:]) <= absolute(u.centroid_values[1])*10)
    3847         assert alltrue(absolute(v.vertex_values[1,:]) <= absolute(v.centroid_values[1])*10)
     3836        assert num.alltrue(num.absolute(u.vertex_values[1,:]) <= num.absolute(u.centroid_values[1])*10)
     3837        assert num.alltrue(num.absolute(v.vertex_values[1,:]) <= num.absolute(v.centroid_values[1])*10)
    38483838
    38493839        denom = (depth*g)**0.5
     
    38553845        # at vertices, edges and centroids.
    38563846        from anuga.config import maximum_froude_number
    3857         assert alltrue(absolute(Fx.vertex_values[1,:]) < maximum_froude_number)
    3858         assert alltrue(absolute(Fy.vertex_values[1,:]) < maximum_froude_number)
     3847        assert num.alltrue(num.absolute(Fx.vertex_values[1,:]) < maximum_froude_number)
     3848        assert num.alltrue(num.absolute(Fy.vertex_values[1,:]) < maximum_froude_number)
    38593849
    38603850
     
    38623852        for k in range(len(domain)):
    38633853            #print ref_vertex_values[k,:], stage.vertex_values[k,:]
    3864             assert not allclose (ref_vertex_values[k,:],
    3865                                  stage.vertex_values[k,:])
     3854            assert not num.allclose (ref_vertex_values[k,:],
     3855                                     stage.vertex_values[k,:])
    38663856           
    38673857        # Assert that quantities are still conserved
    3868         from Numeric import sum
    38693858        for k in range(len(domain)):
    3870             assert allclose (ref_centroid_values[k],
    3871                              sum(stage.vertex_values[k,:])/3)
     3859            assert num.allclose (ref_centroid_values[k],
     3860                                 num.sum(stage.vertex_values[k,:])/3)
    38723861
    38733862
     
    39103899        """
    39113900        from mesh_factory import rectangular
    3912         from Numeric import array
    39133901
    39143902        #Create basic mesh
     
    39423930        for t in domain.evolve(yieldstep = 0.05, finaltime = 5.0):
    39433931            volume =  domain.quantities['stage'].get_integral()
    3944             assert allclose (volume, initial_volume)
     3932            assert num.allclose (volume, initial_volume)
    39453933
    39463934            #I don't believe that the total momentum should be the same
     
    39603948        """
    39613949        from mesh_factory import rectangular
    3962         from Numeric import array
    39633950
    39643951        #Create basic mesh
     
    39923979        for t in domain.evolve(yieldstep = 0.05, finaltime = 5.0):
    39933980            volume =  domain.quantities['stage'].get_integral()
    3994             assert allclose (volume, initial_volume)
     3981            assert num.allclose (volume, initial_volume)
    39953982
    39963983            #FIXME: What would we expect from momentum
     
    40083995        """
    40093996        from mesh_factory import rectangular
    4010         from Numeric import array
    40113997
    40123998        #Create basic mesh
     
    40574043
    40584044        #print domain.quantities['stage'].centroid_values
    4059         assert allclose(domain.quantities['stage'].centroid_values,
    4060                         ref_centroid_values)
     4045        assert num.allclose(domain.quantities['stage'].centroid_values,
     4046                            ref_centroid_values)
    40614047
    40624048
    40634049        #Check that initial limiter doesn't violate cons quan
    4064         assert allclose(domain.quantities['stage'].get_integral(),
    4065                         initial_volume)
     4050        assert num.allclose(domain.quantities['stage'].get_integral(),
     4051                            initial_volume)
    40664052
    40674053        #Evolution
     
    40694055            volume =  domain.quantities['stage'].get_integral()
    40704056            #print t, volume, initial_volume
    4071             assert allclose (volume, initial_volume)
     4057            assert num.allclose (volume, initial_volume)
    40724058
    40734059        os.remove(domain.get_name() + '.sww')
     
    40804066        """
    40814067        from mesh_factory import rectangular
    4082         from Numeric import array
    40834068
    40844069        #Create basic mesh
     
    41304115
    41314116        #Check that initial limiter doesn't violate cons quan
    4132         assert allclose (domain.quantities['stage'].get_integral(),
    4133                          initial_volume)
     4117        assert num.allclose (domain.quantities['stage'].get_integral(),
     4118                             initial_volume)
    41344119        #NOTE: This would fail if any initial stage was less than the
    41354120        #corresponding bed elevation - but that is reasonable.
     
    41424127            #print t, volume, initial_volume
    41434128
    4144             assert allclose (volume, initial_volume)
     4129            assert num.allclose (volume, initial_volume)
    41454130
    41464131
     
    41554140        """
    41564141        from mesh_factory import rectangular
    4157         from Numeric import array
    41584142
    41594143        # Create basic mesh
     
    41924176            ymom = domain.quantities['ymomentum'].get_integral()
    41934177
    4194             if allclose(t, 6):  # Steady state reached
     4178            if num.allclose(t, 6):  # Steady state reached
    41954179                steady_xmom = domain.quantities['xmomentum'].get_integral()
    41964180                steady_ymom = domain.quantities['ymomentum'].get_integral()
     
    42004184                #print '%.2f %14.8f %14.8f' %(t, ymom, steady_ymom)
    42014185                msg = 'xmom=%.2f, steady_xmom=%.2f' %(xmom, steady_xmom)
    4202                 assert allclose(xmom, steady_xmom), msg
    4203                 assert allclose(ymom, steady_ymom)
    4204                 assert allclose(stage, steady_stage)
     4186                assert num.allclose(xmom, steady_xmom), msg
     4187                assert num.allclose(ymom, steady_ymom)
     4188                assert num.allclose(stage, steady_stage)
    42054189
    42064190
     
    42694253
    42704254        msg = 'Stage not conserved: was %f, now %f' %(ref, now)
    4271         assert allclose(ref, now), msg
     4255        assert num.allclose(ref, now), msg
    42724256
    42734257        os.remove(domain.get_name() + '.sww')
     
    42764260
    42774261        from mesh_factory import rectangular
    4278         from Numeric import array
    42794262
    42804263        #Create basic mesh
     
    43054288
    43064289        # Data from earlier version of abstract_2d_finite_volumes
    4307         assert allclose(domain.min_timestep, 0.0396825396825)
    4308         assert allclose(domain.max_timestep, 0.0396825396825)
    4309 
    4310         assert allclose(domain.quantities['stage'].centroid_values[:12],
    4311                         [0.00171396, 0.02656103, 0.00241523, 0.02656103,
    4312                         0.00241523, 0.02656103, 0.00241523, 0.02656103,
    4313                         0.00241523, 0.02656103, 0.00241523, 0.0272623])
     4290        assert num.allclose(domain.min_timestep, 0.0396825396825)
     4291        assert num.allclose(domain.max_timestep, 0.0396825396825)
     4292
     4293        assert num.allclose(domain.quantities['stage'].centroid_values[:12],
     4294                            [0.00171396, 0.02656103, 0.00241523, 0.02656103,
     4295                             0.00241523, 0.02656103, 0.00241523, 0.02656103,
     4296                             0.00241523, 0.02656103, 0.00241523, 0.0272623])
    43144297
    43154298        domain.distribute_to_vertices_and_edges()
    43164299
    4317         assert allclose(domain.quantities['stage'].vertex_values[:12,0],
    4318                         [0.0001714, 0.02656103, 0.00024152,
    4319                         0.02656103, 0.00024152, 0.02656103,
    4320                         0.00024152, 0.02656103, 0.00024152,
    4321                         0.02656103, 0.00024152, 0.0272623])
    4322 
    4323         assert allclose(domain.quantities['stage'].vertex_values[:12,1],
    4324                         [0.00315012, 0.02656103, 0.00024152, 0.02656103,
    4325                          0.00024152, 0.02656103, 0.00024152, 0.02656103,
    4326                          0.00024152, 0.02656103, 0.00040506, 0.0272623])
    4327 
    4328         assert allclose(domain.quantities['stage'].vertex_values[:12,2],
    4329                         [0.00182037, 0.02656103, 0.00676264,
    4330                          0.02656103, 0.00676264, 0.02656103,
    4331                          0.00676264, 0.02656103, 0.00676264,
    4332                          0.02656103, 0.0065991, 0.0272623])
    4333 
    4334         assert allclose(domain.quantities['xmomentum'].centroid_values[:12],
    4335                         [0.00113961, 0.01302432, 0.00148672,
    4336                          0.01302432, 0.00148672, 0.01302432,
    4337                          0.00148672, 0.01302432, 0.00148672 ,
    4338                          0.01302432, 0.00148672, 0.01337143])
    4339 
    4340         assert allclose(domain.quantities['ymomentum'].centroid_values[:12],
    4341                         [-2.91240050e-004 , 1.22721531e-004,
    4342                          -1.22721531e-004, 1.22721531e-004 ,
    4343                          -1.22721531e-004, 1.22721531e-004,
    4344                          -1.22721531e-004 , 1.22721531e-004,
    4345                          -1.22721531e-004, 1.22721531e-004,
    4346                          -1.22721531e-004, -4.57969873e-005])
     4300        assert num.allclose(domain.quantities['stage'].vertex_values[:12,0],
     4301                            [0.0001714, 0.02656103, 0.00024152,
     4302                             0.02656103, 0.00024152, 0.02656103,
     4303                             0.00024152, 0.02656103, 0.00024152,
     4304                             0.02656103, 0.00024152, 0.0272623])
     4305
     4306        assert num.allclose(domain.quantities['stage'].vertex_values[:12,1],
     4307                            [0.00315012, 0.02656103, 0.00024152, 0.02656103,
     4308                             0.00024152, 0.02656103, 0.00024152, 0.02656103,
     4309                             0.00024152, 0.02656103, 0.00040506, 0.0272623])
     4310
     4311        assert num.allclose(domain.quantities['stage'].vertex_values[:12,2],
     4312                            [0.00182037, 0.02656103, 0.00676264,
     4313                             0.02656103, 0.00676264, 0.02656103,
     4314                             0.00676264, 0.02656103, 0.00676264,
     4315                             0.02656103, 0.0065991, 0.0272623])
     4316
     4317        assert num.allclose(domain.quantities['xmomentum'].centroid_values[:12],
     4318                            [0.00113961, 0.01302432, 0.00148672,
     4319                             0.01302432, 0.00148672, 0.01302432,
     4320                             0.00148672, 0.01302432, 0.00148672 ,
     4321                             0.01302432, 0.00148672, 0.01337143])
     4322
     4323        assert num.allclose(domain.quantities['ymomentum'].centroid_values[:12],
     4324                            [-2.91240050e-004 , 1.22721531e-004,
     4325                             -1.22721531e-004, 1.22721531e-004 ,
     4326                             -1.22721531e-004, 1.22721531e-004,
     4327                             -1.22721531e-004 , 1.22721531e-004,
     4328                             -1.22721531e-004, 1.22721531e-004,
     4329                             -1.22721531e-004, -4.57969873e-005])
    43474330
    43484331        os.remove(domain.get_name() + '.sww')
     
    43524335
    43534336        from mesh_factory import rectangular
    4354         from Numeric import array
    43554337
    43564338        #Create basic mesh
     
    43834365    def test_flatbed_first_order(self):
    43844366        from mesh_factory import rectangular
    4385         from Numeric import array
    43864367
    43874368        #Create basic mesh
     
    44164397            #                [0.10730244,0.12337617,0.11200126,0.12605666])
    44174398
    4418             assert allclose(domain.quantities['xmomentum'].edge_values[:4,i],
    4419                             [0.07610894,0.06901572,0.07284461,0.06819712])
     4399            assert num.allclose(domain.quantities['xmomentum'].edge_values[:4,i],
     4400                                [0.07610894,0.06901572,0.07284461,0.06819712])
    44204401
    44214402            #assert allclose(domain.quantities['ymomentum'].edge_values[:4,i],
     
    44274408    def test_flatbed_second_order(self):
    44284409        from mesh_factory import rectangular
    4429         from Numeric import array
    44304410
    44314411        #Create basic mesh
     
    44624442                                                0.0210448446782)
    44634443
    4464         assert allclose(domain.min_timestep, 0.0210448446782), msg
    4465         assert allclose(domain.max_timestep, 0.0210448446782)
     4444        assert num.allclose(domain.min_timestep, 0.0210448446782), msg
     4445        assert num.allclose(domain.max_timestep, 0.0210448446782)
    44664446
    44674447        #print domain.quantities['stage'].vertex_values[:4,0]
     
    44784458        #                [ 0.00064835, 0.03685719, 0.00085073, 0.03687313])
    44794459       
    4480         assert allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
    4481                         [ 0.00090581, 0.03685719, 0.00088303, 0.03687313])
     4460        assert num.allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
     4461                            [ 0.00090581, 0.03685719, 0.00088303, 0.03687313])
    44824462                       
    44834463                       
     
    44864466        #                [0.00090581,0.03685719,0.00088303,0.03687313])
    44874467
    4488         assert allclose(domain.quantities['ymomentum'].vertex_values[:4,0],
    4489                         [-0.00139463,0.0006156,-0.00060364,0.00061827])
     4468        assert num.allclose(domain.quantities['ymomentum'].vertex_values[:4,0],
     4469                            [-0.00139463,0.0006156,-0.00060364,0.00061827])
    44904470
    44914471
     
    44954475    def test_flatbed_second_order_vmax_0(self):
    44964476        from mesh_factory import rectangular
    4497         from Numeric import array
    44984477
    44994478        #Create basic mesh
     
    45274506
    45284507
    4529         assert allclose(domain.min_timestep, 0.0210448446782)
    4530         assert allclose(domain.max_timestep, 0.0210448446782)
     4508        assert num.allclose(domain.min_timestep, 0.0210448446782)
     4509        assert num.allclose(domain.max_timestep, 0.0210448446782)
    45314510
    45324511        #FIXME: These numbers were from version before 21/3/6 -
    45334512        #could be recreated by setting maximum_allowed_speed to 0 maybe
    4534         assert allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
    4535                         [ 0.00064835, 0.03685719, 0.00085073, 0.03687313])
    4536        
    4537 
    4538         assert allclose(domain.quantities['ymomentum'].vertex_values[:4,0],
    4539                         [-0.00139463,0.0006156,-0.00060364,0.00061827])
     4513        assert num.allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
     4514                            [ 0.00064835, 0.03685719, 0.00085073, 0.03687313])
     4515       
     4516
     4517        assert num.allclose(domain.quantities['ymomentum'].vertex_values[:4,0],
     4518                            [-0.00139463,0.0006156,-0.00060364,0.00061827])
    45404519
    45414520
     
    45484527        #painfully setup and extracted.
    45494528        from mesh_factory import rectangular
    4550         from Numeric import array
    45514529
    45524530        #Create basic mesh
     
    45804558            if V:
    45814559                #Set centroids as if system had been evolved
    4582                 L = zeros(2*N*N, Float)
     4560                L = num.zeros(2*N*N, num.Float)
    45834561                L[:32] = [7.21205592e-003, 5.35214298e-002, 1.00910824e-002,
    45844562                          5.35439433e-002, 1.00910824e-002, 5.35439433e-002,
     
    45934571                          0.00000000e+000, 5.57305948e-005]
    45944572
    4595                 X = zeros(2*N*N, Float)
     4573                X = num.zeros(2*N*N, num.Float)
    45964574                X[:32] = [6.48351607e-003, 3.68571894e-002, 8.50733285e-003,
    45974575                          3.68731327e-002, 8.50733285e-003, 3.68731327e-002,
     
    46064584                          0.00000000e+000, 4.57662812e-005]
    46074585
    4608                 Y = zeros(2*N*N, Float)
     4586                Y = num.zeros(2*N*N, num.Float)
    46094587                Y[:32]=[-1.39463104e-003, 6.15600298e-004, -6.03637382e-004,
    46104588                        6.18272251e-004, -6.03637382e-004, 6.18272251e-004,
     
    46294607                for t in domain.evolve(yieldstep = 0.01, finaltime = 0.03):
    46304608                    pass
    4631                 assert allclose(domain.min_timestep, 0.0210448446782)
    4632                 assert allclose(domain.max_timestep, 0.0210448446782)
     4609                assert num.allclose(domain.min_timestep, 0.0210448446782)
     4610                assert num.allclose(domain.max_timestep, 0.0210448446782)
    46334611
    46344612
    46354613            #Centroids were correct but not vertices.
    46364614            #Hence the check of distribute below.
    4637             assert allclose(domain.quantities['stage'].centroid_values[:4],
    4638                             [0.00721206,0.05352143,0.01009108,0.05354394])
    4639 
    4640             assert allclose(domain.quantities['xmomentum'].centroid_values[:4],
    4641                             [0.00648352,0.03685719,0.00850733,0.03687313])
    4642 
    4643             assert allclose(domain.quantities['ymomentum'].centroid_values[:4],
    4644                             [-0.00139463,0.0006156,-0.00060364,0.00061827])
     4615            assert num.allclose(domain.quantities['stage'].centroid_values[:4],
     4616                                [0.00721206,0.05352143,0.01009108,0.05354394])
     4617
     4618            assert num.allclose(domain.quantities['xmomentum'].centroid_values[:4],
     4619                                [0.00648352,0.03685719,0.00850733,0.03687313])
     4620
     4621            assert num.allclose(domain.quantities['ymomentum'].centroid_values[:4],
     4622                                [-0.00139463,0.0006156,-0.00060364,0.00061827])
    46454623
    46464624            #print 'C17=', domain.quantities['xmomentum'].centroid_values[17]
     
    46554633               
    46564634                #assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.0)               
    4657                 assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.000286060839592)                         
     4635                assert num.allclose(domain.quantities['xmomentum'].centroid_values[17], 0.000286060839592)                         
    46584636
    46594637            else:
    4660                 assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.00028606084)
     4638                assert num.allclose(domain.quantities['xmomentum'].centroid_values[17], 0.00028606084)
    46614639
    46624640            import copy
    46634641            XX = copy.copy(domain.quantities['xmomentum'].centroid_values)
    4664             assert allclose(domain.quantities['xmomentum'].centroid_values, XX)
     4642            assert num.allclose(domain.quantities['xmomentum'].centroid_values, XX)
    46654643
    46664644            domain.distribute_to_vertices_and_edges()
     
    46704648            #assert allclose(domain.quantities['xmomentum'].centroid_values[17],
    46714649            #                0.0)
    4672             assert allclose(domain.quantities['xmomentum'].centroid_values[17], 0.000286060839592)                                                 
     4650            assert num.allclose(domain.quantities['xmomentum'].centroid_values[17], 0.000286060839592)                                                 
    46734651
    46744652
     
    46774655            #                [0.00101913,0.05352143,0.00104852,0.05354394])
    46784656
    4679             assert allclose(domain.quantities['ymomentum'].vertex_values[:4,0],
    4680                             [-0.00139463,0.0006156,-0.00060364,0.00061827])
    4681 
    4682 
    4683             assert allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
    4684                             [0.00090581,0.03685719,0.00088303,0.03687313])
     4657            assert num.allclose(domain.quantities['ymomentum'].vertex_values[:4,0],
     4658                                [-0.00139463,0.0006156,-0.00060364,0.00061827])
     4659
     4660
     4661            assert num.allclose(domain.quantities['xmomentum'].vertex_values[:4,0],
     4662                                [0.00090581,0.03685719,0.00088303,0.03687313])
    46854663
    46864664
     
    47034681
    47044682        from mesh_factory import rectangular
    4705         from Numeric import array
    47064683
    47074684        #Create basic mesh
     
    47434720
    47444721        from mesh_factory import rectangular
    4745         from Numeric import array
    47464722
    47474723        #Create basic mesh
     
    47794755        #print domain.quantities['stage'].centroid_values
    47804756
    4781         assert allclose(domain.quantities['stage'].centroid_values,
    4782                         [-0.02998628, -0.01520652, -0.03043492,
    4783                         -0.0149132, -0.03004706, -0.01476251,
    4784                         -0.0298215, -0.01467976, -0.02988158,
    4785                         -0.01474662, -0.03036161, -0.01442995,
    4786                         -0.07624583, -0.06297061, -0.07733792,
    4787                         -0.06342237, -0.07695439, -0.06289595,
    4788                         -0.07635559, -0.0626065, -0.07633628,
    4789                         -0.06280072, -0.07739632, -0.06386738,
    4790                         -0.12161738, -0.11028239, -0.1223796,
    4791                         -0.11095953, -0.12189744, -0.11048616,
    4792                         -0.12074535, -0.10987605, -0.12014311,
    4793                         -0.10976691, -0.12096859, -0.11087692,
    4794                         -0.16868259, -0.15868061, -0.16801135,
    4795                         -0.1588003, -0.16674343, -0.15813323,
    4796                         -0.16457595, -0.15693826, -0.16281096,
    4797                         -0.15585154, -0.16283873, -0.15540068,
    4798                         -0.17450362, -0.19919913, -0.18062882,
    4799                         -0.19764131, -0.17783111, -0.19407213,
    4800                         -0.1736915, -0.19053624, -0.17228678,
    4801                         -0.19105634, -0.17920133, -0.1968828,
    4802                         -0.14244395, -0.14604641, -0.14473537,
    4803                         -0.1506107, -0.14510055, -0.14919522,
    4804                         -0.14175896, -0.14560798, -0.13911658,
    4805                         -0.14439383, -0.13924047, -0.14829043])
     4757        assert num.allclose(domain.quantities['stage'].centroid_values,
     4758                            [-0.02998628, -0.01520652, -0.03043492,
     4759                             -0.0149132, -0.03004706, -0.01476251,
     4760                             -0.0298215, -0.01467976, -0.02988158,
     4761                             -0.01474662, -0.03036161, -0.01442995,
     4762                             -0.07624583, -0.06297061, -0.07733792,
     4763                             -0.06342237, -0.07695439, -0.06289595,
     4764                             -0.07635559, -0.0626065, -0.07633628,
     4765                             -0.06280072, -0.07739632, -0.06386738,
     4766                             -0.12161738, -0.11028239, -0.1223796,
     4767                             -0.11095953, -0.12189744, -0.11048616,
     4768                             -0.12074535, -0.10987605, -0.12014311,
     4769                             -0.10976691, -0.12096859, -0.11087692,
     4770                             -0.16868259, -0.15868061, -0.16801135,
     4771                             -0.1588003, -0.16674343, -0.15813323,
     4772                             -0.16457595, -0.15693826, -0.16281096,
     4773                             -0.15585154, -0.16283873, -0.15540068,
     4774                             -0.17450362, -0.19919913, -0.18062882,
     4775                             -0.19764131, -0.17783111, -0.19407213,
     4776                             -0.1736915, -0.19053624, -0.17228678,
     4777                             -0.19105634, -0.17920133, -0.1968828,
     4778                             -0.14244395, -0.14604641, -0.14473537,
     4779                             -0.1506107, -0.14510055, -0.14919522,
     4780                             -0.14175896, -0.14560798, -0.13911658,
     4781                             -0.14439383, -0.13924047, -0.14829043])
    48064782
    48074783        os.remove(domain.get_name() + '.sww')
     
    48104786
    48114787        from mesh_factory import rectangular
    4812         from Numeric import array
    48134788
    48144789        #Create basic mesh
     
    48454820        domain.check_integrity()
    48464821
    4847         assert allclose(domain.quantities['stage'].centroid_values,
    4848                         [0.01296296, 0.03148148, 0.01296296,
    4849                         0.03148148, 0.01296296, 0.03148148,
    4850                         0.01296296, 0.03148148, 0.01296296,
    4851                         0.03148148, 0.01296296, 0.03148148,
    4852                         -0.04259259, -0.02407407, -0.04259259,
    4853                         -0.02407407, -0.04259259, -0.02407407,
    4854                         -0.04259259, -0.02407407, -0.04259259,
    4855                         -0.02407407, -0.04259259, -0.02407407,
    4856                         -0.09814815, -0.07962963, -0.09814815,
    4857                         -0.07962963, -0.09814815, -0.07962963,
    4858                         -0.09814815, -0.07962963, -0.09814815,
    4859                         -0.07962963, -0.09814815, -0.07962963,
    4860                         -0.1537037 , -0.13518519, -0.1537037,
    4861                         -0.13518519, -0.1537037, -0.13518519,
    4862                         -0.1537037 , -0.13518519, -0.1537037,
    4863                         -0.13518519, -0.1537037, -0.13518519,
    4864                         -0.20925926, -0.19074074, -0.20925926,
    4865                         -0.19074074, -0.20925926, -0.19074074,
    4866                         -0.20925926, -0.19074074, -0.20925926,
    4867                         -0.19074074, -0.20925926, -0.19074074,
    4868                         -0.26481481, -0.2462963, -0.26481481,
    4869                         -0.2462963, -0.26481481, -0.2462963,
    4870                         -0.26481481, -0.2462963, -0.26481481,
    4871                         -0.2462963, -0.26481481, -0.2462963])
     4822        assert num.allclose(domain.quantities['stage'].centroid_values,
     4823                            [ 0.01296296,  0.03148148, 0.01296296,
     4824                              0.03148148,  0.01296296, 0.03148148,
     4825                              0.01296296,  0.03148148, 0.01296296,
     4826                              0.03148148,  0.01296296, 0.03148148,
     4827                             -0.04259259, -0.02407407, -0.04259259,
     4828                             -0.02407407, -0.04259259, -0.02407407,
     4829                             -0.04259259, -0.02407407, -0.04259259,
     4830                             -0.02407407, -0.04259259, -0.02407407,
     4831                             -0.09814815, -0.07962963, -0.09814815,
     4832                             -0.07962963, -0.09814815, -0.07962963,
     4833                             -0.09814815, -0.07962963, -0.09814815,
     4834                             -0.07962963, -0.09814815, -0.07962963,
     4835                             -0.1537037, -0.13518519, -0.1537037,
     4836                             -0.13518519, -0.1537037, -0.13518519,
     4837                             -0.1537037 , -0.13518519, -0.1537037,
     4838                             -0.13518519, -0.1537037, -0.13518519,
     4839                             -0.20925926, -0.19074074, -0.20925926,
     4840                             -0.19074074, -0.20925926, -0.19074074,
     4841                             -0.20925926, -0.19074074, -0.20925926,
     4842                             -0.19074074, -0.20925926, -0.19074074,
     4843                             -0.26481481, -0.2462963, -0.26481481,
     4844                             -0.2462963, -0.26481481, -0.2462963,
     4845                             -0.26481481, -0.2462963, -0.26481481,
     4846                             -0.2462963, -0.26481481, -0.2462963])
    48724847
    48734848
     
    48834858
    48844859        #print domain.quantities['stage'].centroid_values
    4885         assert allclose(domain.quantities['stage'].centroid_values,
    4886                  [0.01290985, 0.02356019, 0.01619096, 0.02356019, 0.01619096,
    4887                   0.02356019, 0.01619096, 0.02356019, 0.01619096, 0.02356019,
    4888                   0.01619096, 0.0268413, -0.04411074, -0.0248011, -0.04186556,
    4889                   -0.0248011, -0.04186556, -0.0248011, -0.04186556, -0.0248011,
    4890                   -0.04186556, -0.0248011, -0.04186556, -0.02255593,
    4891                   -0.09966629, -0.08035666, -0.09742112, -0.08035666,
    4892                   -0.09742112, -0.08035666, -0.09742112, -0.08035666,
    4893                   -0.09742112, -0.08035666, -0.09742112, -0.07811149,
    4894                   -0.15522185, -0.13591222, -0.15297667, -0.13591222,
    4895                   -0.15297667, -0.13591222, -0.15297667, -0.13591222,
    4896                   -0.15297667, -0.13591222, -0.15297667, -0.13366704,
    4897                   -0.2107774, -0.19146777, -0.20853223, -0.19146777,
    4898                   -0.20853223, -0.19146777, -0.20853223, -0.19146777,
    4899                   -0.20853223, -0.19146777, -0.20853223, -0.1892226,
    4900                   -0.26120669, -0.24776246, -0.25865535, -0.24776246,
    4901                   -0.25865535, -0.24776246, -0.25865535, -0.24776246,
    4902                   -0.25865535, -0.24776246, -0.25865535, -0.24521113])
     4860        assert num.allclose(domain.quantities['stage'].centroid_values,
     4861                            [ 0.01290985,  0.02356019,  0.01619096,  0.02356019, 0.01619096,
     4862                              0.02356019,  0.01619096,  0.02356019,  0.01619096, 0.02356019,
     4863                              0.01619096,  0.0268413,  -0.04411074, -0.0248011, -0.04186556,
     4864                             -0.0248011,  -0.04186556, -0.0248011, -0.04186556, -0.0248011,
     4865                             -0.04186556, -0.0248011, -0.04186556, -0.02255593,
     4866                             -0.09966629, -0.08035666, -0.09742112, -0.08035666,
     4867                             -0.09742112, -0.08035666, -0.09742112, -0.08035666,
     4868                             -0.09742112, -0.08035666, -0.09742112, -0.07811149,
     4869                             -0.15522185, -0.13591222, -0.15297667, -0.13591222,
     4870                             -0.15297667, -0.13591222, -0.15297667, -0.13591222,
     4871                             -0.15297667, -0.13591222, -0.15297667, -0.13366704,
     4872                             -0.2107774, -0.19146777, -0.20853223, -0.19146777,
     4873                             -0.20853223, -0.19146777, -0.20853223, -0.19146777,
     4874                             -0.20853223, -0.19146777, -0.20853223, -0.1892226,
     4875                             -0.26120669, -0.24776246, -0.25865535, -0.24776246,
     4876                             -0.25865535, -0.24776246, -0.25865535, -0.24776246,
     4877                             -0.25865535, -0.24776246, -0.25865535, -0.24521113])
    49034878
    49044879        os.remove(domain.get_name() + '.sww')
     
    49074882
    49084883        from mesh_factory import rectangular
    4909         from Numeric import array
    49104884
    49114885        #Create basic mesh
     
    49434917        domain.check_integrity()
    49444918
    4945         assert allclose(domain.quantities['stage'].centroid_values,
    4946                         [0.01296296, 0.03148148, 0.01296296,
    4947                         0.03148148, 0.01296296, 0.03148148,
    4948                         0.01296296, 0.03148148, 0.01296296,
    4949                         0.03148148, 0.01296296, 0.03148148,
    4950                         -0.04259259, -0.02407407, -0.04259259,
    4951                         -0.02407407, -0.04259259, -0.02407407,
    4952                         -0.04259259, -0.02407407, -0.04259259,
    4953                         -0.02407407, -0.04259259, -0.02407407,
    4954                         -0.09814815, -0.07962963, -0.09814815,
    4955                         -0.07962963, -0.09814815, -0.07962963,
    4956                         -0.09814815, -0.07962963, -0.09814815,
    4957                         -0.07962963, -0.09814815, -0.07962963,
    4958                         -0.1537037 , -0.13518519, -0.1537037,
    4959                         -0.13518519, -0.1537037, -0.13518519,
    4960                         -0.1537037 , -0.13518519, -0.1537037,
    4961                         -0.13518519, -0.1537037, -0.13518519,
    4962                         -0.20925926, -0.19074074, -0.20925926,
    4963                         -0.19074074, -0.20925926, -0.19074074,
    4964                         -0.20925926, -0.19074074, -0.20925926,
    4965                         -0.19074074, -0.20925926, -0.19074074,
    4966                         -0.26481481, -0.2462963, -0.26481481,
    4967                         -0.2462963, -0.26481481, -0.2462963,
    4968                         -0.26481481, -0.2462963, -0.26481481,
    4969                         -0.2462963, -0.26481481, -0.2462963])
     4919        assert num.allclose(domain.quantities['stage'].centroid_values,
     4920                            [ 0.01296296,  0.03148148, 0.01296296,
     4921                              0.03148148,  0.01296296, 0.03148148,
     4922                              0.01296296,  0.03148148, 0.01296296,
     4923                              0.03148148,  0.01296296, 0.03148148,
     4924                             -0.04259259, -0.02407407, -0.04259259,
     4925                             -0.02407407, -0.04259259, -0.02407407,
     4926                             -0.04259259, -0.02407407, -0.04259259,
     4927                             -0.02407407, -0.04259259, -0.02407407,
     4928                             -0.09814815, -0.07962963, -0.09814815,
     4929                             -0.07962963, -0.09814815, -0.07962963,
     4930                             -0.09814815, -0.07962963, -0.09814815,
     4931                             -0.07962963, -0.09814815, -0.07962963,
     4932                             -0.1537037 , -0.13518519, -0.1537037,
     4933                             -0.13518519, -0.1537037, -0.13518519,
     4934                             -0.1537037 , -0.13518519, -0.1537037,
     4935                             -0.13518519, -0.1537037, -0.13518519,
     4936                             -0.20925926, -0.19074074, -0.20925926,
     4937                             -0.19074074, -0.20925926, -0.19074074,
     4938                             -0.20925926, -0.19074074, -0.20925926,
     4939                             -0.19074074, -0.20925926, -0.19074074,
     4940                             -0.26481481, -0.2462963, -0.26481481,
     4941                             -0.2462963, -0.26481481, -0.2462963,
     4942                             -0.26481481, -0.2462963, -0.26481481,
     4943                             -0.2462963, -0.26481481, -0.2462963])
    49704944
    49714945
     
    49804954
    49814955        #Data from earlier version of abstract_2d_finite_volumes ft=0.1
    4982         assert allclose(domain.min_timestep, 0.0376895634803)
    4983         assert allclose(domain.max_timestep, 0.0415635655309)
    4984 
    4985 
    4986         assert allclose(domain.quantities['stage'].centroid_values,
    4987                         [0.00855788, 0.01575204, 0.00994606, 0.01717072,
    4988                          0.01005985, 0.01716362, 0.01005985, 0.01716299,
    4989                          0.01007098, 0.01736248, 0.01216452, 0.02026776,
    4990                          -0.04462374, -0.02479045, -0.04199789, -0.0229465,
    4991                          -0.04184033, -0.02295693, -0.04184013, -0.02295675,
    4992                          -0.04184486, -0.0228168, -0.04028876, -0.02036486,
    4993                          -0.10029444, -0.08170809, -0.09772846, -0.08021704,
    4994                          -0.09760006, -0.08022143, -0.09759984, -0.08022124,
    4995                          -0.09760261, -0.08008893, -0.09603914, -0.07758209,
    4996                          -0.15584152, -0.13723138, -0.15327266, -0.13572906,
    4997                          -0.15314427, -0.13573349, -0.15314405, -0.13573331,
    4998                          -0.15314679, -0.13560104, -0.15158523, -0.13310701,
    4999                          -0.21208605, -0.19283913, -0.20955631, -0.19134189,
    5000                          -0.20942821, -0.19134598, -0.20942799, -0.1913458,
    5001                          -0.20943005, -0.19120952, -0.20781177, -0.18869401,
    5002                          -0.25384082, -0.2463294, -0.25047649, -0.24464654,
    5003                          -0.25031159, -0.24464253, -0.25031112, -0.24464253,
    5004                          -0.25031463, -0.24454764, -0.24885323, -0.24286438])
     4956        assert num.allclose(domain.min_timestep, 0.0376895634803)
     4957        assert num.allclose(domain.max_timestep, 0.0415635655309)
     4958
     4959
     4960        assert num.allclose(domain.quantities['stage'].centroid_values,
     4961                            [ 0.00855788,  0.01575204,  0.00994606, 0.01717072,
     4962                              0.01005985,  0.01716362,  0.01005985, 0.01716299,
     4963                              0.01007098,  0.01736248,  0.01216452, 0.02026776,
     4964                             -0.04462374, -0.02479045, -0.04199789, -0.0229465,
     4965                             -0.04184033, -0.02295693, -0.04184013, -0.02295675,
     4966                             -0.04184486, -0.0228168, -0.04028876, -0.02036486,
     4967                             -0.10029444, -0.08170809, -0.09772846, -0.08021704,
     4968                             -0.09760006, -0.08022143, -0.09759984, -0.08022124,
     4969                             -0.09760261, -0.08008893, -0.09603914, -0.07758209,
     4970                             -0.15584152, -0.13723138, -0.15327266, -0.13572906,
     4971                             -0.15314427, -0.13573349, -0.15314405, -0.13573331,
     4972                             -0.15314679, -0.13560104, -0.15158523, -0.13310701,
     4973                             -0.21208605, -0.19283913, -0.20955631, -0.19134189,
     4974                             -0.20942821, -0.19134598, -0.20942799, -0.1913458,
     4975                             -0.20943005, -0.19120952, -0.20781177, -0.18869401,
     4976                             -0.25384082, -0.2463294, -0.25047649, -0.24464654,
     4977                             -0.25031159, -0.24464253, -0.25031112, -0.24464253,
     4978                             -0.25031463, -0.24454764, -0.24885323, -0.24286438])
    50054979
    50064980
     
    50104984
    50114985        from mesh_factory import rectangular
    5012         from Numeric import array
    50134986
    50144987        #Create basic mesh
     
    50465019        domain.check_integrity()
    50475020
    5048         assert allclose(domain.quantities['stage'].centroid_values,
    5049                         [0.01296296, 0.03148148, 0.01296296,
    5050                         0.03148148, 0.01296296, 0.03148148,
    5051                         0.01296296, 0.03148148, 0.01296296,
    5052                         0.03148148, 0.01296296, 0.03148148,
    5053                         -0.04259259, -0.02407407, -0.04259259,
    5054                         -0.02407407, -0.04259259, -0.02407407,
    5055                         -0.04259259, -0.02407407, -0.04259259,
    5056                         -0.02407407, -0.04259259, -0.02407407,
    5057                         -0.09814815, -0.07962963, -0.09814815,
    5058                         -0.07962963, -0.09814815, -0.07962963,
    5059                         -0.09814815, -0.07962963, -0.09814815,
    5060                         -0.07962963, -0.09814815, -0.07962963,
    5061                         -0.1537037 , -0.13518519, -0.1537037,
    5062                         -0.13518519, -0.1537037, -0.13518519,
    5063                         -0.1537037 , -0.13518519, -0.1537037,
    5064                         -0.13518519, -0.1537037, -0.13518519,
    5065                         -0.20925926, -0.19074074, -0.20925926,
    5066                         -0.19074074, -0.20925926, -0.19074074,
    5067                         -0.20925926, -0.19074074, -0.20925926,
    5068                         -0.19074074, -0.20925926, -0.19074074,
    5069                         -0.26481481, -0.2462963, -0.26481481,
    5070                         -0.2462963, -0.26481481, -0.2462963,
    5071                         -0.26481481, -0.2462963, -0.26481481,
    5072                         -0.2462963, -0.26481481, -0.2462963])
     5021        assert num.allclose(domain.quantities['stage'].centroid_values,
     5022                            [ 0.01296296,  0.03148148, 0.01296296,
     5023                              0.03148148,  0.01296296, 0.03148148,
     5024                              0.01296296,  0.03148148, 0.01296296,
     5025                              0.03148148,  0.01296296, 0.03148148,
     5026                             -0.04259259, -0.02407407, -0.04259259,
     5027                             -0.02407407, -0.04259259, -0.02407407,
     5028                             -0.04259259, -0.02407407, -0.04259259,
     5029                             -0.02407407, -0.04259259, -0.02407407,
     5030                             -0.09814815, -0.07962963, -0.09814815,
     5031                             -0.07962963, -0.09814815, -0.07962963,
     5032                             -0.09814815, -0.07962963, -0.09814815,
     5033                             -0.07962963, -0.09814815, -0.07962963,
     5034                             -0.1537037 , -0.13518519, -0.1537037,
     5035                             -0.13518519, -0.1537037, -0.13518519,
     5036                             -0.1537037 , -0.13518519, -0.1537037,
     5037                             -0.13518519, -0.1537037, -0.13518519,
     5038                             -0.20925926, -0.19074074, -0.20925926,
     5039                             -0.19074074, -0.20925926, -0.19074074,
     5040                             -0.20925926, -0.19074074, -0.20925926,
     5041                             -0.19074074, -0.20925926, -0.19074074,
     5042                             -0.26481481, -0.2462963, -0.26481481,
     5043                             -0.2462963, -0.26481481, -0.2462963,
     5044                             -0.26481481, -0.2462963, -0.26481481,
     5045                             -0.2462963, -0.26481481, -0.2462963])
    50735046
    50745047
     
    50845057
    50855058
    5086         assert allclose(domain.quantities['stage'].centroid_values,
    5087                  [0.00855788, 0.01575204, 0.00994606, 0.01717072, 0.01005985,
    5088                   0.01716362, 0.01005985, 0.01716299, 0.01007098, 0.01736248,
    5089                   0.01216452, 0.02026776, -0.04462374, -0.02479045, -0.04199789,
    5090                   -0.0229465, -0.04184033, -0.02295693, -0.04184013,
    5091                   -0.02295675, -0.04184486, -0.0228168, -0.04028876,
    5092                   -0.02036486, -0.10029444, -0.08170809, -0.09772846,
    5093                   -0.08021704, -0.09760006, -0.08022143, -0.09759984,
    5094                   -0.08022124, -0.09760261, -0.08008893, -0.09603914,
    5095                   -0.07758209, -0.15584152, -0.13723138, -0.15327266,
    5096                   -0.13572906, -0.15314427, -0.13573349, -0.15314405,
    5097                   -0.13573331, -0.15314679, -0.13560104, -0.15158523,
    5098                   -0.13310701, -0.21208605, -0.19283913, -0.20955631,
    5099                   -0.19134189, -0.20942821, -0.19134598, -0.20942799,
    5100                   -0.1913458, -0.20943005, -0.19120952, -0.20781177,
    5101                   -0.18869401, -0.25384082, -0.2463294, -0.25047649,
    5102                   -0.24464654, -0.25031159, -0.24464253, -0.25031112,
    5103                   -0.24464253, -0.25031463, -0.24454764, -0.24885323,
    5104                   -0.24286438])
     5059        assert num.allclose(domain.quantities['stage'].centroid_values,
     5060                            [ 0.00855788,  0.01575204,  0.00994606,  0.01717072, 0.01005985,
     5061                              0.01716362,  0.01005985,  0.01716299,  0.01007098, 0.01736248,
     5062                              0.01216452, 0.02026776, -0.04462374, -0.02479045, -0.04199789,
     5063                             -0.0229465, -0.04184033, -0.02295693, -0.04184013,
     5064                             -0.02295675, -0.04184486, -0.0228168, -0.04028876,
     5065                             -0.02036486, -0.10029444, -0.08170809, -0.09772846,
     5066                             -0.08021704, -0.09760006, -0.08022143, -0.09759984,
     5067                             -0.08022124, -0.09760261, -0.08008893, -0.09603914,
     5068                             -0.07758209, -0.15584152, -0.13723138, -0.15327266,
     5069                             -0.13572906, -0.15314427, -0.13573349, -0.15314405,
     5070                             -0.13573331, -0.15314679, -0.13560104, -0.15158523,
     5071                             -0.13310701, -0.21208605, -0.19283913, -0.20955631,
     5072                             -0.19134189, -0.20942821, -0.19134598, -0.20942799,
     5073                             -0.1913458, -0.20943005, -0.19120952, -0.20781177,
     5074                             -0.18869401, -0.25384082, -0.2463294, -0.25047649,
     5075                             -0.24464654, -0.25031159, -0.24464253, -0.25031112,
     5076                             -0.24464253, -0.25031463, -0.24454764, -0.24885323,
     5077                             -0.24286438])
    51055078
    51065079        os.remove(domain.get_name() + '.sww')
     
    51095082
    51105083        from mesh_factory import rectangular
    5111         from Numeric import array
    51125084
    51135085        #Create basic mesh
     
    51475119        domain.check_integrity()
    51485120
    5149         assert allclose(domain.quantities['stage'].centroid_values,
    5150                         [0.01296296, 0.03148148, 0.01296296,
    5151                         0.03148148, 0.01296296, 0.03148148,
    5152                         0.01296296, 0.03148148, 0.01296296,
    5153                         0.03148148, 0.01296296, 0.03148148,
    5154                         -0.04259259, -0.02407407, -0.04259259,
    5155                         -0.02407407, -0.04259259, -0.02407407,
    5156                         -0.04259259, -0.02407407, -0.04259259,
    5157                         -0.02407407, -0.04259259, -0.02407407,
    5158                         -0.09814815, -0.07962963, -0.09814815,
    5159                         -0.07962963, -0.09814815, -0.07962963,
    5160                         -0.09814815, -0.07962963, -0.09814815,
    5161                         -0.07962963, -0.09814815, -0.07962963,
    5162                         -0.1537037 , -0.13518519, -0.1537037,
    5163                         -0.13518519, -0.1537037, -0.13518519,
    5164                         -0.1537037 , -0.13518519, -0.1537037,
    5165                         -0.13518519, -0.1537037, -0.13518519,
    5166                         -0.20925926, -0.19074074, -0.20925926,
    5167                         -0.19074074, -0.20925926, -0.19074074,
    5168                         -0.20925926, -0.19074074, -0.20925926,
    5169                         -0.19074074, -0.20925926, -0.19074074,
    5170                         -0.26481481, -0.2462963, -0.26481481,
    5171                         -0.2462963, -0.26481481, -0.2462963,
    5172                         -0.26481481, -0.2462963, -0.26481481,
    5173                         -0.2462963, -0.26481481, -0.2462963])
     5121        assert num.allclose(domain.quantities['stage'].centroid_values,
     5122                            [ 0.01296296,  0.03148148, 0.01296296,
     5123                              0.03148148,  0.01296296, 0.03148148,
     5124                              0.01296296,  0.03148148, 0.01296296,
     5125                              0.03148148,  0.01296296, 0.03148148,
     5126                             -0.04259259, -0.02407407, -0.04259259,
     5127                             -0.02407407, -0.04259259, -0.02407407,
     5128                             -0.04259259, -0.02407407, -0.04259259,
     5129                             -0.02407407, -0.04259259, -0.02407407,
     5130                             -0.09814815, -0.07962963, -0.09814815,
     5131                             -0.07962963, -0.09814815, -0.07962963,
     5132                             -0.09814815, -0.07962963, -0.09814815,
     5133                             -0.07962963, -0.09814815, -0.07962963,
     5134                             -0.1537037 , -0.13518519, -0.1537037,
     5135                             -0.13518519, -0.1537037, -0.13518519,
     5136                             -0.1537037 , -0.13518519, -0.1537037,
     5137                             -0.13518519, -0.1537037, -0.13518519,
     5138                             -0.20925926, -0.19074074, -0.20925926,
     5139                             -0.19074074, -0.20925926, -0.19074074,
     5140                             -0.20925926, -0.19074074, -0.20925926,
     5141                             -0.19074074, -0.20925926, -0.19074074,
     5142                             -0.26481481, -0.2462963, -0.26481481,
     5143                             -0.2462963, -0.26481481, -0.2462963,
     5144                             -0.26481481, -0.2462963, -0.26481481,
     5145                             -0.2462963, -0.26481481, -0.2462963])
    51745146
    51755147
     
    51875159
    51885160
    5189         assert allclose(domain.quantities['stage'].centroid_values,
     5161        assert num.allclose(domain.quantities['stage'].centroid_values,
    51905162     [-0.02907028, -0.01475478, -0.02973417, -0.01447186, -0.02932665, -0.01428285,
    51915163      -0.02901975, -0.0141361,  -0.02898816, -0.01418135, -0.02961409, -0.01403487,
     
    52015173      -0.13785933, -0.14033364, -0.13592955, -0.13936356, -0.13596008, -0.14216296])
    52025174
    5203         assert allclose(domain.quantities['xmomentum'].centroid_values,
     5175        assert num.allclose(domain.quantities['xmomentum'].centroid_values,
    52045176     [ 0.00831121,  0.00317948,  0.00731797,  0.00334939,  0.00764717,  0.00348053,
    52055177       0.00788729,  0.00356522,  0.00780649,  0.00341919,  0.00693525,  0.00310375,
     
    52165188
    52175189
    5218         assert allclose(domain.quantities['ymomentum'].centroid_values,
     5190        assert num.allclose(domain.quantities['ymomentum'].centroid_values,
    52195191     [ 1.45876601e-004, -3.24627393e-004, -1.57572719e-004, -2.92790187e-004,
    52205192      -9.90988382e-005, -3.06677335e-004, -1.62493106e-004, -3.71310004e-004,
     
    52485220        """
    52495221        from mesh_factory import rectangular
    5250         from Numeric import array
    52515222
    52525223        #Create basic mesh
     
    52805251        domain.check_integrity()
    52815252
    5282         assert allclose(domain.quantities['stage'].centroid_values,
    5283                         [0.01296296, 0.03148148, 0.01296296,
    5284                         0.03148148, 0.01296296, 0.03148148,
    5285                         0.01296296, 0.03148148, 0.01296296,
    5286                         0.03148148, 0.01296296, 0.03148148,
    5287                         -0.04259259, -0.02407407, -0.04259259,
    5288                         -0.02407407, -0.04259259, -0.02407407,
    5289                         -0.04259259, -0.02407407, -0.04259259,
    5290                         -0.02407407, -0.04259259, -0.02407407,
    5291                         -0.09814815, -0.07962963, -0.09814815,
    5292                         -0.07962963, -0.09814815, -0.07962963,
    5293                         -0.09814815, -0.07962963, -0.09814815,
    5294                         -0.07962963, -0.09814815, -0.07962963,
    5295                         -0.1537037 , -0.13518519, -0.1537037,
    5296                         -0.13518519, -0.1537037, -0.13518519,
    5297                         -0.1537037 , -0.13518519, -0.1537037,
    5298                         -0.13518519, -0.1537037, -0.13518519,
    5299                         -0.20925926, -0.19074074, -0.20925926,
    5300                         -0.19074074, -0.20925926, -0.19074074,
    5301                         -0.20925926, -0.19074074, -0.20925926,
    5302                         -0.19074074, -0.20925926, -0.19074074,
    5303                         -0.26481481, -0.2462963, -0.26481481,
    5304                         -0.2462963, -0.26481481, -0.2462963,
    5305                         -0.26481481, -0.2462963, -0.26481481,
    5306                         -0.2462963, -0.26481481, -0.2462963])
     5253        assert num.allclose(domain.quantities['stage'].centroid_values,
     5254                            [ 0.01296296,  0.03148148, 0.01296296,
     5255                              0.03148148,  0.01296296, 0.03148148,
     5256                              0.01296296,  0.03148148, 0.01296296,
     5257                              0.03148148,  0.01296296, 0.03148148,
     5258                             -0.04259259, -0.02407407, -0.04259259,
     5259                             -0.02407407, -0.04259259, -0.02407407,
     5260                             -0.04259259, -0.02407407, -0.04259259,
     5261                             -0.02407407, -0.04259259, -0.02407407,
     5262                             -0.09814815, -0.07962963, -0.09814815,
     5263                             -0.07962963, -0.09814815, -0.07962963,
     5264                             -0.09814815, -0.07962963, -0.09814815,
     5265                             -0.07962963, -0.09814815, -0.07962963,
     5266                             -0.1537037 , -0.13518519, -0.1537037,
     5267                             -0.13518519, -0.1537037, -0.13518519,
     5268                             -0.1537037 , -0.13518519, -0.1537037,
     5269                             -0.13518519, -0.1537037, -0.13518519,
     5270                             -0.20925926, -0.19074074, -0.20925926,
     5271                             -0.19074074, -0.20925926, -0.19074074,
     5272                             -0.20925926, -0.19074074, -0.20925926,
     5273                             -0.19074074, -0.20925926, -0.19074074,
     5274                             -0.26481481, -0.2462963, -0.26481481,
     5275                             -0.2462963, -0.26481481, -0.2462963,
     5276                             -0.26481481, -0.2462963, -0.26481481,
     5277                             -0.2462963, -0.26481481, -0.2462963])
    53075278
    53085279
     
    53185289        #print domain.quantities['stage'].centroid_values
    53195290           
    5320         assert allclose(domain.quantities['stage'].centroid_values,
     5291        assert num.allclose(domain.quantities['stage'].centroid_values,
    53215292         [-0.03348416, -0.01749303, -0.03299091, -0.01739241, -0.03246447, -0.01732016,
    53225293          -0.03205390, -0.01717833, -0.03146383, -0.01699831, -0.03076577, -0.01671795,
     
    53335304
    53345305                     
    5335         assert allclose(domain.quantities['xmomentum'].centroid_values,
     5306        assert num.allclose(domain.quantities['xmomentum'].centroid_values,
    53365307      [0.00600290,  0.00175780,  0.00591905,  0.00190903,  0.00644462,  0.00203095,
    53375308       0.00684561,  0.00225089,  0.00708208,  0.00236235,  0.00649095,  0.00222343,
     
    53485319
    53495320       
    5350         assert allclose(domain.quantities['ymomentum'].centroid_values,
     5321        assert num.allclose(domain.quantities['ymomentum'].centroid_values,
    53515322     [-7.65882069e-005, -1.46087080e-004, -1.09630102e-004, -7.80950424e-005,
    53525323      -1.15922807e-005, -9.09134899e-005, -1.35994542e-004, -1.95673476e-004,
     
    53745345
    53755346        from mesh_factory import rectangular
    5376         from Numeric import array
    53775347
    53785348        #Create basic mesh
     
    54155385            pass
    54165386
    5417         assert allclose(domain.quantities['stage'].centroid_values[:4],
    5418                         [0.00206836, 0.01296714, 0.00363415, 0.01438924])
     5387        assert num.allclose(domain.quantities['stage'].centroid_values[:4],
     5388                            [0.00206836, 0.01296714, 0.00363415, 0.01438924])
    54195389        #print domain.quantities['xmomentum'].centroid_values[:4]
    5420         assert allclose(domain.quantities['xmomentum'].centroid_values[:4],
    5421                         [0.01360154, 0.00671133, 0.01264578, 0.00648503])
    5422         assert allclose(domain.quantities['ymomentum'].centroid_values[:4],
    5423                         [-1.19201077e-003, -7.23647546e-004,
    5424                         -6.39083123e-005, 6.29815168e-005])
     5390        assert num.allclose(domain.quantities['xmomentum'].centroid_values[:4],
     5391                            [0.01360154, 0.00671133, 0.01264578, 0.00648503])
     5392        assert num.allclose(domain.quantities['ymomentum'].centroid_values[:4],
     5393                            [-1.19201077e-003, -7.23647546e-004,
     5394                            -6.39083123e-005, 6.29815168e-005])
    54255395
    54265396        os.remove(domain.get_name() + '.sww')
     
    54305400
    54315401        from mesh_factory import rectangular
    5432         from Numeric import array
    54335402
    54345403        N = 12
     
    56125581        #print take(cv2, (0,3,8))
    56135582
    5614         assert allclose( take(cv1, (0,8,16)), take(cv2, (0,3,8))) #Diag
    5615         assert allclose( take(cv1, (0,6,12)), take(cv2, (0,1,4))) #Bottom
    5616         assert allclose( take(cv1, (12,14,16)), take(cv2, (4,6,8))) #RHS
     5583        assert num.allclose( num.take(cv1, (0,8,16)), num.take(cv2, (0,3,8))) #Diag
     5584        assert num.allclose( num.take(cv1, (0,6,12)), num.take(cv2, (0,1,4))) #Bottom
     5585        assert num.allclose( num.take(cv1, (12,14,16)), num.take(cv2, (4,6,8))) #RHS
    56175586
    56185587        #Cleanup
     
    57155684        fid.close()
    57165685
    5717         from Numeric import take, reshape, concatenate
    57185686        shp = (len(x), 1)
    5719         points = concatenate( (reshape(x, shp), reshape(y, shp)), axis=1)
     5687        points = num.concatenate( (num.reshape(x, shp), num.reshape(y, shp)), axis=1)
    57205688        #The diagonal points of domain 1 are 0, 5, 10, 15
    57215689
    57225690        #print points[0], points[5], points[10], points[15]
    5723         assert allclose( take(points, [0,5,10,15]),
    5724                          [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]])
     5691        assert num.allclose( num.take(points, [0,5,10,15]),
     5692                             [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]])
    57255693
    57265694
     
    57445712        R = Bf.F.interpolation_points.tolist()
    57455713        R.sort()
    5746         assert allclose(boundary_midpoints, R)
     5714        assert num.allclose(boundary_midpoints, R)
    57475715
    57485716        #Check spatially interpolated output at time == 1
     
    57515719        #First diagonal midpoint
    57525720        R0 = Bf.evaluate(0,0)
    5753         assert allclose(R0[0], (s1[0] + s1[5])/2)
     5721        assert num.allclose(R0[0], (s1[0] + s1[5])/2)
    57545722
    57555723        #Second diagonal midpoint
    57565724        R0 = Bf.evaluate(3,0)
    5757         assert allclose(R0[0], (s1[5] + s1[10])/2)
     5725        assert num.allclose(R0[0], (s1[5] + s1[10])/2)
    57585726
    57595727        #First diagonal midpoint
    57605728        R0 = Bf.evaluate(8,0)
    5761         assert allclose(R0[0], (s1[10] + s1[15])/2)
     5729        assert num.allclose(R0[0], (s1[10] + s1[15])/2)
    57625730
    57635731        #Check spatially interpolated output at time == 2
     
    57665734        #First diagonal midpoint
    57675735        R0 = Bf.evaluate(0,0)
    5768         assert allclose(R0[0], (s2[0] + s2[5])/2)
     5736        assert num.allclose(R0[0], (s2[0] + s2[5])/2)
    57695737
    57705738        #Second diagonal midpoint
    57715739        R0 = Bf.evaluate(3,0)
    5772         assert allclose(R0[0], (s2[5] + s2[10])/2)
     5740        assert num.allclose(R0[0], (s2[5] + s2[10])/2)
    57735741
    57745742        #First diagonal midpoint
    57755743        R0 = Bf.evaluate(8,0)
    5776         assert allclose(R0[0], (s2[10] + s2[15])/2)
     5744        assert num.allclose(R0[0], (s2[10] + s2[15])/2)
    57775745
    57785746
     
    57835751        #First diagonal midpoint
    57845752        R0 = Bf.evaluate(0,0)
    5785         assert allclose(R0[0], ((s1[0] + s1[5])/2 + 2.0*(s2[0] + s2[5])/2)/3)
     5753        assert num.allclose(R0[0], ((s1[0] + s1[5])/2 + 2.0*(s2[0] + s2[5])/2)/3)
    57865754
    57875755        #Second diagonal midpoint
    57885756        R0 = Bf.evaluate(3,0)
    5789         assert allclose(R0[0], ((s1[5] + s1[10])/2 + 2.0*(s2[5] + s2[10])/2)/3)
     5757        assert num.allclose(R0[0], ((s1[5] + s1[10])/2 + 2.0*(s2[5] + s2[10])/2)/3)
    57905758
    57915759        #First diagonal midpoint
    57925760        R0 = Bf.evaluate(8,0)
    5793         assert allclose(R0[0], ((s1[10] + s1[15])/2 + 2.0*(s2[10] + s2[15])/2)/3)
     5761        assert num.allclose(R0[0], ((s1[10] + s1[15])/2 + 2.0*(s2[10] + s2[15])/2)/3)
    57945762
    57955763
     
    58975865        fid.close()
    58985866
    5899         from Numeric import take, reshape, concatenate
    59005867        shp = (len(x), 1)
    5901         points = concatenate( (reshape(x, shp), reshape(y, shp)), axis=1)
     5868        points = num.concatenate( (num.reshape(x, shp), num.reshape(y, shp)), axis=1)
    59025869        #The diagonal points of domain 1 are 0, 5, 10, 15
    59035870
    59045871        #print points[0], points[5], points[10], points[15]
    5905         assert allclose( take(points, [0,5,10,15]),
    5906                          [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]])
     5872        assert num.allclose( num.take(points, [0,5,10,15]),
     5873                             [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]])
    59075874
    59085875
     
    59275894        R = Bf.F.interpolation_points.tolist()
    59285895        R.sort()
    5929         assert allclose(boundary_midpoints, R)
     5896        assert num.allclose(boundary_midpoints, R)
    59305897
    59315898        #Check spatially interpolated output at time == 1
     
    59345901        #First diagonal midpoint
    59355902        R0 = Bf.evaluate(0,0)
    5936         assert allclose(R0[0], (s1[0] + s1[5])/2 + mean_stage)
     5903        assert num.allclose(R0[0], (s1[0] + s1[5])/2 + mean_stage)
    59375904
    59385905        #Second diagonal midpoint
    59395906        R0 = Bf.evaluate(3,0)
    5940         assert allclose(R0[0], (s1[5] + s1[10])/2 + mean_stage)
     5907        assert num.allclose(R0[0], (s1[5] + s1[10])/2 + mean_stage)
    59415908
    59425909        #First diagonal midpoint
    59435910        R0 = Bf.evaluate(8,0)
    5944         assert allclose(R0[0], (s1[10] + s1[15])/2 + mean_stage)
     5911        assert num.allclose(R0[0], (s1[10] + s1[15])/2 + mean_stage)
    59455912
    59465913        #Check spatially interpolated output at time == 2
     
    59495916        #First diagonal midpoint
    59505917        R0 = Bf.evaluate(0,0)
    5951         assert allclose(R0[0], (s2[0] + s2[5])/2 + mean_stage)
     5918        assert num.allclose(R0[0], (s2[0] + s2[5])/2 + mean_stage)
    59525919
    59535920        #Second diagonal midpoint
    59545921        R0 = Bf.evaluate(3,0)
    5955         assert allclose(R0[0], (s2[5] + s2[10])/2 + mean_stage)
     5922        assert num.allclose(R0[0], (s2[5] + s2[10])/2 + mean_stage)
    59565923
    59575924        #First diagonal midpoint
    59585925        R0 = Bf.evaluate(8,0)
    5959         assert allclose(R0[0], (s2[10] + s2[15])/2 + mean_stage)
     5926        assert num.allclose(R0[0], (s2[10] + s2[15])/2 + mean_stage)
    59605927
    59615928
     
    59665933        #First diagonal midpoint
    59675934        R0 = Bf.evaluate(0,0)
    5968         assert allclose(R0[0], ((s1[0] + s1[5])/2 + 2.0*(s2[0] + s2[5])/2)/3 + mean_stage)
     5935        assert num.allclose(R0[0], ((s1[0] + s1[5])/2 + 2.0*(s2[0] + s2[5])/2)/3 + mean_stage)
    59695936
    59705937        #Second diagonal midpoint
    59715938        R0 = Bf.evaluate(3,0)
    5972         assert allclose(R0[0], ((s1[5] + s1[10])/2 + 2.0*(s2[5] + s2[10])/2)/3 + mean_stage)
     5939        assert num.allclose(R0[0], ((s1[5] + s1[10])/2 + 2.0*(s2[5] + s2[10])/2)/3 + mean_stage)
    59735940
    59745941        #First diagonal midpoint
    59755942        R0 = Bf.evaluate(8,0)
    5976         assert allclose(R0[0], ((s1[10] + s1[15])/2 + 2.0*(s2[10] + s2[15])/2)/3 + mean_stage)
     5943        assert num.allclose(R0[0], ((s1[10] + s1[15])/2 + 2.0*(s2[10] + s2[15])/2)/3 + mean_stage)
    59775944
    59785945
     
    60716038        fid.close()
    60726039
    6073         from Numeric import take, reshape, concatenate
    60746040        shp = (len(x), 1)
    6075         points = concatenate( (reshape(x, shp), reshape(y, shp)), axis=1)
     6041        points = num.concatenate( (num.reshape(x, shp), num.reshape(y, shp)), axis=1)
    60766042        #The diagonal points of domain 1 are 0, 5, 10, 15
    60776043
    60786044        #print points[0], points[5], points[10], points[15]
    6079         assert allclose( take(points, [0,5,10,15]),
    6080                          [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]])
     6045        assert num.allclose( num.take(points, [0,5,10,15]),
     6046                             [[0,0], [1.0/3, 1.0/3], [2.0/3, 2.0/3], [1,1]])
    60816047
    60826048
     
    61756141
    61766142        #print stage['min'], stage['max']
    6177         assert allclose(stage['min'], initial_runup_height,
    6178                         rtol = 1.0/N) # First order accuracy
     6143        assert num.allclose(stage['min'], initial_runup_height,
     6144                            rtol = 1.0/N) # First order accuracy
    61796145
    61806146
     
    62076173        assert stage['min'] <= stage['max']
    62086174
    6209         assert allclose(stage['min'], initial_runup_height,
    6210                         rtol = 1.0/N) # First order accuracy       
     6175        assert num.allclose(stage['min'], initial_runup_height,
     6176                            rtol = 1.0/N) # First order accuracy       
    62116177
    62126178        depth = domain.quantities_to_be_monitored['stage-elevation']
     
    62276193
    62286194        import time, os
    6229         from Numeric import array, zeros, allclose, Float, concatenate
    62306195        from Scientific.IO.NetCDF import NetCDFFile
    62316196        from data_manager import get_dataobject, extent_sww
     
    62706235
    62716236        bed = domain.quantities['elevation'].vertex_values
    6272         stage = zeros(bed.shape, Float)
     6237        stage = num.zeros(bed.shape, num.Float)
    62736238
    62746239        h = 0.3
     
    63516316
    63526317         tags = {}
    6353          b1 =  Dirichlet_boundary(conserved_quantities = array([0.0]))
    6354          b2 =  Dirichlet_boundary(conserved_quantities = array([1.0]))
    6355          b3 =  Dirichlet_boundary(conserved_quantities = array([2.0]))
     6318         b1 =  Dirichlet_boundary(conserved_quantities = num.array([0.0]))
     6319         b2 =  Dirichlet_boundary(conserved_quantities = num.array([1.0]))
     6320         b3 =  Dirichlet_boundary(conserved_quantities = num.array([2.0]))
    63566321         tags["1"] = b1
    63576322         tags["2"] = b2
     
    63696334         answer = [[0., 8., 0.],
    63706335                   [0., 10., 8.]]
    6371          assert allclose(domain.quantities['elevation'].vertex_values,
    6372                         answer)
     6336         assert num.allclose(domain.quantities['elevation'].vertex_values,
     6337                             answer)
    63736338
    63746339         #print domain.quantities['stage'].vertex_values
    63756340         answer = [[0., 12., 10.],
    63766341                   [0., 10., 12.]]
    6377          assert allclose(domain.quantities['stage'].vertex_values,
    6378                         answer)
     6342         assert num.allclose(domain.quantities['stage'].vertex_values,
     6343                             answer)
    63796344
    63806345         #print domain.quantities['friction'].vertex_values
    63816346         answer = [[0.01, 0.04, 0.03],
    63826347                   [0.01, 0.02, 0.04]]
    6383          assert allclose(domain.quantities['friction'].vertex_values,
    6384                         answer)
     6348         assert num.allclose(domain.quantities['friction'].vertex_values,
     6349                             answer)
    63856350
    63866351         #print domain.quantities['friction'].vertex_values
    6387          assert allclose(domain.tagged_elements['dsg'][0],0)
    6388          assert allclose(domain.tagged_elements['ole nielsen'][0],1)
     6352         assert num.allclose(domain.tagged_elements['dsg'][0],0)
     6353         assert num.allclose(domain.tagged_elements['ole nielsen'][0],1)
    63896354
    63906355         self.failUnless( domain.boundary[(1, 0)]  == '1',
     
    64156380         answer = [[0., 8., 0.],
    64166381                   [0., 10., 8.]]
    6417          assert allclose(domain.quantities['elevation'].vertex_values,
    6418                         answer)
     6382         assert num.allclose(domain.quantities['elevation'].vertex_values,
     6383                             answer)
    64196384
    64206385         #print domain.quantities['stage'].vertex_values
    64216386         answer = [[0., 12., 10.],
    64226387                   [0., 10., 12.]]
    6423          assert allclose(domain.quantities['stage'].vertex_values,
    6424                         answer)
     6388         assert num.allclose(domain.quantities['stage'].vertex_values,
     6389                             answer)
    64256390
    64266391         #print domain.quantities['friction'].vertex_values
    64276392         answer = [[0.01, 0.04, 0.03],
    64286393                   [0.01, 0.02, 0.04]]
    6429          assert allclose(domain.quantities['friction'].vertex_values,
    6430                         answer)
     6394         assert num.allclose(domain.quantities['friction'].vertex_values,
     6395                             answer)
    64316396
    64326397         #print domain.quantities['friction'].vertex_values
    6433          assert allclose(domain.tagged_elements['dsg'][0],0)
    6434          assert allclose(domain.tagged_elements['ole nielsen'][0],1)
     6398         assert num.allclose(domain.tagged_elements['dsg'][0],0)
     6399         assert num.allclose(domain.tagged_elements['ole nielsen'][0],1)
    64356400
    64366401         self.failUnless( domain.boundary[(1, 0)]  == '1',
     
    65466511        answer = linear_function(quantity.domain.get_vertex_coordinates())
    65476512
    6548         assert allclose(quantity.vertex_values.flat, answer)
     6513        assert num.allclose(quantity.vertex_values.flat, answer)
    65496514
    65506515
    65516516        #Check that values can be set from file using default attribute
    65526517        quantity.set_values(filename = ptsfile, alpha = 0)
    6553         assert allclose(quantity.vertex_values.flat, answer)
     6518        assert num.allclose(quantity.vertex_values.flat, answer)
    65546519
    65556520        #Cleanup
  • anuga_core/source/anuga/shallow_water/test_smf.py

    r5675 r6157  
    11import unittest
    2 from Numeric import allclose
     2import Numeric as num
    33from smf import slide_tsunami, slump_tsunami, Double_gaussian
    44
     
    2828                             kappa, kappad, zsmall, dx, scale)
    2929
    30         assert allclose(dg.a3D, a3D)
    31         assert allclose(dg.wavelength, wavelength)
    32         assert allclose(dg.width, width)
    33         assert allclose(dg.x0, x0)
    34         assert allclose(dg.y0, y0)
    35         assert allclose(dg.alpha, alpha)
    36         assert allclose(dg.kappa, kappa)
    37         assert allclose(dg.kappad, kappad)
    38         assert allclose(dg.dx, dx)
     30        assert num.allclose(dg.a3D, a3D)
     31        assert num.allclose(dg.wavelength, wavelength)
     32        assert num.allclose(dg.width, width)
     33        assert num.allclose(dg.x0, x0)
     34        assert num.allclose(dg.y0, y0)
     35        assert num.allclose(dg.alpha, alpha)
     36        assert num.allclose(dg.kappa, kappa)
     37        assert num.allclose(dg.kappad, kappad)
     38        assert num.allclose(dg.dx, dx)
    3939
    4040   
     
    5454                              verbose=False)
    5555
    56         assert allclose(slide.a3D, 0.07775819)
    57         assert allclose(slide.wavelength, 2938.66695708)
    58         assert allclose(slide.width, 340.0)
    59         assert allclose(slide.y0, 0.0)
    60         assert allclose(slide.alpha, 0.0)
     56        assert num.allclose(slide.a3D, 0.07775819)
     57        assert num.allclose(slide.wavelength, 2938.66695708)
     58        assert num.allclose(slide.width, 340.0)
     59        assert num.allclose(slide.y0, 0.0)
     60        assert num.allclose(slide.alpha, 0.0)
    6161
    6262
     
    7777        slump = slump_tsunami(length, dep, th, wid, thk, rad, dp, x0, y0, alpha, gamma, scale=1.0)
    7878
    79         assert allclose(slump.a3D, 9.82538623)
    80         assert allclose(slump.wavelength, 3660.37606554)
    81         assert allclose(slump.width, 4500.0)
    82         assert allclose(slump.x0, 0.0)
    83         assert allclose(slump.y0, 0.0)
    84         assert allclose(slump.alpha, 0.0)
    85         assert allclose(slump.kappa, 3.0)
    86         assert allclose(slump.kappad, 1.0)
     79        assert num.allclose(slump.a3D, 9.82538623)
     80        assert num.allclose(slump.wavelength, 3660.37606554)
     81        assert num.allclose(slump.width, 4500.0)
     82        assert num.allclose(slump.x0, 0.0)
     83        assert num.allclose(slump.y0, 0.0)
     84        assert num.allclose(slump.alpha, 0.0)
     85        assert num.allclose(slump.kappa, 3.0)
     86        assert num.allclose(slump.kappad, 1.0)
    8787
    8888    def test_slide_tsunami_domain(self):
     
    126126##                 [-0.0 -0.0 -0.0]]
    127127
    128         assert allclose(min(min(w)), -517.877771593)
    129         assert allclose(max(max(w)), 0.0)
    130         assert allclose(slide.a3D, 518.38797486)
     128        assert num.allclose(min(min(w)), -517.877771593)
     129        assert num.allclose(max(max(w)), 0.0)
     130        assert num.allclose(slide.a3D, 518.38797486)
    131131
    132132
  • anuga_core/source/anuga/shallow_water/test_system.py

    r6086 r6157  
    99
    1010from Scientific.IO.NetCDF import NetCDFFile
    11 from Numeric import allclose
     11import Numeric as num
    1212
    1313from anuga.shallow_water import Domain
     
    6666            # changeset:5846.
    6767            msg = 'Time boundary not evaluated correctly'
    68             assert allclose(t, q[0]), msg
     68            assert num.allclose(t, q[0]), msg
    6969           
    7070            #print domain.get_quantity('stage').get_values()
     
    118118        #print "times", times
    119119        #print "fid.starttime", fid.starttime
    120         assert allclose(fid.starttime, boundary_starttime)
     120        assert num.allclose(fid.starttime, boundary_starttime)
    121121        fid.close()
    122122
     
    171171        #print "times", times
    172172        #print "fid.starttime", fid.starttime
    173         assert allclose(fid.starttime, new_starttime)
     173        assert num.allclose(fid.starttime, new_starttime)
    174174        fid.close()
    175175       
     
    178178        msg += "Not logic. "
    179179        msg += "It's testing that starttime is working"
    180         assert allclose(stage[2,0], 11.9867153168),msg
     180        assert num.allclose(stage[2,0], 11.9867153168),msg
    181181       
    182182       
  • anuga_core/source/anuga/shallow_water/test_tsunami_okada.py

    r5601 r6157  
    11import unittest
    2 from Numeric import allclose
     2import Numeric as num
    33from tsunami_okada import earthquake_tsunami,Okada_func
    44
     
    1313    def test_Okada_func(self):
    1414        from os import sep, getenv
    15         from Numeric import zeros, Float,allclose
    1615        import sys
    1716        from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
     
    146145        #print tmp
    147146        #print 'hello',stage
    148         assert allclose(stage,tmp,atol=1.e-3)
     147        assert num.allclose(stage,tmp,atol=1.e-3)
    149148       
    150149    def test_earthquake_tsunami(self):
    151150        from os import sep, getenv
    152         from Numeric import zeros, Float,allclose
    153151        import sys
    154152        from anuga.abstract_2d_finite_volumes.mesh_factory import rectangular_cross
     
    290288        #print tmp
    291289        #print 'hello',stage   
    292         assert allclose(stage,tmp,atol=1.e-3)
     290        assert num.allclose(stage,tmp,atol=1.e-3)
    293291
    294292#-------------------------------------------------------------
  • anuga_core/source/anuga/shallow_water/tsunami_okada.py

    r5252 r6157  
    3030"""
    3131
     32import Numeric as num
     33
     34
    3235def earthquake_tsunami(ns,NSMAX,length, width, strike, depth,\
    3336                       dip, xi, yi,z0, slip, rake,\
     
    3639    from anuga.abstract_2d_finite_volumes.quantity import Quantity
    3740    from math import sin, radians
    38     from Numeric import zeros, Float
    3941
    4042    #zrec0 = Quantity(domain)
     
    4345    zrec=zrec0.get_vertex_values(xy=True)
    4446   
    45     x0= zeros(ns,Float)
    46     y0= zeros(ns,Float)
     47    x0= num.zeros(ns,num.Float)
     48    y0= num.zeros(ns,num.Float)
    4749    if ns ==1:
    4850        x0[0]=xi
     
    130132        produced by a submarine mass failure.
    131133        """
    132         from Numeric import zeros, Float
    133134        from string import replace,strip
    134135        from math import sin, cos, radians, exp, cosh
    135         from Numeric import zeros, Float
    136136        #ensure vectors x and y have the same length
    137137        N = len(x)
     
    151151        zrec=self.zrec
    152152        #initialization
    153         disp0=zeros(3,Float)
    154         strain0=zeros(6,Float)
    155         tilt0 = zeros(2,Float)
    156         dislocations=zeros(ns,Float)
    157         depths=zeros(ns,Float)
    158         strikes= zeros(ns,Float)
    159         lengths= zeros(ns,Float)
    160         slips= zeros(ns,Float)
    161         rakes= zeros(ns,Float)
    162         widths= zeros(ns,Float)
    163         dips= zeros(ns,Float)
    164         strikes= zeros(ns,Float)
    165         strikes= zeros(ns,Float)
    166         strain = zeros((N,6),Float)
    167         disp = zeros((N,3),Float)
    168         tilt = zeros((N,2),Float)
    169         xs =zeros(ns,Float)
    170         ys =zeros(ns,Float)
     153        disp0=num.zeros(3,num.Float)
     154        strain0=num.zeros(6,num.Float)
     155        tilt0 = num.zeros(2,num.Float)
     156        dislocations=num.zeros(ns,num.Float)
     157        depths=num.zeros(ns,num.Float)
     158        strikes= num.zeros(ns,num.Float)
     159        lengths= num.zeros(ns,num.Float)
     160        slips= num.zeros(ns,num.Float)
     161        rakes= num.zeros(ns,num.Float)
     162        widths= num.zeros(ns,num.Float)
     163        dips= num.zeros(ns,num.Float)
     164        strikes= num.zeros(ns,num.Float)
     165        strikes= num.zeros(ns,num.Float)
     166        strain = num.zeros((N,6),num.Float)
     167        disp = num.zeros((N,3),num.Float)
     168        tilt = num.zeros((N,2),num.Float)
     169        xs =num.zeros(ns,num.Float)
     170        ys =num.zeros(ns,num.Float)
    171171        z=[]
    172172        if ns==1:
     
    376376#        COMMON /C1/DUMMY(8),R,dumm(15)                                   
    377377#          DIMENSION  U(12),DUA(12),DUB(12),DUC(12)
    378           from Numeric import zeros, Float
    379378         
    380379          F0=0.0                                                   
    381           U=zeros((12,1),Float)
    382           DUA=zeros((12,1),Float)
    383           DUB=zeros((12,1),Float)
    384           DUC=zeros((12,1),Float)
     380          U=num.zeros((12,1),num.Float)
     381          DUA=num.zeros((12,1),num.Float)
     382          DUB=num.zeros((12,1),num.Float)
     383          DUC=num.zeros((12,1),num.Float)
    385384         
    386385         
     
    483482#    *           UY,VY,WY,UZ,VZ,WZ
    484483
    485        from Numeric import zeros, Float
    486484         
    487485                                                             
     
    528526       WZ=self.WZ
    529527
    530        DUA=zeros((12,1),Float)
    531        DU=zeros((12,1),Float)
    532        U=zeros((12,1),Float)
     528       DUA=num.zeros((12,1),num.Float)
     529       DU=num.zeros((12,1),num.Float)
     530       U=num.zeros((12,1),num.Float)
    533531#-----                                                               
    534532       for I in range(0,12):                                                   
     
    637635#     *        /0.D0,1.D0,2.D0,3.D0,4.D0,5.D0,8.D0,9.D0/                 
    638636#      DATA PI2/6.283185307179586D0/
    639         from Numeric import zeros, Float
    640637       
    641         DUB=zeros((12,1),Float)
    642         DU=zeros((12,1),Float)
    643         U=zeros((12,1),Float)
     638        DUB=num.zeros((12,1),num.Float)
     639        DU=num.zeros((12,1),num.Float)
     640        U=num.zeros((12,1),num.Float)
    644641       
    645642        F0=0.0
     
    814811       
    815812
    816       from Numeric import zeros, Float
    817        
    818       DUC=zeros((12,1),Float)
    819       DU=zeros((12,1),Float)
    820       U=zeros((12,1),Float)
     813      DUC=num.zeros((12,1),num.Float)
     814      DU=num.zeros((12,1),num.Float)
     815      U=num.zeros((12,1),num.Float)
    821816             
    822817      F0=0.0
     
    10061001 #     DIMENSION  XI(2),ET(2),KXI(2),KET(2)                             
    10071002 #     DIMENSION  U(12),DU(12),DUA(12),DUB(12),DUC(12)                 
    1008       from Numeric import zeros, Float
    10091003      from math import sqrt
    10101004      F0 =0.0
    10111005      EPS=0.000001
    10121006       
    1013       XI=zeros(2,Float)
    1014       ET=zeros(2,Float)
    1015       KXI=zeros(2,Float)
    1016       KET=zeros(2,Float)
    1017       U=zeros(12,Float)
    1018       DU=zeros(12,Float)
    1019       DUA=zeros(12,Float)
    1020       DUB=zeros(12,Float)
    1021       DUC=zeros(12,Float)
     1007      XI=num.zeros(2,num.Float)
     1008      ET=num.zeros(2,num.Float)
     1009      KXI=num.zeros(2,num.Float)
     1010      KET=num.zeros(2,num.Float)
     1011      U=num.zeros(12,num.Float)
     1012      DU=num.zeros(12,num.Float)
     1013      DUA=num.zeros(12,num.Float)
     1014      DUB=num.zeros(12,num.Float)
     1015      DUC=num.zeros(12,num.Float)
    10221016
    10231017#-----                                                                 
     
    12171211
    12181212
    1219       from Numeric import zeros, Float
    1220        
    1221       U=zeros(12,Float)
    1222       DU=zeros(12,Float)
    1223       DUA=zeros(12,Float)
     1213      U=num.zeros(12,num.Float)
     1214      DU=num.zeros(12,num.Float)
     1215      DUA=num.zeros(12,num.Float)
    12241216      F0 =0.0
    12251217      F2=2.0
     
    13501342#      DATA  F0,F1,F2,PI2/0.D0,1.D0,2.D0,6.283185307179586D0/
    13511343
    1352       from Numeric import zeros, Float
    1353        
    1354       DUB=zeros(12,Float)
    1355       DU=zeros(12,Float)
    1356       U=zeros(12,Float)
     1344      DUB=num.zeros(12,num.Float)
     1345      DU=num.zeros(12,num.Float)
     1346      U=num.zeros(12,num.Float)
    13571347     
    13581348      F0=0.0
     
    15171507 #     DATA F0,F1,F2,F3,PI2/0.D0,1.D0,2.D0,3.D0,6.283185307179586D0/
    15181508
    1519       from Numeric import zeros, Float
    1520        
    1521       DUC=zeros(12,Float)
    1522       DU=zeros(12,Float)
    1523       U=zeros(12,Float)
     1509      DUC=num.zeros(12,num.Float)
     1510      DU=num.zeros(12,num.Float)
     1511      U=num.zeros(12,num.Float)
    15241512     
    15251513      F0=0.0
Note: See TracChangeset for help on using the changeset viewer.