Changeset 6157


Ignore:
Timestamp:
Jan 13, 2009, 5:42:30 PM (16 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)