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

Module waterlevel

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]
  Testwaterlevel
Use testvalue tag text from each type to build test case the waterlevel message

Functions [hide private]
BitVector encode(params, validate=False)
Create a waterlevel binary message payload to pack into an AIS Msg waterlevel.
dict decode(bv, validate=False)
Unpack a waterlevel 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)
  decodestationloc_longitude(bv, validate=False)
  decodestationloc_latitude(bv, validate=False)
  decodewaterlevel(bv, validate=False)
  decodedatum(bv, validate=False)
  decodesigma(bv, validate=False)
  decodeo(bv, validate=False)
  decodelevelinferred(bv, validate=False)
  decodeflat_tolerance_exceeded(bv, validate=False)
  decoderate_tolerance_exceeded(bv, validate=False)
  decodetemp_tolerance_exceeded(bv, validate=False)
  decodeexpected_height_exceeded(bv, validate=False)
  decodelink_down(bv, validate=False)
  decodetimeLastMeasured_month(bv, validate=False)
  decodetimeLastMeasured_day(bv, validate=False)
  decodetimeLastMeasured_hour(bv, validate=False)
  decodetimeLastMeasured_min(bv, validate=False)
  decodetimeLastMeasured_sec(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 timeLastMeasured_sec message to stdout.
dict testParams()
Return a params file base on the testvalue tags.
  addMsgOptions(parser)

Variables [hide private]
  __date__ = '2007-01-18'
Date of last svn commit
  TrueBV = <ais.BitVector.BitVector object at 0x2c5bd10>
Why always rebuild the True bit? This should speed things up a bunch
  FalseBV = <ais.BitVector.BitVector object at 0x2c5bd90>
Why always rebuild the False bit? This should speed things up a bunch
  fieldList = ['dac', 'fid', 'efid', 'timetag_month', 'timetag_day...
  datumEncodeLut = {'STND': '3', 'NAVD': '7', 'MLS': '5', 'WaterDepth':...
  datumDecodeLut = {'1': 'IGLD-85', '0': 'MLLW', '3': 'STND', '2': 'Wat...
  typeChoices = 'binary', 'nmeapayload', 'nmea'
  outputChoices = 'std', 'html', 'csv', 'kml', 'kml-full'
  outfile = file(options.outputFileName, 'w')
  msgDict = {'dac': '366', 'fid': '1', 'efid': '1', '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 waterlevel binary message payload to pack into an AIS Msg waterlevel.

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 (field automatically set to "1")
  • timetag_month(uint): Time the measurement represents month 1..12
  • timetag_day(uint): Time the measurement represents day of the month 1..31
  • timetag_hour(uint): Time the measurement represents UTC hours 0..23
  • timetag_min(uint): Time the measurement represents minutes
  • timetag_sec(uint): Time the measurement represents seconds
  • stationid(aisstr6): Character identifier of the station. Usually a number.
  • stationloc_longitude(decimal): Location of the sensor taking the water level measurement or position of prediction East West location
  • stationloc_latitude(decimal): Location of the sensor taking the water level measurement or position of prediction North South location
  • waterlevel(int): Water level in centimeters
  • datum(uint): What reference datum applies to the value
  • sigma(float): Standard deviation of 1 second samples used to compute the water level height
  • o(uint): Count of number of samples that fall outside a 3-sigma band about the mean
  • levelinferred(bool): indicates that the water level value has been inferred
  • flat_tolerance_exceeded(bool): flat tolerance limit was exceeded. Need better descr
  • rate_tolerance_exceeded(bool): rate of change tolerance limit was exceeded
  • temp_tolerance_exceeded(bool): temperature difference tolerance limit was exceeded
  • expected_height_exceeded(bool): either the maximum or minimum expected water level height limit was exceeded
  • link_down(bool): Unable to communicate with the tide system. All data invalid
  • timeLastMeasured_month(uint): Time since last measured value was available month 1..12
  • timeLastMeasured_day(uint): Time since last measured value was available day of the month 1..31
  • timeLastMeasured_hour(uint): Time since last measured value was available UTC hours 0..23
  • timeLastMeasured_min(uint): Time since last measured value was available minutes
  • timeLastMeasured_sec(uint): Time since last measured value was available seconds
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 waterlevel 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 (field automatically set to "1")
  • timetag_month(uint): Time the measurement represents month 1..12
  • timetag_day(uint): Time the measurement represents day of the month 1..31
  • timetag_hour(uint): Time the measurement represents UTC hours 0..23
  • timetag_min(uint): Time the measurement represents minutes
  • timetag_sec(uint): Time the measurement represents seconds
  • stationid(aisstr6): Character identifier of the station. Usually a number.
  • stationloc_longitude(decimal): Location of the sensor taking the water level measurement or position of prediction East West location
  • stationloc_latitude(decimal): Location of the sensor taking the water level measurement or position of prediction North South location
  • waterlevel(int): Water level in centimeters
  • datum(uint): What reference datum applies to the value
  • sigma(float): Standard deviation of 1 second samples used to compute the water level height
  • o(uint): Count of number of samples that fall outside a 3-sigma band about the mean
  • levelinferred(bool): indicates that the water level value has been inferred
  • flat_tolerance_exceeded(bool): flat tolerance limit was exceeded. Need better descr
  • rate_tolerance_exceeded(bool): rate of change tolerance limit was exceeded
  • temp_tolerance_exceeded(bool): temperature difference tolerance limit was exceeded
  • expected_height_exceeded(bool): either the maximum or minimum expected water level height limit was exceeded
  • link_down(bool): Unable to communicate with the tide system. All data invalid
  • timeLastMeasured_month(uint): Time since last measured value was available month 1..12
  • timeLastMeasured_day(uint): Time since last measured value was available day of the month 1..31
  • timeLastMeasured_hour(uint): Time since last measured value was available UTC hours 0..23
  • timeLastMeasured_min(uint): Time since last measured value was available minutes
  • timeLastMeasured_sec(uint): Time since last measured value was available seconds
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

decodestationloc_longitude(bv, validate=False)

source code 
None

decodestationloc_latitude(bv, validate=False)

source code 
None

decodewaterlevel(bv, validate=False)

source code 
None

decodedatum(bv, validate=False)

source code 
None

decodesigma(bv, validate=False)

source code 
None

decodeo(bv, validate=False)

source code 
None

decodelevelinferred(bv, validate=False)

source code 
None

decodeflat_tolerance_exceeded(bv, validate=False)

source code 
None

decoderate_tolerance_exceeded(bv, validate=False)

source code 
None

decodetemp_tolerance_exceeded(bv, validate=False)

source code 
None

decodeexpected_height_exceeded(bv, validate=False)

source code 
None

decodelink_down(bv, validate=False)

source code 
None

decodetimeLastMeasured_month(bv, validate=False)

source code 
None

decodetimeLastMeasured_day(bv, validate=False)

source code 
None

decodetimeLastMeasured_hour(bv, validate=False)

source code 
None

decodetimeLastMeasured_min(bv, validate=False)

source code 
None

decodetimeLastMeasured_sec(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 timeLastMeasured_sec 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 (field automatically set to "1")
  • timetag_month(uint): Time the measurement represents month 1..12
  • timetag_day(uint): Time the measurement represents day of the month 1..31
  • timetag_hour(uint): Time the measurement represents UTC hours 0..23
  • timetag_min(uint): Time the measurement represents minutes
  • timetag_sec(uint): Time the measurement represents seconds
  • stationid(aisstr6): Character identifier of the station. Usually a number.
  • stationloc_longitude(decimal): Location of the sensor taking the water level measurement or position of prediction East West location
  • stationloc_latitude(decimal): Location of the sensor taking the water level measurement or position of prediction North South location
  • waterlevel(int): Water level in centimeters
  • datum(uint): What reference datum applies to the value
  • sigma(float): Standard deviation of 1 second samples used to compute the water level height
  • o(uint): Count of number of samples that fall outside a 3-sigma band about the mean
  • levelinferred(bool): indicates that the water level value has been inferred
  • flat_tolerance_exceeded(bool): flat tolerance limit was exceeded. Need better descr
  • rate_tolerance_exceeded(bool): rate of change tolerance limit was exceeded
  • temp_tolerance_exceeded(bool): temperature difference tolerance limit was exceeded
  • expected_height_exceeded(bool): either the maximum or minimum expected water level height limit was exceeded
  • link_down(bool): Unable to communicate with the tide system. All data invalid
  • timeLastMeasured_month(uint): Time since last measured value was available month 1..12
  • timeLastMeasured_day(uint): Time since last measured value was available day of the month 1..31
  • timeLastMeasured_hour(uint): Time since last measured value was available UTC hours 0..23
  • timeLastMeasured_min(uint): Time since last measured value was available minutes
  • timeLastMeasured_sec(uint): Time since last measured value was available seconds
Parameters:
  • params - Dictionary of field names/values.
  • out - File like object to write to
Returns: stdout
text to out

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-01-18'                                                           
      

TrueBV

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

FalseBV

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

fieldList

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

datumEncodeLut

None
Value:
{'IGLD-85': '1',
 'LAT': '9',
 'MHW': '4',
 'MLLW': '0',
 'MLS': '5',
 'NAVD': '7',
 'NGVD': '6',
 'STND': '3',
...                                                                    
      

datumDecodeLut

None
Value:
{'0': 'MLLW',
 '1': 'IGLD-85',
 '2': 'WaterDepth',
 '3': 'STND',
 '4': 'MHW',
 '5': 'MLS',
 '6': 'NGVD',
 '7': 'NAVD',
...                                                                    
      

typeChoices

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

outputChoices

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

outfile

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

msgDict

None
Value:
{'dac': '366', 'fid': '1', 'efid': '1', '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, 'stationloc_longitude': options.stationloc_longitudeField, 'st
ationloc_latitude': options.stationloc_latitudeField, 'waterlevel': op
tions.waterlevelField, 'datum': options.datumField, 'sigma': options.s
igmaField, 'o': options.oField, 'levelinferred': options.levelinferred
...                                                                    
      

bitLen

None
Value:
len(bits)                                                              
      

bits

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

buf

None
Value:
StringIO.StringIO()                                                    
      

result

None
Value:
buf.getvalue()