Changeset 4104


Ignore:
Timestamp:
Dec 20, 2006, 2:08:58 PM (17 years ago)
Author:
ole
Message:

Merciless enforcement of style guide

File:
1 edited

Legend:

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

    r4103 r4104  
    7070            2.7, 2.4, 5.2, 0.3
    7171
    72         The first two columns are always implicitly assumed to be x, y coordinates.
     72        The first two columns are always implicitly assumed to be x, y
     73        coordinates.
    7374        Use the same delimiter for the attribute names and the data
    7475
     
    8990        The format for a Points dictionary is:
    9091
    91           ['pointlist'] a 2 column array describing points. 1st column x, 2nd column y.
    92           ['attributelist'], a dictionary of 1D arrays, representing attribute values
    93           at the point.  The dictionary key is the attribute header.
    94           ['geo_reference'] a Geo_refernece object. Use if the point information
    95             is relative. This is optional.
     92          ['pointlist'] a 2 column array describing points. 1st column x,
     93          2nd column y.
     94          ['attributelist'], a dictionary of 1D arrays, representing
     95          attribute values at the point.  The dictionary key is the attribute
     96          header.
     97          ['geo_reference'] a Geo_refernece object. Use if the point
     98          information is relative. This is optional.
    9699            eg
    97100            dic['pointlist'] = [[1.0,2.0],[3.0,5.0]]
     
    132135
    133136        else:
    134             # watch for case where file name and points, attributes etc are provided!!
     137            # watch for case where file name and points,
     138            # attributes etc are provided!!
    135139            # if file name then all provided info will be removed!
    136140            self.import_points_file(file_name, delimiter, verbose)
     
    500504                    try:
    501505                        fd = open(file_name)
    502                         data_points, attributes, geo_reference = _read_xya_file(fd, ',')
     506                        data_points, attributes, geo_reference =\
     507                                     _read_xya_file(fd, ',')
    503508                    except TitleError:
    504509                        fd.close()
    505510                        fd = open(file_name)
    506                         data_points, attributes, geo_reference = _read_xya_file(fd, ' ')
     511                        data_points, attributes, geo_reference =\
     512                                     _read_xya_file(fd, ' ')
    507513                else:
    508514                    fd = open(file_name)
    509                     data_points, attributes, geo_reference = _read_xya_file(fd, delimiter)
     515                    data_points, attributes, geo_reference =\
     516                                 _read_xya_file(fd, delimiter)
    510517                fd.close()
    511518            except (IndexError,ValueError,SyntaxError):
     
    516523                fd.close() 
    517524                # Catch this to add an error message
    518                 msg = 'Could not open file or incorrect file format %s:%s' %(file_name, e)
     525                msg = 'Could not open file or incorrect file format %s:%s'\
     526                      %(file_name, e)
    519527                raise IOError, msg
    520528               
    521529        elif file_name[-4:]== ".pts":
    522530            try:
    523                 data_points, attributes, geo_reference = _read_pts_file(file_name, verbose)
     531                data_points, attributes, geo_reference =\
     532                             _read_pts_file(file_name, verbose)
    524533            except IOError, e:   
    525534                msg = 'Could not open file %s ' %file_name
     
    530539            #
    531540            try:
    532                 data_points, attributes, geo_reference = _read_csv_file(file_name, verbose)
     541                data_points, attributes, geo_reference =\
     542                             _read_csv_file(file_name, verbose)
    533543            except IOError, e:   
    534544                msg = 'Could not open file %s ' %file_name
     
    682692        return Geospatial_data(pointlist, att_dict)
    683693
    684 def _read_pts_file(file_name, verbose = False):
     694def _read_pts_file(file_name, verbose=False):
    685695    """Read .pts NetCDF file
    686696   
     
    737747
    738748
    739 def _read_csv_file(file_name, verbose = False):
     749def _read_csv_file(file_name, verbose=False):
    740750    """Read .csv file
    741751   
     
    765775
    766776CSV_DELIMITER = ','
    767 def _read_csv_file_header(file_pointer, delimiter=CSV_DELIMITER,
     777def _read_csv_file_header(file_pointer,
     778                          delimiter=CSV_DELIMITER,
    768779                          verbose=False):
    769780
     
    777788def _read_csv_file_blocking(file_pointer, header,
    778789                            delimiter=CSV_DELIMITER,
    779                             max_read_lines = 500,
    780                             verbose = False):
     790                            max_read_lines=500,
     791                            verbose=False):
    781792   
    782793
     
    977988   
    978989    for key in point_atts['attributelist'].keys():
    979         point_atts['attributelist'][key]= array(point_atts['attributelist'][key]).astype(Float)
     990        point_atts['attributelist'][key]=\
     991                array(point_atts['attributelist'][key]).astype(Float)
    980992    return point_atts
    981993
Note: See TracChangeset for help on using the changeset viewer.