Changeset 3177
- Timestamp:
- Jun 19, 2006, 10:30:57 AM (18 years ago)
- Location:
- inundation
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/geospatial_data/geospatial_data.py
r3154 r3177 175 175 # represent the new geo-ref 176 176 if self.geo_reference is not None: 177 #print "self.geo_reference",self.geo_reference178 #print "geo_reference",geo_reference179 177 #FIXME: Maybe put out a warning here... 180 178 self.data_points = self.get_data_points \ 181 179 (geo_reference=geo_reference) 182 #self.data_points = geo_reference.change_points_geo_ref \183 # (self.data_points,184 # self.geo_reference)185 180 186 181 self.geo_reference = geo_reference … … 205 200 returned coordinates are relative to the internal georeference's 206 201 xll and yll corners. 202 203 If a geo_reference is passed the points are returned relative 204 to that geo_reference. 207 205 208 206 Default: absolute is True. -
inundation/geospatial_data/test_geospatial_data.py
r3154 r3177 921 921 ''' 922 922 923 #FIXME (Ole): I changed the georeference arbitrarily, but the test still passes.924 925 923 # create files 926 924 att_dict1 = {} … … 934 932 att_dict2['elevation'] = array([1.0, 15.0, 1.4]) 935 933 att_dict2['brightness'] = array([14.0, 1.0, -12.4]) 936 geo_reference2 = Geo_reference(56, 1.0, 2.0) #FIXME (Ole): I changed this, why does it still pass 937 #OK - it fails now, after the fix revealed by test_create_from_pts_file_with_geo') 934 geo_reference2 = Geo_reference(56, 1.0, 2.0) 938 935 939 936 G1 = Geospatial_data(pointlist1, att_dict1, geo_reference1) -
inundation/pmesh/mesh.py
r3100 r3177 13 13 Geoscience Australia 14 14 """ 15 import load_mesh.loadASCII16 import alpha_shape.alpha_shape17 15 18 16 import sys … … 29 27 from coordinate_transforms.geo_reference import Geo_reference,DEFAULT_ZONE 30 28 from utilities.polygon import point_in_polygon 29 import load_mesh.loadASCII 30 import alpha_shape.alpha_shape 31 from geospatial_data.geospatial_data import Geospatial_data, ensure_geospatial 31 32 32 33 SET_COLOUR='red' … … 609 610 610 611 611 612 def add_vertices(self, data): 613 data = ensure_geospatial(data) 614 615 # get points relative to the mesh geo_ref 616 points = data.get_data_points(geo_reference=self.geo_reference) 617 #FIXME finish.... 618 619 for point in points: 620 v=Vertex(point[0], point[1]) 621 self.userVertices.append(v) 622 612 623 def add_hole_from_polygon(self, polygon, tags=None, geo_reference=None): 613 624 """ … … 853 864 854 865 def getUserVertices(self): 866 """ 867 Note: The x,y values will be relative to the mesh geo_reference 868 This returns a list of vertex objects 869 """ 855 870 return self.userVertices 871 872 def get_user_vertices(self, absolute=True): 873 """ 874 This returns a list of (x,y) values 875 (maybe it should return a geospatical object? 876 It makes it a bit confusing though.) 877 """ 878 pointlist=[] 879 for vertex in self.userVertices: 880 pointlist.append([vertex.x,vertex.y]) 881 spat = Geospatial_data(pointlist, geo_reference=self.geo_reference) 882 return spat.get_data_points(absolute=absolute) 856 883 857 884 def getUserSegments(self): -
inundation/pmesh/test_mesh.py
r3100 r3177 11 11 from load_mesh.loadASCII import * 12 12 from coordinate_transforms.geo_reference import Geo_reference 13 from geospatial_data.geospatial_data import Geospatial_data 13 14 from utilities.polygon import is_inside_polygon ### inside_polygon 14 15 … … 2052 2053 self.failUnless(4==len(vert), 2053 2054 'FAILED!') 2055 2056 def test_add_vertices(self): 2057 points_ab = [[0.1,1],[0.4,.2],[7,5],[10,5]] 2058 geo = Geo_reference(56,23,21) 2059 points = geo.change_points_geo_ref(points_ab) 2060 spat = Geospatial_data(points, geo_reference=geo) 2061 2062 geo_mesh = Geo_reference(56,100,200) 2063 m = Mesh(geo_reference=geo_mesh) 2064 m.add_vertices(spat) 2065 2066 vert = m.getUserVertices() 2067 #print "vert",vert 2068 self.failUnless(4==len(vert), 2069 'FAILED!') 2070 vert= m.get_user_vertices(absolute=True) 2071 self.failUnless(vert==points_ab, 2072 'FAILED!') 2073 2074 2075 def test_get_user_vertices(self): 2076 points_ab = [[0.1,1],[0.4,.2],[7,5],[10,5]] 2077 geo = Geo_reference(56,23,21) 2078 points = geo.change_points_geo_ref(points_ab) 2079 spat = Geospatial_data(points, geo_reference=geo) 2080 2081 geo_mesh = Geo_reference(56,100,200) 2082 m = Mesh(geo_reference=geo_mesh) 2083 m.add_vertices(spat) 2084 2085 vert = m.getUserVertices() 2086 #print "vert",vert 2087 self.failUnless(4==len(vert), 2088 'FAILED!') 2089 vert= m.get_user_vertices(absolute=True) 2090 self.failUnless(vert==points_ab, 2091 'FAILED!') 2092 vert= m.get_user_vertices(absolute=False) 2093 points_new = m.geo_reference.get_absolute(vert) 2094 2095 self.failUnless(points_ab==points_new, 2096 'FAILED!') 2097 2054 2098 2055 2099 def list_comp(A,B):
Note: See TracChangeset
for help on using the changeset viewer.