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

Class LoranPosition

 object --+    
          |    
point.Point --+
              |
             LoranPosition

Class for representing a GPS NMEA-formatted Loran-C position

Since: 0.8.0

Instance Methods [hide private]
 
__init__(self, latitude, longitude, time, status, mode=None)
Initialise a new LoranPosition object
str
__str__(self, talker='GP')
Pretty printed position string
str
mode_string(self)
Return a string version of the reading mode information

Inherited from point.Point: __dict__, __eq__, __hash__, __ne__, __repr__, __unicode__, bearing, destination, distance, final_bearing, forward, inverse, midpoint, sun_events, sunrise, sunset, to_grid_locator

Inherited from point.Point (private): _set_location

Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__

Static Methods [hide private]
Fix
parse_elements(elements)
Parse position data elements
Instance Variables [hide private]
  latitude
Location's latitude
  longitude
Locations's longitude
  mode
Type of reading
  status
GPS status
  time
Time the position was taken

Inherited from point.Point: rad_latitude, rad_longitude, timezone, units

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, latitude, longitude, time, status, mode=None)
(Constructor)

 

Initialise a new LoranPosition object

>>> LoranPosition(53.1440233333, -3.01542833333,
...               datetime.time(14, 20, 58, 14), True, None)
LoranPosition(53.1440233333, -3.01542833333,
              datetime.time(14, 20, 58, 14), True, None)
>>> LoranPosition(53.1440233333, -3.01542833333,
...               datetime.time(14, 20, 58, 14), True, "A")
LoranPosition(53.1440233333, -3.01542833333,
              datetime.time(14, 20, 58, 14), True, 'A')
Parameters:
  • latitude (float or coercible to float) - Fix's latitude
  • longitude (float or coercible to float) - Fix's longitude
  • time (datetime.time) - Time the fix was taken
  • status (bool) - Whether the data is active
  • mode (str) - Type of reading
Raises:
  • ValueError - Unknown value for angle
  • ValueError - Unknown value for units
  • ValueError - Invalid value for latitude or longitude
Overrides: object.__init__

__str__(self, talker='GP')
(Informal representation operator)

 

Pretty printed position string

>>> print(LoranPosition(53.1440233333, -3.01542833333,
...                     datetime.time(14, 20, 58), True, None))
$GPGLL,5308.6414,N,00300.9257,W,142058.00,A*1F
>>> print(LoranPosition(53.1440233333, -3.01542833333,
...                     datetime.time(14, 20, 58), True, "A"))
$GPGLL,5308.6414,N,00300.9257,W,142058.00,A,A*72
Parameters:
  • talker (str) - Talker ID
Returns: str
Human readable string representation of Position object
Raises:
  • ValueError - Unknown value for mode
Overrides: object.__str__

mode_string(self)

 

Return a string version of the reading mode information

>>> position = LoranPosition(53.1440233333, -3.01542833333,
...                          datetime.time(14, 20, 58), True, None)
>>> print(position.mode_string())
Unknown
>>> position.mode = "A"
>>> print(position.mode_string())
Autonomous
Returns: str
Quality information as string

parse_elements(elements)
Static Method

 

Parse position data elements

>>> LoranPosition.parse_elements(["52.32144", "N", "00300.9257", "W",
...                               "14205914", "A"])
LoranPosition(52.0053573333, -3.01542833333, datetime.time(14, 20, 59, 140000), True, None)
Parameters:
  • elements (list) - Data values for fix
Returns: Fix
Fix object representing data