Ignore:
Timestamp:
Nov 6, 2008, 12:17:15 PM (15 years ago)
Author:
ole
Message:

Reverted numpy changes to the trunk that should have been made to the branch.
The command was svn merge -r 5895:5890 .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r5892 r5897  
    1515
    1616from anuga.utilities.numerical_tools import ensure_numeric
    17 import numpy
     17from Numeric import arange, choose, zeros, Float, array, allclose, take, compress
    1818   
    1919from anuga.geospatial_data.geospatial_data import ensure_absolute
     
    237237    from anuga.config import time_format
    238238    from Scientific.IO.NetCDF import NetCDFFile
    239 ##    from numpy.oldnumeric import array, zeros, Float, alltrue, concatenate, reshape
     239    from Numeric import array, zeros, Float, alltrue, concatenate, reshape
    240240
    241241    # Open NetCDF file
     
    303303    # Get variables
    304304    # if verbose: print 'Get variables'   
    305     time = numpy.array(fid.variables['time'][:]    )
     305    time = fid.variables['time'][:]   
    306306
    307307    # Get time independent stuff
     
    317317            triangles = fid.variables['volumes'][:]
    318318
    319         x = numpy.reshape(x, (len(x),1))
    320         y = numpy.reshape(y, (len(y),1))
    321         vertex_coordinates = numpy.concatenate((x,y), axis=1) #m x 2 array
     319        x = reshape(x, (len(x),1))
     320        y = reshape(y, (len(y),1))
     321        vertex_coordinates = concatenate((x,y), axis=1) #m x 2 array
    322322
    323323        if boundary_polygon is not None:
     
    331331            for i in range(len(boundary_polygon)):
    332332                for j in range(len(x)):
    333                     if numpy.allclose(vertex_coordinates[j],boundary_polygon[i],1e-4):
     333                    if allclose(vertex_coordinates[j],boundary_polygon[i],1e-4):
    334334                        #FIX ME:
    335335                        #currently gauges lat and long is stored as float and
     
    351351                gauge_neighbour_id.append(-1)
    352352            gauge_neighbour_id=ensure_numeric(gauge_neighbour_id)
    353             if len(numpy.compress(gauge_neighbour_id>=0,gauge_neighbour_id))!=len(temp)-1:
     353            if len(compress(gauge_neighbour_id>=0,gauge_neighbour_id))!=len(temp)-1:
    354354                msg='incorrect number of segments'
    355355                raise msg
     
    373373        # move time back - relative to domain's time
    374374        if domain_starttime > starttime:
    375 ##            print 'type(time)=%s' % type(time)
    376 ##            print 'type(domain_starttime)=%s' % type(domain_starttime)
    377 ##            print 'type(starttime)=%s' % type(starttime)
    378 ##            a = time - domain_starttime
    379375            time = time - domain_starttime + starttime
    380376
     
    402398        if boundary_polygon is not None:
    403399            #removes sts points that do not lie on boundary
    404             quantities[name] = numpy.take(quantities[name], gauge_id, 1)
     400            quantities[name] = take(quantities[name],gauge_id,1)
    405401           
    406402    # Close sww, tms or sts netcdf file         
     
    524520                raise 'Illegal input to get_textual_float:', value
    525521        else:
    526             return format % float(value)
     522            return format %float(value)
    527523
    528524
     
    10401036    """
    10411037#    from math import sqrt, atan, degrees
    1042 ##    from numpy.oldnumeric import ones, allclose, zeros, Float, ravel
     1038    from Numeric import ones, allclose, zeros, Float, ravel
    10431039    from os import sep, altsep, getcwd, mkdir, access, F_OK, environ
    10441040
     
    10811077    n0 = int(n0)
    10821078    m = len(locations)
    1083     model_time = numpy.zeros((n0,m,p), numpy.float)
    1084     stages = numpy.zeros((n0,m,p), numpy.float)
    1085     elevations = numpy.zeros((n0,m,p), numpy.float)
    1086     momenta = numpy.zeros((n0,m,p), numpy.float)
    1087     xmom = numpy.zeros((n0,m,p), numpy.float)
    1088     ymom = numpy.zeros((n0,m,p), numpy.float)
    1089     speed = numpy.zeros((n0,m,p), numpy.float)
    1090     bearings = numpy.zeros((n0,m,p), numpy.float)
    1091     due_east = 90.0*numpy.ones((n0,1), numpy.float)
    1092     due_west = 270.0*numpy.ones((n0,1), numpy.float)
    1093     depths = numpy.zeros((n0,m,p), numpy.float)
    1094     eastings = numpy.zeros((n0,m,p), numpy.float)
     1079    model_time = zeros((n0,m,p), Float)
     1080    stages = zeros((n0,m,p), Float)
     1081    elevations = zeros((n0,m,p), Float)
     1082    momenta = zeros((n0,m,p), Float)
     1083    xmom = zeros((n0,m,p), Float)
     1084    ymom = zeros((n0,m,p), Float)
     1085    speed = zeros((n0,m,p), Float)
     1086    bearings = zeros((n0,m,p), Float)
     1087    due_east = 90.0*ones((n0,1), Float)
     1088    due_west = 270.0*ones((n0,1), Float)
     1089    depths = zeros((n0,m,p), Float)
     1090    eastings = zeros((n0,m,p), Float)
    10951091    min_stages = []
    10961092    max_stages = []
     
    11041100    min_speeds = []   
    11051101    max_depths = []
    1106     model_time_plot3d = numpy.zeros((n0,m), numpy.float)
    1107     stages_plot3d = numpy.zeros((n0,m), numpy.float)
    1108     eastings_plot3d = numpy.zeros((n0,m),numpy.float)
     1102    model_time_plot3d = zeros((n0,m), Float)
     1103    stages_plot3d = zeros((n0,m), Float)
     1104    eastings_plot3d = zeros((n0,m),Float)
    11091105    if time_unit is 'mins': scale = 60.0
    11101106    if time_unit is 'hours': scale = 3600.0
     
    12061202                else:
    12071203                    #ax.plot_wireframe(model_time[:,:,j],eastings[:,:,j],stages[:,:,j])
    1208                     ax.plot3D(numpy.ravel(eastings[:,:,j]),numpy.ravel(model_time[:,:,j]),numpy.ravel(stages[:,:,j]))
     1204                    ax.plot3D(ravel(eastings[:,:,j]),ravel(model_time[:,:,j]),ravel(stages[:,:,j]))
    12091205                ax.set_xlabel('time')
    12101206                ax.set_ylabel('x')
     
    15051501   
    15061502    # initialise the array to easily find the index of the first loner
    1507     loners=numpy.arange(2*N, N, -1) # if N=3 [6,5,4]
     1503    loners=arange(2*N, N, -1) # if N=3 [6,5,4]
    15081504    for t in triangles:
    15091505        for vert in t:
     
    15391535        #print "loners", loners
    15401536        #print "triangles before", triangles
    1541         triangles = numpy.choose(triangles,loners)
     1537        triangles = choose(triangles,loners)
    15421538        #print "triangles after", triangles
    15431539    return verts, triangles
     
    15541550
    15551551       
    1556     xc = numpy.zeros(triangles.shape[0], numpy.float) # Space for centroid info
     1552    xc = zeros(triangles.shape[0], Float) # Space for centroid info
    15571553   
    15581554    for k in range(triangles.shape[0]):
     
    18361832                #add tide to stage if provided
    18371833                if quantity == 'stage':
    1838                      quantity_value[quantity]=numpy.array(quantity_value[quantity])+directory_add_tide
     1834                     quantity_value[quantity]=array(quantity_value[quantity])+directory_add_tide
    18391835
    18401836                #condition to find max and mins for all the plots
     
    19471943            #get data from dict in to list
    19481944            #do maths to list by changing to array
    1949             t=(numpy.array(directory_quantity_value[directory][filename]['time'])+directory_start_time)/seconds_in_minutes
     1945            t=(array(directory_quantity_value[directory][filename]['time'])+directory_start_time)/seconds_in_minutes
    19501946
    19511947            #finds the maximum elevation, used only as a test
     
    21282124    from csv import reader,writer
    21292125    from anuga.utilities.numerical_tools import ensure_numeric, mean, NAN
    2130 ##    from numpy.oldnumeric import array, resize, shape, Float, zeros, take, argsort, argmin
     2126    from Numeric import array, resize, shape, Float, zeros, take, argsort, argmin
    21312127    import string
    21322128    from anuga.shallow_water.data_manager import get_all_swwfiles
     
    21692165       
    21702166    #convert to array for file_function
    2171     points_array = numpy.array(points, numpy.float)
     2167    points_array = array(points,Float)
    21722168       
    21732169    points_array = ensure_absolute(points_array)
Note: See TracChangeset for help on using the changeset viewer.