Changeset 4452
- Timestamp:
- May 16, 2007, 2:53:14 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
anuga_core/source/anuga/geospatial_data/geospatial_data.py
r4349 r4452 11 11 size, shape 12 12 from random import randint 13 from copy import deepcopy 14 13 15 #from MA import tolist 14 16 … … 17 19 from anuga.utilities.numerical_tools import ensure_numeric 18 20 from anuga.coordinate_transforms.geo_reference import Geo_reference, \ 19 TitleError, DEFAULT_ZONE 21 TitleError, DEFAULT_ZONE, ensure_geo_reference, write_NetCDF_georeference 20 22 from anuga.coordinate_transforms.redfearn import convert_from_latlon_to_utm 21 23 from anuga.utilities.anuga_exceptions import ANUGAError … … 220 222 221 223 def set_geo_reference(self, geo_reference): 222 224 """ 225 Set's the georeference of geospatial. 226 It can also be used to change the georeference 227 """ 223 228 from anuga.coordinate_transforms.geo_reference import Geo_reference 224 229 225 230 if geo_reference is None: 226 231 geo_reference = Geo_reference() # Use default 232 geo_reference = ensure_geo_reference(geo_reference) 227 233 if not isinstance(geo_reference, Geo_reference): 228 234 msg = 'Argument geo_reference must be a valid Geo_reference \n' … … 564 570 The point_dict is defined at the top of this file. 565 571 566 If absolute is True data points at returned added to the xll and yll567 and geo_reference as None572 If absolute is True data the xll and yll are added to the points value 573 and the xll and yll of the geo_reference are set to 0. 568 574 569 575 If absolute is False data points at returned as relative to the xll … … 579 585 msg = '.xya format is deprecated. Please use .txt.' 580 586 warn(msg, DeprecationWarning) 581 if absolute is True: 587 if absolute is True: 588 geo_ref = deepcopy(self.geo_reference) 589 geo_ref.xllcorner = 0 590 geo_ref.yllcorner = 0 582 591 _write_xya_file(file_name, 583 592 self.get_data_points(absolute=True), 584 self.get_all_attributes()) 593 self.get_all_attributes(), 594 geo_ref) 585 595 else: 586 596 _write_xya_file(file_name, … … 591 601 elif (file_name[-4:] == ".pts"): 592 602 if absolute is True: 603 geo_ref = deepcopy(self.geo_reference) 604 geo_ref.xllcorner = 0 605 geo_ref.yllcorner = 0 593 606 _write_pts_file(file_name, 594 607 self.get_data_points(absolute), 595 self.get_all_attributes()) 608 self.get_all_attributes(), 609 geo_ref) 596 610 else: 597 611 _write_pts_file(file_name, … … 1151 1165 1152 1166 if write_geo_reference is not None: 1153 write_ geo_reference.write_NetCDF(outfile)1167 write_NetCDF_georeference(write_geo_reference, outfile) 1154 1168 1155 1169 outfile.close() … … 1194 1208 1195 1209 if write_geo_reference is not None: 1210 write_geo_reference = ensure_geo_reference(write_geo_reference) 1196 1211 write_geo_reference.write_ASCII(fd) 1197 1212 fd.close()
Note: See TracChangeset
for help on using the changeset viewer.