Changeset 4641 for anuga_core/source


Ignore:
Timestamp:
Jul 26, 2007, 9:09:55 AM (18 years ago)
Author:
nick
Message:

updated geospatial_data.export_data_points_file so it will write data "as_lat_long" in the northern hemisphere to csv and txt files.

Plus change parameter name to be more logical

and corrected a verbose=True in test_geospatial_data.py, Dunc and i didn't know why it was there...

Location:
anuga_core/source/anuga/geospatial_data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • anuga_core/source/anuga/geospatial_data/geospatial_data.py

    r4640 r4641  
    360360       
    361361    def get_data_points(self, absolute=True, geo_reference=None,
    362                         as_lat_long=False,isSH=True):
     362                        as_lat_long=False,isSouthHemisphere=True):
    363363        """Get coordinates for all data points as an Nx2 array
    364364
     
    385385                ### UTMtoLL(northing, easting, zone,
    386386                lat_calced, long_calced = UTMtoLL(point[1],point[0],
    387                                                   zone, isSH)
     387                                                  zone, isSouthHemisphere)
    388388                lats_longs.append((lat_calced, long_calced)) # to hash
    389389            return lats_longs
     
    594594#        return all_data
    595595   
    596     def export_points_file(self, file_name, absolute=True, as_lat_long=False):
     596    def export_points_file(self, file_name, absolute=True,
     597                           as_lat_long=False, isSouthHemisphere=True):
    597598       
    598599        """
     
    606607        If absolute is False data points at returned as relative to the xll
    607608        and yll and geo_reference remains uneffected
     609       
     610        isSouthHemisphere: is only used when getting data
     611        points "as_lat_long" is True and if FALSE will return lats and
     612        longs valid for the Northern Hemisphere.
     613       
    608614        """
    609615
     
    650656            _write_csv_file(file_name,
    651657                            self.get_data_points(absolute=True,
    652                                                  as_lat_long=as_lat_long),
     658                                                 as_lat_long=as_lat_long,
     659                                  isSouthHemisphere=isSouthHemisphere),
    653660                            self.get_all_attributes(),
    654661                            as_lat_long=as_lat_long)
     
    658665            assert absolute, msg
    659666            _write_urs_file(file_name,
    660                             self.get_data_points(as_lat_long=True))
     667                            self.get_data_points(as_lat_long=True,
     668                                  isSouthHemisphere=isSouthHemisphere))
    661669                                                         
    662670        else:
  • anuga_core/source/anuga/geospatial_data/test_geospatial_data.py

    r4640 r4641  
    219219       
    220220        geo_reference = Geo_reference(zone=zone)
    221         geo = Geospatial_data(boundary_polygon,geo_reference=geo_reference)
    222         seg_lat_long = geo.get_data_points(as_lat_long=True,isSH=False)
     221        geo = Geospatial_data(boundary_polygon,
     222                              geo_reference=geo_reference)
     223                             
     224        seg_lat_long = geo.get_data_points(as_lat_long=True,
     225                                           isSouthHemisphere=False)
     226                                           
    223227        lat_result = degminsec2decimal_degrees(8.31,0,0)
    224228        long_result = degminsec2decimal_degrees(98.273,0,0)
     
    10641068#            dict = import_points_file(fileName,delimiter=' ')
    10651069#            results = Geospatial_data()
    1066             results = Geospatial_data(fileName, delimiter=' ', verbose=True)
     1070            results = Geospatial_data(fileName, delimiter=' ', verbose=False)
    10671071#            results.import_points_file(fileName, delimiter=' ')
    10681072        except IOError:
     
    23682372    #suite = unittest.makeSuite(Test_Geospatial_data, 'test_get_data_points_lat_longIII')
    23692373    suite = unittest.makeSuite(Test_Geospatial_data, 'test')
    2370     runner = unittest.TextTestRunner()
     2374    runner = unittest.TextTestRunner() #verbosity=2)
    23712375    runner.run(suite)
    23722376
Note: See TracChangeset for help on using the changeset viewer.