Package ais :: Module whalenotice
[hide private]
[frames] | no frames]

Module whalenotice

source code

Autogenerated python functions to serialize/deserialize binary messages.

Generated by: ./aisxmlbinmsg2py.py

Need to then wrap these functions with the outer AIS packet and then convert the whole binary blob to a NMEA string. Those functions are not currently provided in this file.

serialize: python to ais binary deserialize: ais binary to python

The generated code uses translators.py, binary.py, and aisstring.py which should be packaged with the resulting files.


Requires:

Author: xmlbinmsg

Version: 4791

Status: under development

License: Generated code has no license

Classes [hide private]
  Testwhalenotice
Use testvalue tag text from each type to build test case the whalenotice message

Functions [hide private]
BitVector encode(params, validate=False)
Create a whalenotice binary message payload to pack into an AIS Msg whalenotice.
dict decode(bv, validate=False)
Unpack a whalenotice message
  decodedac(bv, validate=False)
  decodefid(bv, validate=False)
  decodeefid(bv, validate=False)
  decodetimetag_month(bv, validate=False)
  decodetimetag_day(bv, validate=False)
  decodetimetag_hour(bv, validate=False)
  decodetimetag_min(bv, validate=False)
  decodetimetag_sec(bv, validate=False)
  decodestationid(bv, validate=False)
  decodestation_longitude(bv, validate=False)
  decodestation_latitude(bv, validate=False)
  decodewhale_longitude(bv, validate=False)
  decodewhale_latitude(bv, validate=False)
  decodetimetoexpire(bv, validate=False)
  decoderadius(bv, validate=False)
  decodeheading(bv, validate=False)
  decodenumWhales(bv, validate=False)
  printHtml(params, out=sys.stdout)
  printKml(params, out=sys.stdout)
KML (Keyhole Markup Language) for Google Earth, but without the header/footer
stdout printFields(params, out=sys.stdout, format='std', fieldList=None)
Print a numWhales message to stdout.
str sqlCreateStr(outfile=sys.stdout, fields=None, extraFields=None)
Return the SQL CREATE command for this message type
sqlhelp.create sqlCreate(fields=None, extraFields=None)
Return the sqlhelp object to create the table.
str sqlInsertStr(params, outfile=sys.stdout, extraParams=None)
Return the SQL CREATE command for this message type
sqlhelp.insert sqlInsert(params, extraParams=None)
Give the SQL insert statement
dict testParams()
Return a params file base on the testvalue tags.
  addMsgOptions(parser)

Variables [hide private]
  __date__ = '2007-02-05'
Date of last svn commit
  TrueBV = <ais.BitVector.BitVector object at 0xbdcf130>
Why always rebuild the True bit? This should speed things up a bunch
  FalseBV = <ais.BitVector.BitVector object at 0xbdcf1b0>
Why always rebuild the False bit? This should speed things up a bunch
  fieldList = ['dac', 'fid', 'efid', 'timetag_month', 'timetag_day...
  typeChoices = 'binary', 'nmeapayload', 'nmea'
  outputChoices = 'std', 'html', 'csv', 'sql', 'kml', 'kml-full'
  outfile = file(options.outputFileName, 'w')
  msgDict = {'dac': '366', 'fid': '1', 'efid': '2', 'timetag_mon...
  bitLen = len(bits)
  bits = bits+ BitVector(size= (6-(bitLen % 6)))
  buf = StringIO.StringIO()
  result = buf.getvalue()

Function Details [hide private]

encode(params, validate=False)

source code 

Create a whalenotice binary message payload to pack into an AIS Msg whalenotice.

Fields in params:
  • dac(uint): Designated Area Code (field automatically set to "366")
  • fid(uint): Functional Identifier (field automatically set to "1")
  • efid(uint): extended functional identifier (dac+fid+id defines which message) (field automatically set to "2")
  • timetag_month(uint): Time whale was last recorded month 1..12
  • timetag_day(uint): Time whale was last recorded day of the month 1..31
  • timetag_hour(uint): Time whale was last recorded UTC hours 0..23
  • timetag_min(uint): Time whale was last recorded minutes
  • timetag_sec(uint): Time whale was last recorded seconds
  • stationid(aisstr6): Character identifier of the station. Usually a number.
  • station_longitude(decimal): Location of the sensor taking the water level measurement or position of prediction East West location
  • station_latitude(decimal): Location of the sensor taking the water level measurement or position of prediction North South location
  • whale_longitude(decimal): Where was the whale East West location
  • whale_latitude(decimal): Where was the whale North South location
  • timetoexpire(uint): Seconds until this notice expires
  • radius(uint): Distance of the required exclusion/slow zone
  • heading(uint): Direction the whale is traveling
  • numWhales(uint): Number of whales detected
Parameters:
  • params - Dictionary of field names/values. Throws a ValueError exception if required is missing
  • validate - Set to true to cause checking to occur. Runs slower. FIX: not implemented.
Returns: BitVector
encoded binary message (for binary messages, this needs to be wrapped in a msg 8

Note: The returned bits may not be 6 bit aligned. It is up to you to pad out the bits.

decode(bv, validate=False)

source code 

Unpack a whalenotice message

Fields in params:
  • dac(uint): Designated Area Code (field automatically set to "366")
  • fid(uint): Functional Identifier (field automatically set to "1")
  • efid(uint): extended functional identifier (dac+fid+id defines which message) (field automatically set to "2")
  • timetag_month(uint): Time whale was last recorded month 1..12
  • timetag_day(uint): Time whale was last recorded day of the month 1..31
  • timetag_hour(uint): Time whale was last recorded UTC hours 0..23
  • timetag_min(uint): Time whale was last recorded minutes
  • timetag_sec(uint): Time whale was last recorded seconds
  • stationid(aisstr6): Character identifier of the station. Usually a number.
  • station_longitude(decimal): Location of the sensor taking the water level measurement or position of prediction East West location
  • station_latitude(decimal): Location of the sensor taking the water level measurement or position of prediction North South location
  • whale_longitude(decimal): Where was the whale East West location
  • whale_latitude(decimal): Where was the whale North South location
  • timetoexpire(uint): Seconds until this notice expires
  • radius(uint): Distance of the required exclusion/slow zone
  • heading(uint): Direction the whale is traveling
  • numWhales(uint): Number of whales detected
Parameters:
  • bv (BitVector) - Bits defining a message
  • validate - Set to true to cause checking to occur. Runs slower. FIX: not implemented.
Returns: dict
params

decodedac(bv, validate=False)

source code 
None

decodefid(bv, validate=False)

source code 
None

decodeefid(bv, validate=False)

source code 
None

decodetimetag_month(bv, validate=False)

source code 
None

decodetimetag_day(bv, validate=False)

source code 
None

decodetimetag_hour(bv, validate=False)

source code 
None

decodetimetag_min(bv, validate=False)

source code 
None

decodetimetag_sec(bv, validate=False)

source code 
None

decodestationid(bv, validate=False)

source code 
None

decodestation_longitude(bv, validate=False)

source code 
None

decodestation_latitude(bv, validate=False)

source code 
None

decodewhale_longitude(bv, validate=False)

source code 
None

decodewhale_latitude(bv, validate=False)

source code 
None

decodetimetoexpire(bv, validate=False)

source code 
None

decoderadius(bv, validate=False)

source code 
None

decodeheading(bv, validate=False)

source code 
None

decodenumWhales(bv, validate=False)

source code 
None

printHtml(params, out=sys.stdout)

source code 
None

printKml(params, out=sys.stdout)

source code 
KML (Keyhole Markup Language) for Google Earth, but without the header/footer

printFields(params, out=sys.stdout, format='std', fieldList=None)

source code 

Print a numWhales message to stdout.

Fields in params:
  • dac(uint): Designated Area Code (field automatically set to "366")
  • fid(uint): Functional Identifier (field automatically set to "1")
  • efid(uint): extended functional identifier (dac+fid+id defines which message) (field automatically set to "2")
  • timetag_month(uint): Time whale was last recorded month 1..12
  • timetag_day(uint): Time whale was last recorded day of the month 1..31
  • timetag_hour(uint): Time whale was last recorded UTC hours 0..23
  • timetag_min(uint): Time whale was last recorded minutes
  • timetag_sec(uint): Time whale was last recorded seconds
  • stationid(aisstr6): Character identifier of the station. Usually a number.
  • station_longitude(decimal): Location of the sensor taking the water level measurement or position of prediction East West location
  • station_latitude(decimal): Location of the sensor taking the water level measurement or position of prediction North South location
  • whale_longitude(decimal): Where was the whale East West location
  • whale_latitude(decimal): Where was the whale North South location
  • timetoexpire(uint): Seconds until this notice expires
  • radius(uint): Distance of the required exclusion/slow zone
  • heading(uint): Direction the whale is traveling
  • numWhales(uint): Number of whales detected
Parameters:
  • params - Dictionary of field names/values.
  • out - File like object to write to
Returns: stdout
text to out

sqlCreateStr(outfile=sys.stdout, fields=None, extraFields=None)

source code 
Return the SQL CREATE command for this message type
Parameters:
  • outfile - file like object to print to.
  • fields - which fields to put in the create. Defaults to all.
  • extraFields - A sequence of tuples containing (name,sql type) for additional fields
Returns: str
sql create string

See Also: sqlCreate

sqlCreate(fields=None, extraFields=None)

source code 
Return the sqlhelp object to create the table.
Parameters:
  • fields - which fields to put in the create. Defaults to all.
  • extraFields - A sequence of tuples containing (name,sql type) for additional fields
Returns: sqlhelp.create
An object that can be used to generate a return

sqlInsertStr(params, outfile=sys.stdout, extraParams=None)

source code 
Return the SQL CREATE command for this message type
Parameters:
  • params - dictionary of values keyed by field name
  • outfile - file like object to print to.
  • extraParams - A sequence of tuples containing (name,sql type) for additional fields
Returns: str
sql create string

See Also: sqlCreate

sqlInsert(params, extraParams=None)

source code 
Give the SQL insert statement
Parameters:
  • params - dict keyed by field name of values
  • extraParams - any extra fields that you have created beyond the normal ais message fields
Returns: sqlhelp.insert
insert class instance

To Do: allow optional type checking of params?

Warning: this will take invalid keys happily and do what???

testParams()

source code 
Return a params file base on the testvalue tags.
Returns: dict
params based on testvalue tags

addMsgOptions(parser)

source code 
None

Variables Details [hide private]

__date__

Date of last svn commit
Value:
'2007-02-05'                                                           
      

TrueBV

Why always rebuild the True bit? This should speed things up a bunch
Value:
<ais.BitVector.BitVector object at 0xbdcf130>                          
      

FalseBV

Why always rebuild the False bit? This should speed things up a bunch
Value:
<ais.BitVector.BitVector object at 0xbdcf1b0>                          
      

fieldList

None
Value:
['dac',
 'fid',
 'efid',
 'timetag_month',
 'timetag_day',
 'timetag_hour',
 'timetag_min',
 'timetag_sec',
...                                                                    
      

typeChoices

None
Value:
'binary', 'nmeapayload', 'nmea'                                        
      

outputChoices

None
Value:
'std', 'html', 'csv', 'sql', 'kml', 'kml-full'                         
      

outfile

None
Value:
file(options.outputFileName, 'w')                                      
      

msgDict

None
Value:
{'dac': '366', 'fid': '1', 'efid': '2', 'timetag_month': options.timet
ag_monthField, 'timetag_day': options.timetag_dayField, 'timetag_hour'
: options.timetag_hourField, 'timetag_min': options.timetag_minField, 
'timetag_sec': options.timetag_secField, 'stationid': options.stationi
dField, 'station_longitude': options.station_longitudeField, 'station_
latitude': options.station_latitudeField, 'whale_longitude': options.w
hale_longitudeField, 'whale_latitude': options.whale_latitudeField, 't
imetoexpire': options.timetoexpireField, 'radius': options.radiusField
...                                                                    
      

bitLen

None
Value:
len(bits)                                                              
      

bits

None
Value:
bits+ BitVector(size= (6-(bitLen % 6)))                                
      

buf

None
Value:
StringIO.StringIO()                                                    
      

result

None
Value:
buf.getvalue()