Changeset 6318 for anuga_core


Ignore:
Timestamp:
Feb 12, 2009, 1:40:21 PM (16 years ago)
Author:
kristy
Message:

Updated test_util.py so that it understands that hours is a new column in the created csv file.
In util.py I took out the print statements.

Location:
anuga_core/source/anuga/abstract_2d_finite_volumes
Files:
2 edited

Legend:

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

    r6175 r6318  
    15771577
    15781578#        point1_answers_array = [[0.0,1.0,-5.0,3.0,4.0], [2.0,10.0,-5.0,3.0,4.0]]
    1579         point1_answers_array = [[0.0,1.0,6.0,-5.0,3.0,4.0], [2.0,10.0,15.0,-5.0,3.0,4.0]]
     1579        point1_answers_array = [[0.0,0.0,1.0,6.0,-5.0,3.0,4.0], [2.0,2.0/3600.,10.0,15.0,-5.0,3.0,4.0]]
    15801580        point1_filename = 'gauge_point1.csv'
    15811581        point1_handle = file(point1_filename)
     
    15851585        line=[]
    15861586        for i,row in enumerate(point1_reader):
    1587             #print 'i',i,'row',row
    1588             line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),float(row[4]),float(row[5])])
    1589             #print 'assert line',line[i],'point1',point1_answers_array[i]
     1587#            print 'i',i,'row',row
     1588            line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),
     1589                         float(row[4]),float(row[5]),float(row[6])])
     1590#            print 'assert line',line[i],'point1',point1_answers_array[i]
    15901591            assert num.allclose(line[i], point1_answers_array[i])
    15911592
    1592         point2_answers_array = [[0.0,1.0,1.5,-0.5,3.0,4.0], [2.0,10.0,10.5,-0.5,3.0,4.0]]
     1593        point2_answers_array = [[0.0,0.0,1.0,1.5,-0.5,3.0,4.0], [2.0,2.0/3600.,10.0,10.5,-0.5,3.0,4.0]]
    15931594        point2_filename = 'gauge_point2.csv'
    15941595        point2_handle = file(point2_filename)
     
    15981599        line=[]
    15991600        for i,row in enumerate(point2_reader):
    1600             #print 'i',i,'row',row
    1601             line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),float(row[4]),float(row[5])])
    1602             #print 'assert line',line[i],'point1',point1_answers_array[i]
     1601#            print 'i',i,'row',row
     1602            line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),
     1603                         float(row[4]),float(row[5]),float(row[6])])
     1604#            print 'assert line',line[i],'point1',point1_answers_array[i]
    16031605            assert num.allclose(line[i], point2_answers_array[i])
    16041606                         
     
    17051707        for i,row in enumerate(point1_reader):
    17061708#            print 'i',i,'row',row
    1707             line.append([float(row[0]),float(row[1]),float(row[2])])
     1709            # note the 'hole' (element 1) below - skip the new 'hours' field
     1710            line.append([float(row[0]),float(row[2]),float(row[3])])
    17081711            #print 'line',line[i],'point1',point1_answers_array[i]
    17091712            assert num.allclose(line[i], point1_answers_array[i])
     
    17181721        for i,row in enumerate(point2_reader):
    17191722#            print 'i',i,'row',row
    1720             line.append([float(row[0]),float(row[1]),float(row[2])])
     1723            # note the 'hole' (element 1) below - skip the new 'hours' field
     1724            line.append([float(row[0]),float(row[2]),float(row[3])])
    17211725#            print 'line',line[i],'point1',point1_answers_array[i]
    17221726            assert num.allclose(line[i], point2_answers_array[i])
     
    18151819
    18161820#        point1_answers_array = [[0.0,1.0,-5.0,3.0,4.0], [2.0,10.0,-5.0,3.0,4.0]]
    1817         point1_answers_array = [[5.0,1.0,6.0,-5.0,3.0,4.0], [7.0,10.0,15.0,-5.0,3.0,4.0]]
     1821        point1_answers_array = [[5.0,5.0/3600.,1.0,6.0,-5.0,3.0,4.0], [7.0,7.0/3600.,10.0,15.0,-5.0,3.0,4.0]]
    18181822        point1_filename = 'gauge_point1.csv'
    18191823        point1_handle = file(point1_filename)
     
    18241828        for i,row in enumerate(point1_reader):
    18251829            #print 'i',i,'row',row
    1826             line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),float(row[4]),float(row[5])])
     1830            line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),
     1831                         float(row[4]), float(row[5]), float(row[6])])
    18271832            #print 'assert line',line[i],'point1',point1_answers_array[i]
    18281833            assert num.allclose(line[i], point1_answers_array[i])
    18291834
    1830         point2_answers_array = [[5.0,1.0,1.5,-0.5,3.0,4.0], [7.0,10.0,10.5,-0.5,3.0,4.0]]
     1835        point2_answers_array = [[5.0,5.0/3600.,1.0,1.5,-0.5,3.0,4.0], [7.0,7.0/3600.,10.0,10.5,-0.5,3.0,4.0]]
    18311836        point2_filename = 'gauge_point2.csv'
    18321837        point2_handle = file(point2_filename)
     
    18371842        for i,row in enumerate(point2_reader):
    18381843            #print 'i',i,'row',row
    1839             line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),float(row[4]),float(row[5])])
     1844            line.append([float(row[0]),float(row[1]),float(row[2]),float(row[3]),
     1845                         float(row[4]),float(row[5]), float(row[6])])
    18401846            #print 'assert line',line[i],'point1',point1_answers_array[i]
    18411847            assert num.allclose(line[i], point2_answers_array[i])
  • anuga_core/source/anuga/abstract_2d_finite_volumes/util.py

    r6314 r6318  
    25262526    for sww_file in sww_files:
    25272527        sww_file = join(dir_name, sww_file+'.sww')
    2528         print 'sww file = ',sww_file
     2528        #print 'sww file = ',sww_file
    25292529        callable_sww = file_function(sww_file,
    25302530                                     quantities=core_quantities,
     
    25392539            print 'time = ', str(time)
    25402540            for point_i, point in enumerate(points_array):
    2541                 print 'gauge_file = ', str(point_name[point_i])
    2542                 print 'point_i = ', str(point_i), ' point is = ', str(point)
     2541               # print 'gauge_file = ', str(point_name[point_i])
     2542                #print 'point_i = ', str(point_i), ' point is = ', str(point)
    25432543                #add domain starttime to relative time.
    25442544                quake_time = time + quake_offset_time
    25452545                points_list = [quake_time, quake_time/3600.]# fudge around SWW time bug
    2546                 print 'point list = ', str(points_list)
     2546                #print 'point list = ', str(points_list)
    25472547                point_quantities = callable_sww(time,point_i)
    2548                 print 'point quantities = ', str(point_quantities)
     2548                #print 'point quantities = ', str(point_quantities)
    25492549               
    25502550                for quantity in quantities:
Note: See TracChangeset for help on using the changeset viewer.