Changeset 393
- Timestamp:
- Oct 12, 2004, 4:46:17 PM (20 years ago)
- Location:
- inundation/ga/storm_surge/pyvolution
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pyvolution/least_squares.py
r389 r393 58 58 vertex_coordinates = mesh_dict['generatedpointlist'] 59 59 triangles = mesh_dict['generatedtrianglelist'] 60 60 61 old_point_attributes = mesh_dict['generatedpointattributelist'] 62 old_title_list = mesh_dict['generatedpointattributetitlelist'] 63 64 61 65 # load in the .xya file 62 66 point_dict = load_xya_file(point_file) … … 64 68 point_attributes = point_dict['pointattributelist'] 65 69 title_string = point_dict['title'] 66 title_list = title_string.split(',') #iffy! Hard coding title delimiter 67 #print "title_list", title_list 70 title_list = title_string.split(',') #iffy! Hard coding title delimiter 68 71 for i in range(len(title_list)): 69 72 title_list[i] = title_list[i].strip() … … 74 77 point_attributes, 75 78 alpha = alpha) 79 76 80 # convert array to list of lists 77 mesh_dict['generatedpointattributelist'] = f.tolist() 78 mesh_dict['generatedpointattributetitlelist'] = title_list 81 new_point_attributes = f.tolist() 82 83 #FIXME have this overwrite attributes with the same title - DSG 84 #Put the newer attributes last 85 if old_title_list <> []: 86 old_title_list.extend(title_list) 87 #FIXME can this be done a faster way? - DSG 88 for i in range(len(old_point_attributes)): 89 old_point_attributes[i].extend(new_point_attributes[i]) 90 91 mesh_dict['generatedpointattributelist'] = old_point_attributes 92 mesh_dict['generatedpointattributetitlelist'] = old_title_list 93 79 94 export_trianglulation_file(mesh_output_file, mesh_dict) 80 95 -
inundation/ga/storm_surge/pyvolution/test_least_squares.py
r374 r393 567 567 mesh_dic['generatedsegmentlist'] = [[0, 1], [2, 0], [1, 2]] 568 568 mesh_dic['generatedtriangleattributelist'] = [['']] 569 mesh_dic['generatedpointattributelist'] = [[], [], []] 569 mesh_dic['generatedpointattributelist'] = [[1,2], [1,2], [1,2]] 570 mesh_dic['generatedpointattributetitlelist'] = ['density', 'temp'] 570 571 mesh_dic['generatedtriangleneighborlist'] = [[-1, -1, -1]] 571 572 mesh_dic['generatedsegmentmarkerlist'] = ['external', … … 578 579 point_file = tempfile.mktemp(".xya") 579 580 fd = open(point_file,'w') 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")581 fd.write("elevation, stage \n 1.0, 1.0,2.,4 \n 1.0, 3.0,4,8 \n 3.0,1.0,4.,8 \n") 581 582 fd.close() 582 583 … … 590 591 591 592 assert allclose(mesh_dic['generatedpointattributelist'], 592 [[0.0, 0.0], [5.0, 10.0], [5.0,10.0]]) 593 [[1.0, 2.0,0.0, 0.0], 594 [1.0, 2.0,5.0, 10.0], 595 [1.0, 2.0,5.0,10.0]]) 593 596 594 597 self.failUnless(mesh_dic['generatedpointattributetitlelist'] == 595 [' bed_elevation','stage'],598 ['density', 'temp','elevation','stage'], 596 599 'test_fit_to_mesh_file failed') 597 600
Note: See TracChangeset
for help on using the changeset viewer.