- Timestamp:
- Sep 4, 2008, 2:45:27 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/abstract_2d_finite_volumes/quantity.py
r5522 r5729 753 753 verbose=False, 754 754 use_cache=False): 755 # FIXME: Use this function for the time being. Later move code in here 755 """ Set values based on geo referenced geospatial data object. 756 """ 756 757 757 758 points = geospatial_data.get_data_points(absolute=False) 758 759 values = geospatial_data.get_attributes() 759 760 data_georef = geospatial_data.get_geo_reference() 760 761 761 762 762 … … 1007 1007 1008 1008 def get_interpolated_values(self, interpolation_points): 1009 1010 # Interpolation object based on internal (discontinuous triangles) 1009 """ Get values at interpolation points 1010 1011 If interpolation points have been given previously, the 1012 associated matrices will be reused to save time. 1013 1014 The argument interpolation points must be given as either a list of absolute UTM coordinates or 1015 a geospatial data object. 1016 """ 1017 1018 # FIXME (Ole): Could do with an input check (should be generalised and used widely) 1019 # That will check that interpolation points is either a list of points, Nx2 array, or geospatial 1020 1021 # Ensure points are converted to coordinates relative to mesh origin 1022 # FIXME (Ole): This could all be refactored using the 'change_points_geo_ref' method 1023 # of Class geo_reference. The purpose is to make interpolation points relative 1024 # to the mesh origin. 1025 # 1026 # Speed is also a consideration here. 1027 1028 if isinstance(interpolation_points, Geospatial_data): 1029 # Ensure interpolation points are in absolute UTM coordinates 1030 interpolation_points = interpolation_points.get_data_points(absolute=True) 1031 1032 # Reconcile interpolation points with georeference of domain 1033 interpolation_points = self.domain.geo_reference.get_relative(interpolation_points) 1034 interpolation_points = ensure_numeric(interpolation_points) 1035 1036 # Get internal (discontinuous) triangles for use with the interpolation object. 1011 1037 x, y, vertex_values, triangles = self.get_vertex_values(xy=True, 1012 1038 smooth=False) 1013 # FIXME : This concat should roll into get_vertex_values1039 # FIXME (Ole): This concat should roll into get_vertex_values 1014 1040 vertex_coordinates = concatenate((x[:, NewAxis], y[:, NewAxis]), 1015 1041 axis=1) … … 1020 1046 I = self.interpolation_object 1021 1047 1022 if allclose(interpolation_points, I._point_coordinates): 1023 can_reuse = True 1048 if allclose(interpolation_points.shape, 1049 I._point_coordinates.shape): 1050 if allclose(interpolation_points, I._point_coordinates): 1051 can_reuse = True 1024 1052 1025 1053 … … 1047 1075 1048 1076 return X, Compatible list, Numeric array (see below) 1049 interpolation_points: List of x, y coordinates where value is 1050 sought (using interpolation). If points are given, values of 1051 location and indices are ignored 1052 1053 location: Where values are to be stored. 1054 Permissible options are: vertices, edges, centroids 1055 and unique vertices. Default is 'vertices' 1077 1078 Inputs: 1079 interpolation_points: List of x, y coordinates where value is 1080 sought (using interpolation). If points 1081 are given, values of location and indices 1082 are ignored. Assume either absolute UTM 1083 coordinates or geospatial data object. 1084 1085 location: Where values are to be stored. 1086 Permissible options are: vertices, edges, centroids 1087 and unique vertices. Default is 'vertices' 1056 1088 1057 1089 … … 1075 1107 internal ordering. 1076 1108 """ 1109 1077 1110 from Numeric import take 1078 1111 … … 1086 1119 1087 1120 # FIXME (Ole): Consider deprecating 'edges' - but not if it is used 1088 # elsewhere in ANUGA. 1121 # elsewhere in ANUGA. 1122 # Edges have already been deprecated in set_values, see changeset:5521, 1123 # but *might* be useful in get_values. Any thoughts anyone? 1124 1089 1125 if location not in ['vertices', 'centroids', 'edges', 1090 1126 'unique vertices']:
Note: See TracChangeset
for help on using the changeset viewer.