Table of Contents

Class: MadrigalKindat metadata.py

MadrigalKindat is an object that provides access to Madrigal kind of data info from the metadata.

This object provides access to all Madrigal kind of data information in the metadata file typeTab.txt.

Usage example:

        import madrigal.metadata
        import madrigal.admin

        try:

            test = madrigal.metadata.MadrigalKindat()

            print test.getKindatDescription(3001)

        except madrigal.admin.MadrigalError, e:

            print e.getExceptionStr()

Non-standard Python modules used: None

MadrigalError exception thrown if:

  1. MadrigalMetadata fails to open or parse metadata file

  2. Columns expected to be ints or floats cannot be converted

Change history:

Written by Bill Rideout Nov. 9, 2001

Methods   
__init__
getKindatDescription
getKindatList
  __init__ 
__init__ (
        self,
        madDB=None,
        initFile=None,
        )

__init__ initializes MadrigalKindat by reading from typeTab.txt (or initFile).

Inputs: Existing MadrigalDB object, by default = None.

String representing the full path to the metadata file. Default is None, in which case file read is MadrigalDB.getMetadataDir()/typeTab.txt.

Returns: void

Affects: Initializes all the class member variables.

Exceptions: MadrigalError thrown by MadrigalMetadata if file not opened or parsed successfully.

  getKindatDescription 
getKindatDescription ( self,  code )

getKindatDescription returns the kindat description that matches code argument, or None if not found.

Inputs: code integer to get kindat description.

Returns: the kindat description that matches code argument, or None if not found.

Affects: None

Exceptions: MadrigalError if any item in row cannot be cast to correct format

Exceptions   
madrigal.admin.MadrigalError('Error in typeTab.txt parsing metadata row: ' + str( type ), traceback.format_exception(sys.exc_info() [ 0 ], sys.exc_info() [ 1 ], sys.exc_info() [ 2 ] ) )
  getKindatList 
getKindatList ( self )

getKindatList returns a list of all kindat descriptions and codes.

Inputs: None.

Returns: a list of all kindat descriptions and codes. Each item in the list is a tuple of the form (Kindat description (string), kindat code (integer)). Example item: (INSCAL Basic Derived Parameters, 3001)

Affects: None

Exceptions: MadrigalError if any item in row cannot be cast to correct format

Exceptions   
madrigal.admin.MadrigalError('Error in typeTab.txt parsing metadata row: ' + str( kindat ), traceback.format_exception(sys.exc_info() [ 0 ], sys.exc_info() [ 1 ], sys.exc_info() [ 2 ] ) )

Table of Contents

This document was automatically generated on Fri Dec 30 08:58:50 2005 by HappyDoc version r1_5