Changeset 3262
- Timestamp:
- Jun 30, 2006, 3:19:05 PM (18 years ago)
- Location:
- inundation
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
inundation/geospatial_data/geospatial_data.py
r3177 r3262 697 697 relative to their respective origins. 698 698 """ 699 if isinstance(points,type('')): 700 #It's a string 701 #assume it is a point file 702 points = Geospatial_data(file_name = points) 703 699 704 if isinstance(points,Geospatial_data): 700 705 points = points.get_data_points( \ … … 733 738 """ 734 739 if isinstance(points,Geospatial_data): 735 #points = points.get_data_points( \736 # absolute = True)737 740 msg = "Use a Geospatial_data object or a mesh origin. Not both." 738 741 assert geo_reference == None, msg … … 741 744 points = ensure_numeric(points, Float) 742 745 if geo_reference is None: 743 geo = None #Geo_reference()746 geo = None 744 747 else: 745 748 if isinstance(geo_reference, Geo_reference): … … 749 752 geo_reference[1], 750 753 geo_reference[2]) 751 points = Geospatial_data(data_points=points, geo_reference=geo) 752 #points = geo.get_absolute(points) 754 points = Geospatial_data(data_points=points, geo_reference=geo) 753 755 return points 754 756 -
inundation/geospatial_data/test_geospatial_data.py
r3177 r3262 1031 1031 assert allclose(new_points, ab_points) 1032 1032 1033 1034 fileName = tempfile.mktemp(".xya") 1035 file = open(fileName,"w") 1036 file.write(" elevation speed \n\ 1037 1.0 0.0 10.0 0.0\n\ 1038 0.0 1.0 0.0 10.0\n\ 1039 1.0 0.0 10.4 40.0\n\ 1040 #geocrap\n\ 1041 56\n\ 1042 10\n\ 1043 20\n") 1044 file.close() 1045 1046 ab_points = ensure_absolute(fileName) 1047 actual = [[11, 20.0],[10.0, 21.0],[11.0, 20.0]] 1048 assert allclose(ab_points, actual) 1049 os.remove(fileName) 1050 1033 1051 1034 1052 def test_ensure_geospatial(self): -
inundation/pyvolution/util.py
r3221 r3262 5 5 """ 6 6 7 8 7 import utilities.polygon 9 8 from warnings import warn 9 10 from geospatial_data.geospatial_data import ensure_absolute 10 11 11 12 … … 46 47 a tuple of values - one for each quantity 47 48 48 interpolation_points - list of absolute UTM coordinates for points (N x 2) at49 which values are sought49 interpolation_points - list of absolute UTM coordinates for points (N x 2) 50 or geospatial object or points file name at which values are sought 50 51 51 52 use_cache: True means that caching of intermediate result of … … 103 104 #In fact, this is where origin should be converted to that of domain 104 105 #Also, check that file covers domain fully. 105 #If we use the suggested Point_set class for interpolation points106 #here it would be easier107 106 108 107 #Take into account: … … 173 172 from Scientific.IO.NetCDF import NetCDFFile 174 173 from Numeric import array, zeros, Float, alltrue, concatenate, reshape 175 from utilities.numerical_tools import ensure_numeric176 174 177 175 #Open NetCDF file … … 197 195 198 196 if interpolation_points is not None: 199 interpolation_points = ensure_ numeric(interpolation_points, Float)197 interpolation_points = ensure_absolute(interpolation_points) 200 198 msg = 'Points must by N x 2. I got %d' %interpolation_points.shape[1] 201 199 assert interpolation_points.shape[1] == 2, msg … … 569 567 570 568 gauge_filename - name of file containing gauge data 571 - name, easting, northing569 - easting, northing, name , elevation? 572 570 - OR (this is not yet done) 573 571 - structure which can be converted to a Numeric array, … … 669 667 report = False 670 668 671 assert type(plot_quantity) == list,\672 'plot_quantity must be a list'673 669 674 670 if plot_quantity is None: 675 671 plot_quantity = ['depth', 'speed', 'bearing'] 676 672 else: 673 assert type(plot_quantity) == list,\ 674 'plot_quantity must be a list' 677 675 check_list(plot_quantity) 678 676 … … 741 739 time_min, time_max, title_on, label_id, verbose) 742 740 743 741 #Fixme - Use geospatial to read this file - it's an xya file 744 742 def get_gauges_from_file(filename): 745 743 from os import sep, getcwd, access, F_OK, mkdir
Note: See TracChangeset
for help on using the changeset viewer.