Index: branches/numpy/anuga/shallow_water/data_manager.py
===================================================================
--- anuga_core/source/anuga/shallow_water/data_manager.py	(revision 6224)
+++ branches/numpy/anuga/shallow_water/data_manager.py	(revision 6304)
@@ -61,5 +61,5 @@
 from os import sep, path, remove, mkdir, access, F_OK, W_OK, getcwd
 
-import Numeric as num
+import numpy as num
 
 from Scientific.IO.NetCDF import NetCDFFile
@@ -76,4 +76,5 @@
      default_minimum_storable_height
 from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a
+from anuga.config import netcdf_float, netcdf_float32, netcdf_int
 from anuga.config import max_float
 from anuga.utilities.numerical_tools import ensure_numeric,  mean
@@ -343,5 +344,5 @@
         from Scientific.IO.NetCDF import NetCDFFile
 
-        self.precision = num.Float32 #Use single precision for quantities
+        self.precision = netcdf_float32 #Use single precision for quantities
         self.recursion = recursion
         self.mode = mode
@@ -438,9 +439,8 @@
 
         # store the connectivity data
-        points = num.concatenate( (X[:,num.NewAxis],Y[:,num.NewAxis]), axis=1 )
+        points = num.concatenate( (X[:,num.newaxis],Y[:,num.newaxis]), axis=1 )
         self.writer.store_triangulation(fid,
                                         points,
-#                                        V.astype(volumes.typecode()),
-                                        V.astype(num.Float32),
+                                        V.astype(num.float32),
                                         Z,
                                         points_georeference=\
@@ -561,5 +561,5 @@
                 # Define a zero vector of same size and type as A
                 # for use with momenta
-                null = num.zeros(num.size(A), A.typecode())
+                null = num.zeros(num.size(A), A.dtype.char) #??#
 
                 # Get xmomentum where depth exceeds minimum_storable_height
@@ -622,5 +622,5 @@
         from Scientific.IO.NetCDF import NetCDFFile
 
-        self.precision = num.Float #Use full precision
+        self.precision = netcdf_float #Use full precision
 
         Data_format.__init__(self, domain, 'sww', mode)
@@ -650,6 +650,6 @@
 
 
-            fid.createVariable('volumes', num.Int, ('number_of_volumes',
-                                                    'number_of_vertices'))
+            fid.createVariable('volumes', netcdf_int, ('number_of_volumes',
+                                                       'number_of_vertices'))
 
             fid.createVariable('time', self.precision, ('number_of_timesteps',))
@@ -1304,7 +1304,7 @@
 
     M = size  #Number of lines
-    xx = num.zeros((M,3), num.Float)
-    yy = num.zeros((M,3), num.Float)
-    zz = num.zeros((M,3), num.Float)
+    xx = num.zeros((M,3), num.float)
+    yy = num.zeros((M,3), num.float)
+    zz = num.zeros((M,3), num.float)
 
     for i in range(M):
@@ -1349,7 +1349,7 @@
 
     M = len(lines)  #Number of lines
-    x = num.zeros((M,3), num.Float)
-    y = num.zeros((M,3), num.Float)
-    z = num.zeros((M,3), num.Float)
+    x = num.zeros((M,3), num.float)
+    y = num.zeros((M,3), num.float)
+    z = num.zeros((M,3), num.float)
 
     for i, line in enumerate(lines):
@@ -1409,5 +1409,7 @@
 # @param step Timestep stride.
 def filter_netcdf(filename1, filename2, first=0, last=None, step=1):
-    """Read netcdf filename1, pick timesteps first:step:last and save to
+    """Filter data file, selecting timesteps first:step:last.
+    
+    Read netcdf filename1, pick timesteps first:step:last and save to
     nettcdf file filename2
     """
@@ -1426,5 +1428,5 @@
     for name in infile.variables:
         var = infile.variables[name]
-        outfile.createVariable(name, var.typecode(), var.dimensions)
+        outfile.createVariable(name, var.dtype.char, var.dimensions)    #??#
 
     # Copy the static variables
@@ -1499,6 +1501,6 @@
     Convert to NetCDF pts format which is
 
-    points:  (Nx2) Float array
-    elevation: N Float array
+    points:  (Nx2) float array
+    elevation: N float array
     """
 
@@ -1658,7 +1660,7 @@
 
     # Variable definitions
-    outfile.createVariable('points', num.Float, ('number_of_points',
-                                                 'number_of_dimensions'))
-    outfile.createVariable('elevation', num.Float, ('number_of_points',))
+    outfile.createVariable('points', netcdf_float, ('number_of_points',
+                                                    'number_of_dimensions'))
+    outfile.createVariable('elevation', netcdf_float, ('number_of_points',))
 
     # Get handles to the variables
@@ -1684,6 +1686,6 @@
             newcols = lenv              # ncols_in_bounding_box
 
-        telev = num.zeros(newcols, num.Float)
-        tpoints = num.zeros((newcols, 2), num.Float)
+        telev = num.zeros(newcols, num.float)
+        tpoints = num.zeros((newcols, 2), num.float)
 
         local_index = 0
@@ -1801,6 +1803,6 @@
     Convert to NetCDF pts format which is
 
-    points:  (Nx2) Float array
-    elevation: N Float array
+    points:  (Nx2) float array
+    elevation: N float array
     """
 
@@ -2245,10 +2247,10 @@
         # Comment out for reduced memory consumption
         for name in ['stage', 'xmomentum', 'ymomentum']:
-            q = fid.variables[name][:].flat
+            q = fid.variables[name][:].flatten()
             if timestep is not None:
                 q = q[timestep*len(x):(timestep+1)*len(x)]
             if verbose: print '    %s in [%f, %f]' %(name, min(q), max(q))
         for name in ['elevation']:
-            q = fid.variables[name][:].flat
+            q = fid.variables[name][:].flatten()
             if verbose: print '    %s in [%f, %f]' %(name, min(q), max(q))
 
@@ -2256,5 +2258,5 @@
     if verbose: print 'Processing quantity %s' %quantity
 
-    # Turn NetCDF objects into Numeric arrays
+    # Turn NetCDF objects into numeric arrays
     try:
         q = fid.variables[quantity][:]
@@ -2269,5 +2271,5 @@
         #q has a time component, must be reduced alongthe temporal dimension
         if verbose: print 'Reducing quantity %s' %quantity
-        q_reduced = num.zeros(number_of_points, num.Float)
+        q_reduced = num.zeros(number_of_points, num.float)
 
         if timestep is not None:
@@ -2329,8 +2331,8 @@
     y = y + yllcorner - newyllcorner
 
-    vertex_points = num.concatenate ((x[:,num.NewAxis], y[:,num.NewAxis]), axis=1)
+    vertex_points = num.concatenate ((x[:,num.newaxis], y[:,num.newaxis]), axis=1)
     assert len(vertex_points.shape) == 2
 
-    grid_points = num.zeros ((ncols*nrows, 2), num.Float)
+    grid_points = num.zeros ((ncols*nrows, 2), num.float)
 
     for i in xrange(nrows):
@@ -2359,9 +2361,9 @@
     #Interpolate using quantity values
     if verbose: print 'Interpolating'
-    grid_values = interp.interpolate(q, grid_points).flat
+    grid_values = interp.interpolate(q, grid_points).flatten()
 
     if verbose:
-        print 'Interpolated values are in [%f, %f]' %(min(grid_values),
-                                                      max(grid_values))
+        print 'Interpolated values are in [%f, %f]' %(min(grid_values.flat),
+                                                      max(grid_values.flat))
 
     #Assign NODATA_value to all points outside bounding polygon (from interpolation mesh)
@@ -2631,5 +2633,5 @@
     if verbose: print 'Processing quantity %s' % quantity
 
-    # Turn NetCDF objects into Numeric arrays
+    # Turn NetCDF objects into numeric arrays
     quantity_dict = {}
     for name in fid.variables.keys():
@@ -2644,5 +2646,5 @@
         if verbose: print 'Reducing quantity %s' % quantity
 
-        q_reduced = num.zeros(number_of_points, num.Float)
+        q_reduced = num.zeros(number_of_points, num.float)
         for k in range(number_of_points):
             q_reduced[k] = reduction(q[:,k])
@@ -2658,5 +2660,5 @@
 
     # Create grid and update xll/yll corner and x,y
-    vertex_points = num.concatenate((x[:, num.NewAxis], y[:, num.NewAxis]), axis=1)
+    vertex_points = num.concatenate((x[:, num.newaxis], y[:, num.newaxis]), axis=1)
     assert len(vertex_points.shape) == 2
 
@@ -2667,9 +2669,9 @@
     # Interpolate using quantity values
     if verbose: print 'Interpolating'
-    interpolated_values = interp.interpolate(q, data_points).flat
+    interpolated_values = interp.interpolate(q, data_points).flatten
 
     if verbose:
-        print 'Interpolated values are in [%f, %f]' % (min(interpolated_values),
-                                                       max(interpolated_values))
+        print 'Interpolated values are in [%f, %f]' \
+              % (min(interpolated_values.flat), max(interpolated_values.flat))
 
     # Assign NODATA_value to all points outside bounding polygon
@@ -2878,6 +2880,6 @@
 
     # variable definitions
-    fid.createVariable('elevation', num.Float, ('number_of_rows',
-                                                'number_of_columns'))
+    fid.createVariable('elevation', netcdf_float, ('number_of_rows',
+                                                   'number_of_columns'))
 
     # Get handles to the variables
@@ -2959,5 +2961,5 @@
     from Scientific.IO.NetCDF import NetCDFFile
 
-    precision = num.Float
+    precision = num.float
 
     msg = 'Must use latitudes and longitudes for minlat, maxlon etc'
@@ -3078,10 +3080,10 @@
     #        elevations = file_e.variables['ELEVATION'][kmin:kmax, lmin:lmax]
     #    elif latitudes2[0]==latitudes[-1] and latitudes2[-1]==latitudes[0]:
-    #        from Numeric import asarray
+    #        from numpy import asarray
     #        elevations=elevations.tolist()
     #        elevations.reverse()
     #        elevations=asarray(elevations)
     #    else:
-    #        from Numeric import asarray
+    #        from numpy import asarray
     #        elevations=elevations.tolist()
     #        elevations.reverse()
@@ -3195,10 +3197,10 @@
     sww.store_header(outfile, times, number_of_volumes,
                      number_of_points, description=description,
-                     verbose=verbose, sww_precision=num.Float)
+                     verbose=verbose, sww_precision=netcdf_float)
 
     # Store
     from anuga.coordinate_transforms.redfearn import redfearn
-    x = num.zeros(number_of_points, num.Float)  #Easting
-    y = num.zeros(number_of_points, num.Float)  #Northing
+    x = num.zeros(number_of_points, num.float)  #Easting
+    y = num.zeros(number_of_points, num.float)  #Northing
 
     if verbose: print 'Making triangular grid'
@@ -3234,5 +3236,5 @@
             volumes.append([v4,v3,v2]) #Lower element
 
-    volumes = num.array(volumes, num.Int)      #array default#
+    volumes = num.array(volumes)
 
     if origin is None:
@@ -3255,5 +3257,5 @@
     outfile.variables['z'][:] = z             #FIXME HACK for bacwards compat.
     outfile.variables['elevation'][:] = z
-    outfile.variables['volumes'][:] = volumes.astype(num.Int32) #For Opteron 64
+    outfile.variables['volumes'][:] = volumes.astype(num.int32) #For Opteron 64
 
     #Time stepping
@@ -3387,6 +3389,6 @@
     d = len(q)
 
-    T = num.zeros(N, num.Float)       # Time
-    Q = num.zeros((N, d), num.Float)  # Values
+    T = num.zeros(N, num.float)       # Time
+    Q = num.zeros((N, d), num.float)  # Values
 
     for i, line in enumerate(lines):
@@ -3424,5 +3426,5 @@
     fid.createDimension('number_of_timesteps', len(T))
 
-    fid.createVariable('time', num.Float, ('number_of_timesteps',))
+    fid.createVariable('time', netcdf_float, ('number_of_timesteps',))
 
     fid.variables['time'][:] = T
@@ -3434,5 +3436,5 @@
             name = 'Attribute%d' % i
 
-        fid.createVariable(name, num.Float, ('number_of_timesteps',))
+        fid.createVariable(name, netcdf_float, ('number_of_timesteps',))
         fid.variables[name][:] = Q[:,i]
 
@@ -3505,5 +3507,5 @@
     time_interp = get_time_interp(time,t)
 
-    # Get the variables as Numeric arrays
+    # Get the variables as numeric arrays
     x = fid.variables['x'][:]                   # x-coordinates of vertices
     y = fid.variables['y'][:]                   # y-coordinates of vertices
@@ -3518,5 +3520,5 @@
     # FIXME (Ole): Something like this might be better:
     #                 concatenate((x, y), axis=1)
-    # or              concatenate((x[:,num.NewAxis], x[:,num.NewAxis]), axis=1)
+    # or              concatenate((x[:,num.newaxis], x[:,num.newaxis]), axis=1)
 
     conserved_quantities = []
@@ -3706,7 +3708,7 @@
 # @param boundary 
 def weed(coordinates, volumes, boundary=None):
-    if type(coordinates) == num.ArrayType:
+    if isinstance(coordinates, num.ndarray):
         coordinates = coordinates.tolist()
-    if type(volumes) == num.ArrayType:
+    if isinstance(volumes, num.ndarray):
         volumes = volumes.tolist()
 
@@ -3854,5 +3856,5 @@
 
     # variable definition
-    outfile.createVariable('elevation', num.Float, ('number_of_points',))
+    outfile.createVariable('elevation', netcdf_float, ('number_of_points',))
 
     # Get handle to the variable
@@ -3867,5 +3869,5 @@
 
         lower_index = global_index
-        telev = num.zeros(ncols_new, num.Float)
+        telev = num.zeros(ncols_new, num.float)
         local_index = 0
         trow = i * cellsize_ratio
@@ -3995,5 +3997,5 @@
     from anuga.coordinate_transforms.redfearn import redfearn
 
-    precision = num.Float # So if we want to change the precision its done here
+    precision = netcdf_float # So if we want to change the precision its done here
 
     # go in to the bath dir and load the only file,
@@ -4096,6 +4098,6 @@
     #################################
 
-    outfile.createVariable('volumes', num.Int, ('number_of_volumes',
-                                                'number_of_vertices'))
+    outfile.createVariable('volumes', netcdf_int, ('number_of_volumes',
+                                                   'number_of_vertices'))
 
     outfile.createVariable('time', precision, ('number_of_timesteps',))
@@ -4113,6 +4115,6 @@
     from anuga.coordinate_transforms.redfearn import redfearn
 
-    x = num.zeros(number_of_points, num.Float)  #Easting
-    y = num.zeros(number_of_points, num.Float)  #Northing
+    x = num.zeros(number_of_points, num.float)  #Easting
+    y = num.zeros(number_of_points, num.float)  #Northing
 
     if verbose: print 'Making triangular grid'
@@ -4150,5 +4152,5 @@
             volumes.append([v4,v2,v3]) #Lower element
 
-    volumes = num.array(volumes, num.Int)      #array default#
+    volumes = num.array(volumes)
 
     geo_ref = Geo_reference(refzone, min(x), min(y))
@@ -4175,5 +4177,5 @@
     outfile.variables['z'][:] = z
     outfile.variables['elevation'][:] = z
-    outfile.variables['volumes'][:] = volumes.astype(num.Int32) # On Opteron 64
+    outfile.variables['volumes'][:] = volumes.astype(num.int32) # On Opteron 64
 
     stage = outfile.variables['stage']
@@ -4367,5 +4369,5 @@
 lat_name = 'LAT'
 time_name = 'TIME'
-precision = num.Float # So if we want to change the precision its done here
+precision = netcdf_float # So if we want to change the precision its done here
 
 ##
@@ -4648,5 +4650,5 @@
     lonlatdep = p_array.array('f')
     lonlatdep.read(mux_file, columns * points_num)
-    lonlatdep = num.array(lonlatdep, typecode=num.Float)
+    lonlatdep = num.array(lonlatdep, dtype=num.float)
     lonlatdep = num.reshape(lonlatdep, (points_num, columns))
 
@@ -4655,5 +4657,5 @@
     lon_sorted.sort()
 
-    if not lon == lon_sorted:
+    if not num.alltrue(lon == lon_sorted):
         msg = "Longitudes in mux file are not in ascending order"
         raise IOError, msg
@@ -4661,8 +4663,4 @@
     lat_sorted = list(lat)
     lat_sorted.sort()
-
-# UNUSED?
-##    if not lat == lat_sorted:
-##        msg = "Latitudes in mux file are not in ascending order"
 
     nc_file = Write_nc(quantity,
@@ -4677,5 +4675,5 @@
         hz_p_array = p_array.array('f')
         hz_p_array.read(mux_file, points_num)
-        hz_p = num.array(hz_p_array, typecode=num.Float)
+        hz_p = num.array(hz_p_array, dtype=num.float)
         hz_p = num.reshape(hz_p, (len(lon), len(lat)))
         hz_p = num.transpose(hz_p)  # mux has lat varying fastest, nc has long v.f.
@@ -4775,5 +4773,5 @@
     QUANTITY = 2
 
-    long_lat_dep = ensure_numeric(long_lat_dep, num.Float)
+    long_lat_dep = ensure_numeric(long_lat_dep, num.float)
 
     num_points = long_lat_dep.shape[0]
@@ -4813,5 +4811,5 @@
     # FIXME - make this faster/do this a better way
     # use numeric transpose, after reshaping the quantity vector
-    quantity = num.zeros(num_points, num.Float)
+    quantity = num.zeros(num_points, num.float)
 
     for lat_i, _ in enumerate(lat):
@@ -5266,6 +5264,6 @@
 
     points_utm=ensure_numeric(points_utm)
-    assert ensure_numeric(mesh_dic['generatedpointlist']) \
-           == ensure_numeric(points_utm)
+    assert num.alltrue(ensure_numeric(mesh_dic['generatedpointlist'])
+                       == ensure_numeric(points_utm))
 
     volumes = mesh_dic['generatedtrianglelist']
@@ -5285,5 +5283,5 @@
     sww = Write_sww()
     sww.store_header(outfile, times, len(volumes), len(points_utm),
-                     verbose=verbose, sww_precision=num.Float)
+                     verbose=verbose, sww_precision=netcdf_float)
     outfile.mean_stage = mean_stage
     outfile.zscale = zscale
@@ -5309,5 +5307,5 @@
                                  xmomentum=xmomentum,
                                  ymomentum=ymomentum,
-                                 sww_precision=num.Float)
+                                 sww_precision=num.float)
         j += 1
 
@@ -5356,5 +5354,5 @@
     numSrc = len(filenames)
 
-    file_params = -1 * num.ones(3, num.Float)                    # [nsta,dt,nt]
+    file_params = -1 * num.ones(3, num.float)                    # [nsta,dt,nt]
 
     # Convert verbose to int C flag
@@ -5365,8 +5363,8 @@
 
     if weights is None:
-        weights = num.ones(numSrc)
+        weights = num.ones(numSrc, num.int)     #array default#
 
     if permutation is None:
-        permutation = ensure_numeric([], num.Float)
+        permutation = ensure_numeric([], num.float)
 
     # Call underlying C implementation urs2sts_ext.c
@@ -5416,8 +5414,8 @@
 
     times = dt * num.arange(parameters_index)
-    latitudes = num.zeros(number_of_selected_stations, num.Float)
-    longitudes = num.zeros(number_of_selected_stations, num.Float)
-    elevation = num.zeros(number_of_selected_stations, num.Float)
-    quantity = num.zeros((number_of_selected_stations, parameters_index), num.Float)
+    latitudes = num.zeros(number_of_selected_stations, num.float)
+    longitudes = num.zeros(number_of_selected_stations, num.float)
+    elevation = num.zeros(number_of_selected_stations, num.float)
+    quantity = num.zeros((number_of_selected_stations, parameters_index), num.float)
 
     starttime = 1e16
@@ -5543,5 +5541,5 @@
     if weights is None:
         # Default is equal weighting
-        weights = num.ones(numSrc, num.Float) / numSrc
+        weights = num.ones(numSrc, num.float) / numSrc
     else:
         weights = ensure_numeric(weights)
@@ -5665,5 +5663,5 @@
     # 0 to number_of_points-1
     if permutation is None:
-        permutation = num.arange(number_of_points, typecode=num.Int)
+        permutation = num.arange(number_of_points, dtype=num.int)
 
     # NetCDF file definition
@@ -5679,11 +5677,11 @@
                      description=description,
                      verbose=verbose,
-                     sts_precision=num.Float)
+                     sts_precision=netcdf_float)
 
     # Store
     from anuga.coordinate_transforms.redfearn import redfearn
 
-    x = num.zeros(number_of_points, num.Float)  # Easting
-    y = num.zeros(number_of_points, num.Float)  # Northing
+    x = num.zeros(number_of_points, num.float)  # Easting
+    y = num.zeros(number_of_points, num.float)  # Northing
 
     # Check zone boundaries
@@ -5716,5 +5714,5 @@
 
     elevation = num.resize(elevation, outfile.variables['elevation'][:].shape)
-    outfile.variables['permutation'][:] = permutation.astype(num.Int32) # Opteron 64
+    outfile.variables['permutation'][:] = permutation.astype(num.int32) # Opteron 64
     outfile.variables['x'][:] = x - geo_ref.get_xllcorner()
     outfile.variables['y'][:] = y - geo_ref.get_yllcorner()
@@ -5821,5 +5819,5 @@
     # @param smoothing True if smoothing is to be used.
     # @param order 
-    # @param sww_precision Data type of the quantitiy to be written (Float32)
+    # @param sww_precision Data type of the quantitiy written (netcdf constant)
     # @param verbose True if this function is to be verbose.
     # @note If 'times' is a list, the info will be made relative.
@@ -5832,5 +5830,5 @@
                      smoothing=True,
                      order=1,
-                     sww_precision=num.Float32,
+                     sww_precision=netcdf_float32,
                      verbose=False):
         """Write an SWW file header.
@@ -5865,5 +5863,5 @@
         # This is being used to seperate one number from a list.
         # what it is actually doing is sorting lists from numeric arrays.
-        if type(times) is list or type(times) is num.ArrayType:
+        if type(times) is list or isinstance(times, num.ndarray):
             number_of_times = len(times)
             times = ensure_numeric(times)
@@ -5914,9 +5912,9 @@
         outfile.createVariable('z', sww_precision, ('number_of_points',))
 
-        outfile.createVariable('volumes', num.Int, ('number_of_volumes',
-                                                    'number_of_vertices'))
+        outfile.createVariable('volumes', netcdf_int, ('number_of_volumes',
+                                                       'number_of_vertices'))
 
         # Doing sww_precision instead of Float gives cast errors.
-        outfile.createVariable('time', num.Float,
+        outfile.createVariable('time', netcdf_float,
                                ('number_of_timesteps',))
 
@@ -5932,5 +5930,5 @@
             #outfile.variables[q+Write_sww.RANGE][1] = -max_float # Max
 
-        if type(times) is list or type(times) is num.ArrayType:
+        if type(times) is list or isinstance(times, num.ndarray):
             outfile.variables['time'][:] = times    #Store time relative
 
@@ -6035,5 +6033,5 @@
         outfile.variables['z'][:] = elevation
         outfile.variables['elevation'][:] = elevation  #FIXME HACK
-        outfile.variables['volumes'][:] = volumes.astype(num.Int32) #On Opteron 64
+        outfile.variables['volumes'][:] = volumes.astype(num.int32) #On Opteron 64
 
         q = 'elevation'
@@ -6051,5 +6049,5 @@
     # @param verbose True if this function is to be verbose.
     # @param **quant
-    def store_quantities(self, outfile, sww_precision=num.Float32,
+    def store_quantities(self, outfile, sww_precision=num.float32,
                          slice_index=None, time=None,
                          verbose=False, **quant):
@@ -6236,5 +6234,5 @@
     # @param number_of_points The number of URS gauge sites.
     # @param description Description string to write into the STS file.
-    # @param sts_precision Format of data to write (default Float32).
+    # @param sts_precision Format of data to write (netcdf constant ONLY).
     # @param verbose True if this function is to be verbose.
     # @note If 'times' is a list, the info will be made relative.
@@ -6244,5 +6242,5 @@
                      number_of_points,
                      description='Converted from URS mux2 format',
-                     sts_precision=num.Float32,
+                     sts_precision=netcdf_float32,
                      verbose=False):
         """
@@ -6267,5 +6265,5 @@
         # This is being used to seperate one number from a list.
         # what it is actually doing is sorting lists from numeric arrays.
-        if type(times) is list or type(times) is num.ArrayType:
+        if type(times) is list or isinstance(times, num.ndarray):
             number_of_times = len(times)
             times = ensure_numeric(times)
@@ -6287,5 +6285,5 @@
 
         # Variable definitions
-        outfile.createVariable('permutation', num.Int, ('number_of_points',))
+        outfile.createVariable('permutation', netcdf_int, ('number_of_points',))
         outfile.createVariable('x', sts_precision, ('number_of_points',))
         outfile.createVariable('y', sts_precision, ('number_of_points',))
@@ -6302,5 +6300,5 @@
 
         # Doing sts_precision instead of Float gives cast errors.
-        outfile.createVariable('time', num.Float, ('number_of_timesteps',))
+        outfile.createVariable('time', netcdf_float, ('number_of_timesteps',))
 
         for q in Write_sts.sts_quantities:
@@ -6314,5 +6312,5 @@
             outfile.variables[q + Write_sts.RANGE][1] = -max_float # Max
 
-        if type(times) is list or type(times) is num.ArrayType:
+        if type(times) is list or isinstance(times, num.ndarray):
             outfile.variables['time'][:] = times    #Store time relative
 
@@ -6423,5 +6421,5 @@
     # @param verboseTrue if this function is to be verbose.
     # @param **quant Extra keyword args.
-    def store_quantities(self, outfile, sts_precision=num.Float32,
+    def store_quantities(self, outfile, sts_precision=num.float32,
                          slice_index=None, time=None,
                          verbose=False, **quant):
@@ -6514,5 +6512,5 @@
         lonlatdep = p_array.array('f')
         lonlatdep.read(mux_file, columns * self.points_num)
-        lonlatdep = num.array(lonlatdep, typecode=num.Float)
+        lonlatdep = num.array(lonlatdep, dtype=num.float)
         lonlatdep = num.reshape(lonlatdep, (self.points_num, columns))
         self.lonlatdep = lonlatdep
@@ -6550,5 +6548,5 @@
         hz_p_array = p_array.array('f')
         hz_p_array.read(self.mux_file, self.points_num)
-        hz_p = num.array(hz_p_array, typecode=num.Float)
+        hz_p = num.array(hz_p_array, dtype=num.float)
         self.iter_time_step += 1
 
@@ -6695,5 +6693,5 @@
     # array to store data, number in there is to allow float...
     # i'm sure there is a better way!
-    data = num.array([], typecode=num.Float)
+    data = num.array([], dtype=num.float)
     data = num.resize(data, ((len(lines)-1), len(header_fields)))
 
@@ -6861,5 +6859,5 @@
     time += fid.starttime[0]
 
-    # Get the variables as Numeric arrays
+    # Get the variables as numeric arrays
     x = fid.variables['x'][:]                   # x-coordinates of nodes
     y = fid.variables['y'][:]                   # y-coordinates of nodes
@@ -6870,5 +6868,5 @@
 
     # Mesh (nodes (Mx2), triangles (Nx3))
-    nodes = num.concatenate((x[:,num.NewAxis], y[:,num.NewAxis]), axis=1)
+    nodes = num.concatenate((x[:,num.newaxis], y[:,num.newaxis]), axis=1)
     triangles = fid.variables['volumes'][:]
 
@@ -7293,6 +7291,6 @@
 
         # Get the relevant quantities (Convert from single precison)
-        elevation = num.array(fid.variables['elevation'][:], num.Float)
-        stage = num.array(fid.variables['stage'][:], num.Float)
+        elevation = num.array(fid.variables['elevation'][:], num.float)
+        stage = num.array(fid.variables['stage'][:], num.float)
 
         # Here's where one could convert nodal information to centroid
@@ -7311,5 +7309,5 @@
             # and call it here
 
-            points = num.concatenate((x[:,num.NewAxis], y[:,num.NewAxis]), axis=1)
+            points = num.concatenate((x[:,num.newaxis], y[:,num.newaxis]), axis=1)
 
             point_indices = inside_polygon(points, polygon)
