Changeset 1021
- Timestamp:
- Mar 7, 2005, 11:18:15 AM (20 years ago)
- Location:
- inundation/ga/storm_surge/pmesh
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/ga/storm_surge/pmesh
- Property svn:externals
-
old new 1 1 alpha_shape https://datamining.anu.edu.au/svn/projects/ga/storm_surge/alpha_shape 2 coordinate_transforms https://datamining.anu.edu.au/svn/projects/ga/storm_surge/pyvolution/coordinate_transforms
-
- Property svn:externals
-
inundation/ga/storm_surge/pmesh/load_mesh/loadASCII.py
r1010 r1021 1065 1065 1066 1066 from Scientific.IO.NetCDF import NetCDFFile 1067 1068 1067 point_atts2array(point_atts) 1069 1068 # NetCDF file definition … … 1089 1088 outfile.createVariable(key, Float, ('number_of_points',)) 1090 1089 outfile.variables[key][:] = point_atts['attributelist'][key] #.astype(Float32) 1091 1090 1092 1091 if point_atts.has_key('geo_reference') and not point_atts['geo_reference'] == None: 1093 1092 point_atts['geo_reference'].write_NetCDF(outfile) … … 1170 1169 return xya_dict 1171 1170 1172 1171 #FIXME (DSG) need an export_points_file method.. 1173 1172 def export_xya_file( file_name, xya_dict, title, delimiter = ','): 1174 1173 """ -
inundation/ga/storm_surge/pmesh/load_mesh/test_loadASCII.py
r1010 r1021 429 429 att_dict['brightness'] = array([10.0, 0.0, 10.4]) 430 430 dict['attributelist'] = att_dict 431 dict['geo_reference'] = Geo_reference(1.9,1.9,'zone65') 431 dict['geo_reference'] = Geo_reference(1.9,1.9,65) 432 432 433 433 434 fileName = tempfile.mktemp(".pts") 434 435 write_pts(fileName, dict) 435 436 dict2 = load_points_file(fileName) 437 #print "fileName",fileName 436 438 os.remove(fileName) 437 439 #print "dict2",dict2 … … 589 591 590 592 suite = unittest.makeSuite(loadASCIITestCase,'test') 593 #suite = unittest.makeSuite(loadASCIITestCase,'test_writepts') 591 594 runner = unittest.TextTestRunner() #verbosity=2) 592 595 runner.run(suite) -
inundation/ga/storm_surge/pmesh/mesh.py
r1001 r1021 459 459 self.regions) 460 460 461 def __init__(self, userSegments=None, userVertices=None, holes=None, regions=None): 461 def __init__(self, 462 userSegments=None, 463 userVertices=None, 464 holes=None, 465 regions=None, 466 geo_reference=None): 462 467 self.meshTriangles=[] 463 468 self.attributeTitles=[] 464 469 self.meshSegments=[] 465 470 self.meshVertices=[] 471 472 #Peters stuff 473 # FIXME (DSG) Sets of what? 466 474 self.setID={} 467 475 self.setID['None']=0 … … 488 496 else: 489 497 self.regions=regions 498 499 if geo_reference is None: 500 self.geo_reference = None 501 else: 502 self.geo_reference = geo_reference 503 490 504 def __cmp__(self,other): 491 505 … … 1665 1679 """ 1666 1680 #load_mesh.loadASCII 1667 1681 #FIXME, this should be a mesh2io method 1668 1682 if self.meshVertices == []: 1669 1683 Vertices = self.userVertices … … 1689 1703 xya_dict['pointlist'] = points 1690 1704 xya_dict['pointattributelist'] = pointattributes 1705 xya_dict['geo_reference'] = self.geo_reference 1691 1706 1692 1707 load_mesh.loadASCII.export_xya_file(ofile, xya_dict, title, delimiter = " ") … … 1730 1745 for element in dict_mesh.keys(): 1731 1746 dict[element] = dict_mesh[element] 1747 1748 # add the geo reference 1749 dict['geo_reference'] = self.geo_reference 1732 1750 return dict 1733 1751 … … 2220 2238 2221 2239 def importMeshFromFile(ofile): 2222 """returns a mesh object, made from a .xya or .txh file2240 """returns a mesh object, made from a .xya/.pts or .tsh/.msh file 2223 2241 Often raises SyntaxError, IOError 2224 2242 """ … … 2245 2263 #print "loading " + ofile 2246 2264 dict = load_mesh.loadASCII.load_points_file(ofile) 2247 #print "dict",dict 2248 dict['segmentlist'] = [] 2249 dict['segmenttaglist'] = [] 2250 dict['regionlist'] = [] 2251 dict['regionattributelist'] = [] 2252 dict['regionmaxarealist'] = [] 2253 dict['holelist'] = [] 2254 newmesh= Mesh() 2255 newmesh.setMesh(dict) #FIXME use IOOutline2Mesh 2265 #print "dict",dict 2266 dict['points'] = dict['pointlist'] 2267 dict['outline_segments'] = [] 2268 dict['outline_segment_tags'] = [] 2269 dict['regions'] = [] 2270 dict['region_tags'] = [] 2271 dict['region_max_areas'] = [] 2272 dict['holes'] = [] 2273 newmesh= Mesh(geo_reference = dict['geo_reference']) 2274 newmesh.IOOutline2Mesh(dict) #FIXME use IOOutline2Mesh 2256 2275 counter = newmesh.removeDuplicatedUserVertices() 2257 2276 if (counter >0): -
inundation/ga/storm_surge/pmesh/pmesh.py
r1001 r1021 138 138 self.menuBar.addmenuitem('File', 'command', 'Normalise mesh for glutobj', 139 139 label='Normalise mesh for glutobj', command=self.normalise4ObjMesh) 140 self.menuBar.addmenuitem('File', 'separator') 141 self.menuBar.addmenuitem('File', 'command', '', 142 label='Print geo reference', command=self.printGeoReference) 140 143 self.menuBar.addmenuitem('File', 'separator') 141 144 self.menuBar.addmenuitem('File', 'command', 'Exit program', … … 989 992 seg = self.Segments.draw(v1,v2,self.mesh,self.uniqueID,self.SCALE,self.canvas,None) 990 993 return seg 991 994 def printGeoReference(self): 995 try: 996 print "geo reference", self.mesh.geo_reference 997 except: 998 print "no geo reference" 999 992 1000 def visualiseMesh(self,mesh): 993 1001 """
Note: See TracChangeset
for help on using the changeset viewer.