def parse_elements(elements):
        """Parse essential fix's data elements.

        Args:
            elements (list): Data values for fix

        Returns:
            Fix: Fix object representing data
        """
        if not len(elements) in (14, 15):
            raise ValueError('Invalid GGA fix data')
        time = datetime.time(*[int(elements[0][i:i + 2])
                               for i in range(0, 6, 2)])
        # Latitude and longitude are checked for validity during Fix
        # instantiation
        latitude = parse_latitude(elements[1], elements[2])
        longitude = parse_longitude(elements[3], elements[4])
        quality = int(elements[5])
        if not 0 <= quality <= 9:
            raise ValueError('Invalid quality value %r' % quality)
        satellites = int(elements[6])
        if not 0 <= satellites <= 12:
            raise ValueError('Invalid number of satellites %r'
                             % satellites)
        dilution = float(elements[7])
        altitude = float(elements[8])
        if elements[9] == 'F':
            altitude = altitude * 3.2808399
        elif not elements[9] == 'M':
            raise ValueError('Unknown altitude unit %r' % elements[9])
        if elements[10] in ('-', ''):
            geoid_delta = False
            logging.warning('Altitude data could be incorrect, as the geoid '
                            'difference has not been provided')
        else:
            geoid_delta = float(elements[10])
        if elements[11] == 'F':
            geoid_delta = geoid_delta * 3.2808399
        elif geoid_delta and not elements[11] == 'M':
            raise ValueError('Unknown geoid delta unit %r' % elements[11])
        dgps_delta = float(elements[12]) if elements[12] else None
        dgps_station = int(elements[13]) if elements[13] else None
        mode = elements[14] if len(elements) == 15 else None
        return Fix(time, latitude, longitude, quality, satellites, dilution,
                   altitude, geoid_delta, dgps_delta, dgps_station, mode)
def parse_elements ( elements ) : if not len ( elements ) in ( 14 , 15 ) : raise ValueError ( 'Invalid GGA fix data' ) time = datetime . time ( * [ int ( elements [ 0 ] [ i : i + 2 ] ) for i in range ( 0 , 6 , 2 ) ] ) latitude = parse_latitude ( elements [ 1 ] , elements [ 2 ] ) longitude = parse_longitude ( elements [ 3 ] , elements [ 4 ] ) quality = int ( elements [ 5 ] ) if not 0 <= quality <= 9 : raise ValueError ( 'Invalid quality value %r' % quality ) satellites = int ( elements [ 6 ] ) if not 0 <= satellites <= 12 : raise ValueError ( 'Invalid number of satellites %r' % satellites ) dilution = float ( elements [ 7 ] ) altitude = float ( elements [ 8 ] ) if elements [ 9 ] == 'F' : altitude = altitude * 3.2808399 elif not elements [ 9 ] == 'M' : raise ValueError ( 'Unknown altitude unit %r' % elements [ 9 ] ) if elements [ 10 ] in ( '-' , '' ) : geoid_delta = False logging . warning ( 'Altitude data could be incorrect, as the geoid ' 'difference has not been provided' ) else : geoid_delta = float ( elements [ 10 ] ) if elements [ 11 ] == 'F' : geoid_delta = geoid_delta * 3.2808399 elif geoid_delta and not elements [ 11 ] == 'M' : raise ValueError ( 'Unknown geoid delta unit %r' % elements [ 11 ] ) dgps_delta = float ( elements [ 12 ] ) if elements [ 12 ] else None dgps_station = int ( elements [ 13 ] ) if elements [ 13 ] else None mode = elements [ 14 ] if len ( elements ) == 15 else None return Fix ( time , latitude , longitude , quality , satellites , dilution , altitude , geoid_delta , dgps_delta , dgps_station , mode )
Parse essential fix's data elements.

        Args:
            elements (list): Data values for fix

        Returns:
            Fix: Fix object representing data