Changeset 374 for inundation


Ignore:
Timestamp:
Oct 7, 2004, 2:50:59 PM (20 years ago)
Author:
duncan
Message:

minor changes - vert att titles

Location:
inundation/ga/storm_surge/pyvolution
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • inundation/ga/storm_surge/pyvolution/interpolate_sww.py

    r361 r374  
    152152            for i in range(len(self.time)):
    153153                if i == 0:
    154                     title = "x,y," + str(self.time[0])
     154                    title = str(self.time[0])
    155155                else:
    156156                    title = title + delimiter + str(self.time[i])
  • inundation/ga/storm_surge/pyvolution/least_squares.py

    r362 r374  
    5555                 load_xya_file, export_trianglulation_file
    5656    # load in the .tsh file
    57     mesh_dic = mesh_file_to_mesh_dictionary(mesh_file)
    58     vertex_coordinates = mesh_dic['generatedpointlist']
    59     triangles = mesh_dic['generatedtrianglelist']
     57    mesh_dict = mesh_file_to_mesh_dictionary(mesh_file)
     58    vertex_coordinates = mesh_dict['generatedpointlist']
     59    triangles = mesh_dict['generatedtrianglelist']
    6060       
    6161    # load in the .xya file
     
    6464    point_attributes = point_dict['pointattributelist']
    6565    point_attributes = point_dict['pointattributelist']
    66        
    67        
     66    title_string = point_dict['title']
     67    title_list = title_string.split(',') #iffy! Hard coding title delimiter
     68    #print "title_list", title_list   
     69    for i in range(len(title_list)):
     70        title_list[i] = title_list[i].strip()
     71    #print "title_list stripped", title_list   
    6872    f = fit_to_mesh(vertex_coordinates,
    6973                    triangles,
     
    7276                    alpha = alpha)
    7377    # convert array to list of lists
    74     mesh_dic['generatedpointattributelist'] = f.tolist()
    75     export_trianglulation_file(mesh_output_file, mesh_dic)
     78    mesh_dict['generatedpointattributelist'] = f.tolist()
     79    mesh_dict['generatedpointattributetitlelist'] = title_list
     80    export_trianglulation_file(mesh_output_file, mesh_dict)
    7681       
    7782
  • inundation/ga/storm_surge/pyvolution/pmesh2domain.py

    r372 r374  
    1 """Class mesh2domain - 2D triangular domains for finite-volume computations of
    2    the shallow water wave equation
     1"""Class pmesh2domain - Converting .tsh files to doamains
    32
    43
  • inundation/ga/storm_surge/pyvolution/test_interpolate_sww.py

    r359 r374  
    198198        time_list = []
    199199
    200         answer = string_list.pop(0)
    201         self.failUnless( answer == 'x', 'Title is wrong!')
    202         self.failUnless( string_list.pop(0) == 'y', 'Title is wrong!')
     200        # this is if titles start with x,y
     201        #answer = string_list.pop(0)
     202        #self.failUnless( answer == 'x', 'Title is wrong!')
     203        #self.failUnless( string_list.pop(0) == 'y', 'Title is wrong!')
    203204       
    204205        for time in string_list:
  • inundation/ga/storm_surge/pyvolution/test_least_squares.py

    r353 r374  
    578578        point_file = tempfile.mktemp(".xya")
    579579        fd = open(point_file,'w')
    580         fd.write("# demo \n 1.0, 1.0,2.,4 \n 1.0, 3.0,4,8 \n 3.0,1.0,4.,8 \n")
     580        fd.write("bed_elevation, stage \n 1.0, 1.0,2.,4 \n 1.0, 3.0,4,8 \n 3.0,1.0,4.,8 \n")
    581581        fd.close()
    582582       
     
    592592                        [[0.0, 0.0], [5.0, 10.0], [5.0,10.0]])
    593593       
     594        self.failUnless(mesh_dic['generatedpointattributetitlelist']  ==
     595                        ['bed_elevation','stage'],
     596                        'test_fit_to_mesh_file failed')
     597       
    594598        #clean up
    595599        os.remove(mesh_file)
Note: See TracChangeset for help on using the changeset viewer.