def nmea_gga_store(self, datafile):
     # Read file and take only the information GGA (global positioning system fix data) data
     # Return:
     # gga: dictionnary of GGA data parsing this way:
     #   {
     #        "0": {
     #           "lat": LAT in DD,
     #           "long": LONG in DD,
     #           "alt": ALT in m,
     #           "time": time in HHMMSS.DD
     #       },
     #        "1": {...
     #       }
     #   }
     #read = self.fileopen(datafile)
     read = open(datafile, 'r')
     gga = {}
     a = 1
     b = 1
     i = 0
     for line in read.readlines():
         if line[3:6] == 'GGA':
             split = line.split(',')
             if split[2] != '' or split[4] != '':
                 if split[3] == 'S':
                     a = -1
                 if split[5] == 'W':
                     b = -1
                 gga[i] = {'time': split[1], 'lat': a*tools.dm_to_dd(float(split[2])/100),
                           'long': b*tools.dm_to_dd(float(split[4])/100), 'alt': split[9]}
                 i += 1
     read.close()
     return gga
 def nmea_rmc_store(self, datafile):
     # Read data collected and store into matrix RMC data
     # Return:
     # rmc: {
     #    "0": {
     #        "E/W": EW - character - East/West indicator,
     #        "Course Over Ground": course_over_ground - degrees - numeric - Course over ground,
     #        "time": time - hhmmss.ss - UTC time,
     #        "N/S": NS - character - North/South indicator,
     #        "long":  long - dddmm.mmmmm - Longitude (degrees & minutes),
     #        "lat": lat - ddmm.mmmmm - Latitude (degrees & minutes),
     #        "Speed Over Ground": speed_ovr_ground - knots - numeric - Speed over ground
     #    },
     #    "1": {...
     #    }
     #}
     file = self.fileopen(datafile)
     rmc = {}
     i = 0
     for line in file:
         if line[3:6] == 'RMC':
             data = line.split(',')
             if (data[3] and data[5]) != '':
                 time = data[1]
                 lat = tools.dm_to_dd(float(data[3]) / 100)
                 ns = data[4]
                 long = tools.dm_to_dd(float(data[5]) / 100)
                 ew = data[6]
                 speed_over_ground = data[7]
                 course_over_ground = data[8]
                 rmc[i] = {
                     'time': time,
                     'lat': lat,
                     'N/S': ns,
                     'long': long,
                     'E/W': ew,
                     'Speed Over Ground': speed_over_ground,
                     'Course Over Ground': course_over_ground
                 }
                 i += 1
     file.close()
     return rmc
 def nmea_gga_store(self, datafile):
     # Read file and take only the information GGA (global positioning system fix data) data
     # Return:
     # gga: dictionnary of GGA data parsing this way:
     #   {
     #        "0": {
     #           "lat": LAT in DD,
     #           "long": LONG in DD,
     #           "alt": ALT in m,
     #           "time": time in HHMMSS.DD
     #       },
     #        "1": {...
     #       }
     #   }
     #read = self.fileopen(datafile)
     read = open(datafile, 'r')
     gga = {}
     a = 1
     b = 1
     i = 0
     for line in read.readlines():
         if line[3:6] == 'GGA':
             split = line.split(',')
             if split[2] != '' or split[4] != '':
                 if split[3] == 'S':
                     a = -1
                 if split[5] == 'W':
                     b = -1
                 gga[i] = {
                     'time': split[1],
                     'lat': a * tools.dm_to_dd(float(split[2]) / 100),
                     'long': b * tools.dm_to_dd(float(split[4]) / 100),
                     'alt': split[9]
                 }
                 i += 1
     read.close()
     return gga
 def nmea_rmc_store(self, datafile):
     # Read data collected and store into matrix RMC data
     # Return:
     # rmc: {
     #    "0": {
     #        "E/W": EW - character - East/West indicator,
     #        "Course Over Ground": course_over_ground - degrees - numeric - Course over ground,
     #        "time": time - hhmmss.ss - UTC time,
     #        "N/S": NS - character - North/South indicator,
     #        "long":  long - dddmm.mmmmm - Longitude (degrees & minutes),
     #        "lat": lat - ddmm.mmmmm - Latitude (degrees & minutes),
     #        "Speed Over Ground": speed_ovr_ground - knots - numeric - Speed over ground
     #    },
     #    "1": {...
     #    }
     #}
     file = self.fileopen(datafile)
     rmc = {}
     i = 0
     for line in file:
         if line[3:6] == 'RMC':
             data = line.split(',')
             if (data[3] and data[5]) != '':
                 time = data[1]
                 lat = tools.dm_to_dd(float(data[3])/100)
                 ns = data[4]
                 long = tools.dm_to_dd(float(data[5])/100)
                 ew = data[6]
                 speed_over_ground = data[7]
                 course_over_ground = data[8]
                 rmc[i] = {'time': time, 'lat': lat, 'N/S': ns, 'long': long, 'E/W': ew,
                           'Speed Over Ground': speed_over_ground,
                           'Course Over Ground': course_over_ground}
                 i += 1
     file.close()
     return rmc