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

Module imo_001_11

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

To Do: FIX: put in a description of the message here with fields and types.

Date: 2007-03-31

Classes [hide private]
  Testimo_met_hydro
Use testvalue tag text from each type to build test case the imo_met_hydro message
Functions [hide private]
BitVector
encode(params, validate=False)
Create a imo_met_hydro binary message payload to pack into an AIS Msg imo_met_hydro.
source code
dict
decode(bv, validate=False)
Unpack a imo_met_hydro message
source code
 
decodeMessageID(bv, validate=False) source code
 
decodeRepeatIndicator(bv, validate=False) source code
 
decodeUserID(bv, validate=False) source code
 
decodedac(bv, validate=False) source code
 
decodefid(bv, validate=False) source code
 
decodePosition_longitude(bv, validate=False) source code
 
decodePosition_latitude(bv, validate=False) source code
 
decodedatetime(bv, validate=False) source code
 
decodeavewind(bv, validate=False) source code
 
decodewindgust(bv, validate=False) source code
 
decodewinddir(bv, validate=False) source code
 
decodewindgustdir(bv, validate=False) source code
 
decodeairtemp(bv, validate=False) source code
 
decoderelhumid(bv, validate=False) source code
 
decodedewpoint(bv, validate=False) source code
 
decodeairpressure(bv, validate=False) source code
 
decodeairpressuretrend(bv, validate=False) source code
 
decodehorizvis(bv, validate=False) source code
 
decodewaterlevel(bv, validate=False) source code
 
decodewaterleveltrend(bv, validate=False) source code
 
decodesurfcurspeed(bv, validate=False) source code
 
decodesurfcurdir(bv, validate=False) source code
 
decodecurspeed2(bv, validate=False) source code
 
decodecurdir2(bv, validate=False) source code
 
decodecurlevel2(bv, validate=False) source code
 
decodecurspeed3(bv, validate=False) source code
 
decodecurdir3(bv, validate=False) source code
 
decodecurlevel3(bv, validate=False) source code
 
decodesigwaveheight(bv, validate=False) source code
 
decodewaveperiod(bv, validate=False) source code
 
decodewavedir(bv, validate=False) source code
 
decodeswellheight(bv, validate=False) source code
 
decodeswellperiod(bv, validate=False) source code
 
decodeswelldir(bv, validate=False) source code
 
decodeseastate(bv, validate=False) source code
 
decodewatertemp(bv, validate=False) source code
 
decodepreciptype(bv, validate=False) source code
 
decodesalinity(bv, validate=False) source code
 
decodeice(bv, validate=False) source code
 
decodeSpare(bv, validate=False) source code
 
printHtml(params, out=sys.stdout) source code
 
printKml(params, out=sys.stdout)
KML (Keyhole Markup Language) for Google Earth, but without the header/footer
source code
stdout
printFields(params, out=sys.stdout, format='std', fieldList=None, dbType='postgres')
Print a imo_met_hydro message to stdout.
source code
str
sqlCreateStr(outfile=sys.stdout, fields=None, extraFields=None, addCoastGuardFields=True, dbType='postgres')
Return the SQL CREATE command for this message type
source code
sqlhelp.create
sqlCreate(fields=None, extraFields=None, addCoastGuardFields=True, dbType='postgres')
Return the sqlhelp object to create the table.
source code
str
sqlInsertStr(params, outfile=sys.stdout, extraParams=None, dbType='postgres')
Return the SQL INSERT command for this message type
source code
sqlhelp.insert
sqlInsert(params, extraParams=None, dbType='postgres')
Give the SQL INSERT statement
source code
str
latexDefinitionTable(outfile=sys.stdout)
Return the LaTeX definition table for this message type
source code
dict
testParams()
Return a params file base on the testvalue tags.
source code
 
addMsgOptions(parser) source code
Variables [hide private]
  TrueBV = BitVector(bitstring= "1")
Why always rebuild the True bit? This should speed things up a bunch
  FalseBV = BitVector(bitstring= "0")
Why always rebuild the False bit? This should speed things up a bunch
  fieldList = ('MessageID', 'RepeatIndicator', 'UserID', 'Spare'...
  fieldListPostgres = ('MessageID', 'RepeatIndicator', 'UserID',...
  toPgFields = {}
Go to the Postgis field names from the straight field name
  fromPgFields = {}
Go from the Postgis field names to the straight field name
  pgTypes = {}
Lookup table for each postgis field name to get its type.
  RepeatIndicatorEncodeLut = {'default': '0', 'do not repeat any...
  RepeatIndicatorDecodeLut = {'0': 'default', '3': 'do not repea...
  airpressuretrendEncodeLut = {'decreasing': '1', 'increasing': ...
  airpressuretrendDecodeLut = {'0': 'steady', '1': 'decreasing',...
  waterleveltrendEncodeLut = {'decreasing': '1', 'increasing': '...
  waterleveltrendDecodeLut = {'0': 'steady', '1': 'decreasing', ...
  seastateEncodeLut = {'Calm': '0', 'Fresh breeze': '5', 'Gale':...
  seastateDecodeLut = {'0': 'Calm', '1': 'Light air', '10': 'Sto...
  preciptypeEncodeLut = {'FIX: find the WMO list of types': '0',...
  preciptypeDecodeLut = {'0': 'FIX: find the WMO list of types',...
Function Details [hide private]

encode(params, validate=False)

source code 

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

Fields in params:
  • MessageID(uint): AIS message number. Must be 8 (field automatically set to "8")
  • RepeatIndicator(uint): Indicated how many times a message has been repeated
  • UserID(uint): Unique ship identification number (MMSI)
  • Spare(uint): Reserved for definition by a regional authority. (field automatically set to "0")
  • dac(uint): Designated Area Code (field automatically set to "1")
  • fid(uint): Functional Identifier (field automatically set to "11")
  • Position_longitude(decimal): Location of the vessel East West location
  • Position_latitude(decimal): Location of the vessel North South location
  • datetime(uint): FIX: break hhmmss into subfields. Think it is 5 bits day, 5 bits hour, 6 bits min that match SLS.
  • avewind(uint): Average wind speed values for the last 10 minutes. FIX: why is 121-126 not valid???
  • windgust(uint): Wind gust is the max wind speed value reading during the last 10 minutes. FIX: why is 121-126 not valid???
  • winddir(uint): Wind direction. No idea if this is the latest, ave, median, etc. FIX: find out!
  • windgustdir(uint): Wind direction for the gust.
  • airtemp(decimal): Bry bulb temperature
  • relhumid(uint): Relative humidity
  • dewpoint(decimal): Bry bulb temperature - FIX: should this be a udecimal??
  • airpressure(udecimal): Air pressure. FIX: 9 bits only goes 0..511
  • airpressuretrend(uint): Air pressure trend
  • horizvis(udecimal): Horizontal visibility
  • waterlevel(decimal): Water level (incl. tide)
  • waterleveltrend(uint): Water level trend
  • surfcurspeed(udecimal): Surace current speed
  • surfcurdir(uint): Surface current direction
  • curspeed2(udecimal): Level 2 current speed
  • curdir2(uint): Level 2 current direction
  • curlevel2(uint): Measuring level below sea surface for level 2
  • curspeed3(udecimal): Level 3 current speed
  • curdir3(uint): Level 3 current direction
  • curlevel3(uint): Measuring level below sea surface for level 3
  • sigwaveheight(udecimal): Significan wave height
  • waveperiod(uint): Wave period - FIX: How does to fit to the power spectrum?
  • wavedir(uint): Wave direction - FIX: please define this better
  • swellheight(udecimal): Swell height
  • swellperiod(uint): Swell period - FIX: How does to fit to the power spectrum?
  • swelldir(uint): Swell direction - FIX: please define this better
  • seastate(uint): Sea state according to the Beaufort scale
  • watertemp(decimal): Water temp (FIX: at surface? Any requirements on how measured?)
  • preciptype(uint): According to WMO
  • salinity(decimal): Salinity - FIX: by what standard? Measured how?
  • ice(bool): Yes or no for the presence of ice. FIX: what types of ice constitute a yes??
  • Spare(uint): Must be zero. FIX: this does not seem slot aligned. (field automatically set to "0")
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 imo_met_hydro message

Fields in params:
  • MessageID(uint): AIS message number. Must be 8 (field automatically set to "8")
  • RepeatIndicator(uint): Indicated how many times a message has been repeated
  • UserID(uint): Unique ship identification number (MMSI)
  • Spare(uint): Reserved for definition by a regional authority. (field automatically set to "0")
  • dac(uint): Designated Area Code (field automatically set to "1")
  • fid(uint): Functional Identifier (field automatically set to "11")
  • Position_longitude(decimal): Location of the vessel East West location
  • Position_latitude(decimal): Location of the vessel North South location
  • datetime(uint): FIX: break hhmmss into subfields. Think it is 5 bits day, 5 bits hour, 6 bits min that match SLS.
  • avewind(uint): Average wind speed values for the last 10 minutes. FIX: why is 121-126 not valid???
  • windgust(uint): Wind gust is the max wind speed value reading during the last 10 minutes. FIX: why is 121-126 not valid???
  • winddir(uint): Wind direction. No idea if this is the latest, ave, median, etc. FIX: find out!
  • windgustdir(uint): Wind direction for the gust.
  • airtemp(decimal): Bry bulb temperature
  • relhumid(uint): Relative humidity
  • dewpoint(decimal): Bry bulb temperature - FIX: should this be a udecimal??
  • airpressure(udecimal): Air pressure. FIX: 9 bits only goes 0..511
  • airpressuretrend(uint): Air pressure trend
  • horizvis(udecimal): Horizontal visibility
  • waterlevel(decimal): Water level (incl. tide)
  • waterleveltrend(uint): Water level trend
  • surfcurspeed(udecimal): Surace current speed
  • surfcurdir(uint): Surface current direction
  • curspeed2(udecimal): Level 2 current speed
  • curdir2(uint): Level 2 current direction
  • curlevel2(uint): Measuring level below sea surface for level 2
  • curspeed3(udecimal): Level 3 current speed
  • curdir3(uint): Level 3 current direction
  • curlevel3(uint): Measuring level below sea surface for level 3
  • sigwaveheight(udecimal): Significan wave height
  • waveperiod(uint): Wave period - FIX: How does to fit to the power spectrum?
  • wavedir(uint): Wave direction - FIX: please define this better
  • swellheight(udecimal): Swell height
  • swellperiod(uint): Swell period - FIX: How does to fit to the power spectrum?
  • swelldir(uint): Swell direction - FIX: please define this better
  • seastate(uint): Sea state according to the Beaufort scale
  • watertemp(decimal): Water temp (FIX: at surface? Any requirements on how measured?)
  • preciptype(uint): According to WMO
  • salinity(decimal): Salinity - FIX: by what standard? Measured how?
  • ice(bool): Yes or no for the presence of ice. FIX: what types of ice constitute a yes??
  • Spare(uint): Must be zero. FIX: this does not seem slot aligned. (field automatically set to "0")
Parameters:
  • bv (BitVector) - Bits defining a message
  • validate - Set to true to cause checking to occur. Runs slower. FIX: not implemented.
Returns: dict
params

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

source code 

Print a imo_met_hydro message to stdout.

Fields in params:
  • MessageID(uint): AIS message number. Must be 8 (field automatically set to "8")
  • RepeatIndicator(uint): Indicated how many times a message has been repeated
  • UserID(uint): Unique ship identification number (MMSI)
  • Spare(uint): Reserved for definition by a regional authority. (field automatically set to "0")
  • dac(uint): Designated Area Code (field automatically set to "1")
  • fid(uint): Functional Identifier (field automatically set to "11")
  • Position_longitude(decimal): Location of the vessel East West location
  • Position_latitude(decimal): Location of the vessel North South location
  • datetime(uint): FIX: break hhmmss into subfields. Think it is 5 bits day, 5 bits hour, 6 bits min that match SLS.
  • avewind(uint): Average wind speed values for the last 10 minutes. FIX: why is 121-126 not valid???
  • windgust(uint): Wind gust is the max wind speed value reading during the last 10 minutes. FIX: why is 121-126 not valid???
  • winddir(uint): Wind direction. No idea if this is the latest, ave, median, etc. FIX: find out!
  • windgustdir(uint): Wind direction for the gust.
  • airtemp(decimal): Bry bulb temperature
  • relhumid(uint): Relative humidity
  • dewpoint(decimal): Bry bulb temperature - FIX: should this be a udecimal??
  • airpressure(udecimal): Air pressure. FIX: 9 bits only goes 0..511
  • airpressuretrend(uint): Air pressure trend
  • horizvis(udecimal): Horizontal visibility
  • waterlevel(decimal): Water level (incl. tide)
  • waterleveltrend(uint): Water level trend
  • surfcurspeed(udecimal): Surace current speed
  • surfcurdir(uint): Surface current direction
  • curspeed2(udecimal): Level 2 current speed
  • curdir2(uint): Level 2 current direction
  • curlevel2(uint): Measuring level below sea surface for level 2
  • curspeed3(udecimal): Level 3 current speed
  • curdir3(uint): Level 3 current direction
  • curlevel3(uint): Measuring level below sea surface for level 3
  • sigwaveheight(udecimal): Significan wave height
  • waveperiod(uint): Wave period - FIX: How does to fit to the power spectrum?
  • wavedir(uint): Wave direction - FIX: please define this better
  • swellheight(udecimal): Swell height
  • swellperiod(uint): Swell period - FIX: How does to fit to the power spectrum?
  • swelldir(uint): Swell direction - FIX: please define this better
  • seastate(uint): Sea state according to the Beaufort scale
  • watertemp(decimal): Water temp (FIX: at surface? Any requirements on how measured?)
  • preciptype(uint): According to WMO
  • salinity(decimal): Salinity - FIX: by what standard? Measured how?
  • ice(bool): Yes or no for the presence of ice. FIX: what types of ice constitute a yes??
  • Spare(uint): Must be zero. FIX: this does not seem slot aligned. (field automatically set to "0")
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, addCoastGuardFields=True, dbType='postgres')

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
  • addCoastGuardFields (bool) - Add the extra fields that come after the NMEA check some from the USCG N-AIS format
  • dbType - Which flavor of database we are using so that the create is tailored ('sqlite' or 'postgres')
Returns: str
sql create string

See Also: sqlCreate

sqlCreate(fields=None, extraFields=None, addCoastGuardFields=True, dbType='postgres')

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
  • addCoastGuardFields (bool) - Add the extra fields that come after the NMEA check some from the USCG N-AIS format
  • dbType - Which flavor of database we are using so that the create is tailored ('sqlite' or 'postgres')
Returns: sqlhelp.create
An object that can be used to generate a return

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

source code 
Return the SQL INSERT 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, dbType='postgres')

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???

latexDefinitionTable(outfile=sys.stdout)

source code 
Return the LaTeX definition table for this message type
Parameters:
  • outfile (file obj) - file like object to print to.
Returns: str
LaTeX table string via the outfile

testParams()

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

Variables Details [hide private]

fieldList

Value:
('MessageID',
 'RepeatIndicator',
 'UserID',
 'Spare',
 'dac',
 'fid',
 'Position_longitude',
 'Position_latitude',
...

fieldListPostgres

Value:
('MessageID',
 'RepeatIndicator',
 'UserID',
 'Spare',
 'dac',
 'fid',
 'Position_longitude',
 'Position_latitude',
...

RepeatIndicatorEncodeLut

Value:
{'default': '0', 'do not repeat any more': '3'}

RepeatIndicatorDecodeLut

Value:
{'0': 'default', '3': 'do not repeat any more'}

airpressuretrendEncodeLut

Value:
{'decreasing': '1',
 'increasing': '2',
 'steady': '0',
 'unavailable': '3'}

airpressuretrendDecodeLut

Value:
{'0': 'steady',
 '1': 'decreasing',
 '2': 'increasing',
 '3': 'unavailable'}

waterleveltrendEncodeLut

Value:
{'decreasing': '1',
 'increasing': '2',
 'steady': '0',
 'unavailable': '3'}

waterleveltrendDecodeLut

Value:
{'0': 'steady',
 '1': 'decreasing',
 '2': 'increasing',
 '3': 'unavailable'}

seastateEncodeLut

Value:
{'Calm': '0',
 'Fresh breeze': '5',
 'Gale': '8',
 'Gentle breeze': '3',
 'Hurricane': '12',
 'Light air': '1',
 'Light breeze': '2',
 'Moderate breeze': '4',
...

seastateDecodeLut

Value:
{'0': 'Calm',
 '1': 'Light air',
 '10': 'Storm',
 '11': 'Violent storm',
 '12': 'Hurricane',
 '15': 'unavailable',
 '2': 'Light breeze',
 '3': 'Gentle breeze',
...

preciptypeEncodeLut

Value:
{'FIX: find the WMO list of types': '0', 'unavailable': '7'}

preciptypeDecodeLut

Value:
{'0': 'FIX: find the WMO list of types', '7': 'unavailable'}