cedar is the module that allows the creation and editting of Cedar (and possible future format) files.
This module abstracts away many of the details of the Cedar file format, which may change in the future,
and instead simply follows the Cedar data model (Prolog-1d parms-2d parms). For example, all values are accessed and set via doubles, so
users do not need to deal with scale factors, "additional increment" parameters, etc. The Cedar file format has
limited dynamic range, so for now an exception is raised if any value would voilate this limited range. Furthermore,
the Cedar data model defines time in the prolog. Unfortunately, time may also be set in the data itself, leading
to the possibility of inconsistent data. This module will issue warnings in that case.
This module is built on top of the Madrigal C API as found in libmadrec.so through the python
extension class __Madrec
$Id: cedar.py.html 3304 2011-01-17 15:25:59Z brideout $
Functions
|
|
compareParms
floatEquals
floatIn
isNan
setToMissing
|
|
compareParms
|
compareParms ( firstParm, secondParm )
compareParms is used internally by getHeaderKodLines to order the parameters
Inputs:
firstParm - tuple of (code, parameter description, scaleFactor, units) for
the first parameter
secondParm - tuple of (code, parameter description, scaleFactor, units) for
the second parameter
Returns - -1 if first<second, 0 if first=second, 1 if first>second. First compare
abs(code). If equal, positive smaller than negative to make error follow
main parm.
|
|
floatEquals
|
floatEquals ( first, second )
floatEquals is a method to replace == for comparing two floats. Two floats are equal if
they are equal to one part in 10^5
|
|
floatIn
|
floatIn ( testFloat, floatList )
floatIn returns True if thisFloat in floatList, where equals defined by floatEquals
|
|
isNan
|
isNan ( num )
isNan is my attempt to detect IEEE special values such as nan. Returns True if not a float with a
real value. Works with both python 2.3 and python 2.4
Algorithm: if both (num < 10.0) and (num > -10.0) are False, return true.
|
|
setToMissing
|
setToMissing ( x )
a private method to generate default data
|
Classes
|
|
CatalogHeaderCreator | CatalogHeaderCreator is a class that automates the creation of catalog and header records
|
CedarParameter | CedarParameter is a class with attributes code, mnemonic, and description
|
MadrigalCatalogRecord | MadrigalCatalogRecord holds all the information in a Cedar catalog record.
|
MadrigalCedarFile | MadrigalCedarFile is an object that allows the creation and editting of Cedar files.
|
MadrigalDataRecord | MadrigalDataRecord holds all the information in a Cedar data record.
|
MadrigalHeaderRecord | MadrigalHeaderRecord holds all the information in a Cedar header record.
|
|
|