Ignore:
Timestamp:
Jun 30, 2009, 2:07:41 PM (15 years ago)
Author:
ole
Message:

Merged numpy branch back into the trunk.

In ~/sandpit/anuga/anuga_core/source
svn merge -r 6246:HEAD ../../branches/numpy .

In ~/sandpit/anuga/anuga_validation
svn merge -r 6417:HEAD ../branches/numpy_anuga_validation .

In ~/sandpit/anuga/misc
svn merge -r 6809:HEAD ../branches/numpy_misc .

For all merges, I used numpy version where conflicts existed

The suites test_all.py (in source/anuga) and validate_all.py passed using Python2.5 with numpy on my Ubuntu Linux box.

File:
1 edited

Legend:

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

    r7012 r7276  
    2727from anuga.config import netcdf_mode_r, netcdf_mode_w, netcdf_mode_a
    2828
    29 import Numeric as num
     29import numpy as num
    3030
    3131
     
    476476        if boundary_polygon is not None:
    477477            #removes sts points that do not lie on boundary
    478             quantities[name] = num.take(quantities[name], gauge_id, 1)
     478            quantities[name] = num.take(quantities[name], gauge_id, axis=1)
    479479           
    480480    # Close sww, tms or sts netcdf file         
     
    554554                expression e.g. by overloading
    555555
    556     Due to a limitation with Numeric, this can not evaluate 0/0
     556    Due to a limitation with numeric, this can not evaluate 0/0
    557557    In general, the user can fix by adding 1e-30 to the numerator.
    558558    SciPy core can handle this situation.
     
    789789                        - easting, northing, name , elevation?
    790790                    - OR (this is not yet done)
    791                         - structure which can be converted to a Numeric array,
     791                        - structure which can be converted to a numeric array,
    792792                          such as a geospatial data object
    793793                     
     
    12561256    n0 = int(n0)
    12571257    m = len(locations)
    1258     model_time = num.zeros((n0, m, p), num.Float)
    1259     stages = num.zeros((n0, m, p), num.Float)
    1260     elevations = num.zeros((n0, m, p), num.Float)
    1261     momenta = num.zeros((n0, m, p), num.Float)
    1262     xmom = num.zeros((n0, m, p), num.Float)
    1263     ymom = num.zeros((n0, m, p), num.Float)
    1264     speed = num.zeros((n0, m, p), num.Float)
    1265     bearings = num.zeros((n0, m, p), num.Float)
    1266     due_east = 90.0*num.ones((n0, 1), num.Float)
    1267     due_west = 270.0*num.ones((n0, 1), num.Float)
    1268     depths = num.zeros((n0, m, p), num.Float)
    1269     eastings = num.zeros((n0, m, p), num.Float)
     1258    model_time = num.zeros((n0, m, p), num.float)
     1259    stages = num.zeros((n0, m, p), num.float)
     1260    elevations = num.zeros((n0, m, p), num.float)
     1261    momenta = num.zeros((n0, m, p), num.float)
     1262    xmom = num.zeros((n0, m, p), num.float)
     1263    ymom = num.zeros((n0, m, p), num.float)
     1264    speed = num.zeros((n0, m, p), num.float)
     1265    bearings = num.zeros((n0, m, p), num.float)
     1266    due_east = 90.0*num.ones((n0, 1), num.float)
     1267    due_west = 270.0*num.ones((n0, 1), num.float)
     1268    depths = num.zeros((n0, m, p), num.float)
     1269    eastings = num.zeros((n0, m, p), num.float)
    12701270    min_stages = []
    12711271    max_stages = []
     
    12791279    min_speeds = []   
    12801280    max_depths = []
    1281     model_time_plot3d = num.zeros((n0, m), num.Float)
    1282     stages_plot3d = num.zeros((n0, m), num.Float)
    1283     eastings_plot3d = num.zeros((n0, m),num.Float)
     1281    model_time_plot3d = num.zeros((n0, m), num.float)
     1282    stages_plot3d = num.zeros((n0, m), num.float)
     1283    eastings_plot3d = num.zeros((n0, m),num.float)
    12841284    if time_unit is 'mins': scale = 60.0
    12851285    if time_unit is 'hours': scale = 3600.0
     
    18001800        # Remove the loners from verts
    18011801        # Could've used X=compress(less(loners,N),loners)
    1802         # verts=num.take(verts,X)  to Remove the loners from verts
     1802        # verts=num.take(verts,X,axis=0)  to Remove the loners from verts
    18031803        # but I think it would use more memory
    18041804        new_i = lone_start      # point at first loner - 'shuffle down' target
     
    18341834    """
    18351835       
    1836     xc = num.zeros(triangles.shape[0], num.Float) # Space for centroid info
     1836    xc = num.zeros(triangles.shape[0], num.float) # Space for centroid info
    18371837   
    18381838    for k in range(triangles.shape[0]):
     
    21212121                #add tide to stage if provided
    21222122                if quantity == 'stage':
    2123                      quantity_value[quantity] = num.array(quantity_value[quantity], num.Float) \
    2124                                                           + directory_add_tide
     2123                     quantity_value[quantity] = num.array(quantity_value[quantity],
     2124                                                          num.float) + directory_add_tide
    21252125
    21262126                #condition to find max and mins for all the plots
     
    23702370        file.close()
    23712371
    2372 
    23732372##
    23742373# @brief ??
     
    23892388   
    23902389    Inputs:
    2391        
    23922390        NOTE: if using csv2timeseries_graphs after creating csv file,
    23932391        it is essential to export quantities 'depth' and 'elevation'.
     
    24142412           myfile_2_point1.csv if <out_name> ='myfile_2_'
    24152413           
    2416            
    24172414        They will all have a header
    24182415   
     
    24382435    import string
    24392436    from anuga.shallow_water.data_manager import get_all_swwfiles
    2440 
    2441 #    quantities =  ['stage', 'elevation', 'xmomentum', 'ymomentum']
    2442     #print "points",points
    24432437
    24442438    assert type(gauge_file) == type(''), 'Gauge filename must be a string'
     
    24572451    point_name = []
    24582452   
    2459     #read point info from file
     2453    # read point info from file
    24602454    for i,row in enumerate(point_reader):
    2461         #read header and determine the column numbers to read correcty.
     2455        # read header and determine the column numbers to read correctly.
    24622456        if i==0:
    24632457            for j,value in enumerate(row):
     
    24712465       
    24722466    #convert to array for file_function
    2473     points_array = num.array(points,num.Float)
     2467    points_array = num.array(points,num.float)
    24742468       
    24752469    points_array = ensure_absolute(points_array)
     
    25252519    for sww_file in sww_files:
    25262520        sww_file = join(dir_name, sww_file+'.sww')
    2527         #print 'sww file = ',sww_file
    25282521        callable_sww = file_function(sww_file,
    25292522                                     quantities=core_quantities,
     
    25792572                                    momentum = sqrt(point_quantities[2]**2
    25802573                                                    + point_quantities[3]**2)
    2581         #                            vel = momentum/depth             
    25822574                                    vel = momentum / (point_quantities[0]
    25832575                                                      - point_quantities[1])
    2584         #                            vel = momentum/(depth + 1.e-6/depth)
    25852576                                else:
    25862577                                    momentum = 0
     
    25932584                                                            point_quantities[3]))
    25942585
    2595                 #print 'point list before write (writer %s) = %s' % (str(point_name[point_i]), str(points_list))
    25962586                points_writer[point_i].writerow(points_list)
    2597            
    25982587
    25992588##
Note: See TracChangeset for help on using the changeset viewer.