Package upoints :: Module nmea
[hide private]
[frames] | no frames]

Module nmea

nmea - Imports GPS NMEA-formatted data files
Classes [hide private]
  LoranPosition
Class for representing a GPS NMEA-formatted Loran-C position
  Position
Class for representing a GPS NMEA-formatted position
  Fix
Class for representing a GPS NMEA-formatted system fix
  Waypoint
Class for representing a NMEA-formatted waypoint
  Locations
Class for representing a group of GPS location objects
Functions [hide private]
 
calc_checksum(sentence)
Calculate a NMEA 0183 checksum for the given sentence
tuple
nmea_latitude(latitude)
Generate a NMEA-formatted latitude pair
tuple
nmea_longitude(longitude)
Generate a NMEA-formatted longitude pair
float
parse_latitude(latitude, hemisphere)
Parse a NMEA-formatted latitude pair
float
parse_longitude(longitude, hemisphere)
Parse a NMEA-formatted longitude pair
Variables [hide private]
  MODE_INDICATOR = {'A': 'Autonomous', 'D': 'Differential', 'E':...
NMEA's mapping of code to reading type
Function Details [hide private]

calc_checksum(sentence)

 

Calculate a NMEA 0183 checksum for the given sentence

NMEA checksums are a simple XOR of all the characters in the sentence between the leading "$" symbol, and the "*" checksum separator.

>>> calc_checksum("$GPGGA,142058,5308.6414,N,00300.9257,W,1,04,5.6,1374.6,M,34.5,M,,*6B")
107
>>> calc_checksum("GPGGA,142058,5308.6414,N,00300.9257,W,1,04,5.6,1374.6,M,34.5,M,,*6B")
107
>>> calc_checksum("$GPGGA,142058,5308.6414,N,00300.9257,W,1,04,5.6,1374.6,M,34.5,M,,")
107
>>> calc_checksum("GPGGA,142058,5308.6414,N,00300.9257,W,1,04,5.6,1374.6,M,34.5,M,,")
107
Parameters:
  • sentence (str) - NMEA 0183 formatted sentence

nmea_latitude(latitude)

 

Generate a NMEA-formatted latitude pair

>>> nmea_latitude(53.144023333333337)
('5308.6414', 'N')
Parameters:
  • latitude (float or coercible to float) - Latitude to convert
Returns: tuple
NMEA-formatted latitude values

nmea_longitude(longitude)

 

Generate a NMEA-formatted longitude pair

>>> nmea_longitude(-3.0154283333333334)
('00300.9257', 'W')
Parameters:
  • longitude (float or coercible to float) - Longitude to convert
Returns: tuple
NMEA-formatted longitude values

parse_latitude(latitude, hemisphere)

 

Parse a NMEA-formatted latitude pair

>>> parse_latitude("5308.6414", "N")
53.144023333333337
Parameters:
  • latitude (str) - Latitude in DDMM.MMMM
  • hemisphere (str) - North or South
Returns: float
Decimal representation of latitude

parse_longitude(longitude, hemisphere)

 

Parse a NMEA-formatted longitude pair

>>> parse_longitude("00300.9257", "W")
-3.0154283333333334
Parameters:
  • longitude (str) - Longitude in DDDMM.MMMM
  • hemisphere (str) - East or West
Returns: float
Decimal representation of longitude

Variables Details [hide private]

MODE_INDICATOR

NMEA's mapping of code to reading type
Value:
{'A': 'Autonomous',
 'D': 'Differential',
 'E': 'Estimated',
 'M': 'Manual',
 'N': 'Invalid',
 'S': 'Simulated'}