pyCAPS
pyCAPS: A Python Extension Module for CAPS
|
Python extension module for CAPS. More...
Classes | |
class | _capsAnalysis |
Functions to interact with a CAPS analysis object. More... | |
class | _capsBound |
Functions to interact with a CAPS bound object. More... | |
class | _capsDataSet |
Functions to interact with a CAPS dataSet object. More... | |
class | _capsGeometry |
Functions to interact with a CAPS geometry object. More... | |
class | _capsValue |
Functions to interact with a CAPS value object. More... | |
class | _capsVertexSet |
Functions to interact with a CAPS vertexSet object. More... | |
class | CAPSError |
CAPS error exception class. More... | |
class | capsProblem |
Defines a CAPS problem object. More... | |
class | capsViewer |
Defines a CAPS viewer object. More... | |
Functions | |
def | capsConvert (value, fromUnits, toUnits, ignoreWarning=True) |
Convert a value from one unit to another using the UDUNITS-2 library. More... | |
Python extension module for CAPS.
def pyCAPS.capsConvert | ( | value, | |
fromUnits, | |||
toUnits, | |||
ignoreWarning = True |
|||
) |
Convert a value from one unit to another using the UDUNITS-2 library.
See units.py for example use cases. Note that UDUNITS-2 is packaged with CAPS, so no additional dependencies are necessary. Please refer to the UDUNITS-2 documentation for specifics regarding the syntax for valid unit strings, UDUNITS-2 Manual or NIST Units. The following table was taken from the UDUNITS-2 manual to assist in some of the unit specifications.
String Type | Using Names | Using Symbols | Comment |
---|---|---|---|
Simple | meter | m | |
Raised | meter^2 | m2 | higher precedence than multiplying or dividing |
Product | newton meter | N.m | |
Quotient | meter per second | m/s | |
Scaled | 60 second | 60 s | |
Prefixed | kilometer | km | |
Offset | kelvin from 273.15 | K @ 273.15 | lower precedence than multiplying or dividing |
Logarithmic | lg(re milliwatt) | lg(re mW) | "lg" is base 10, "ln" is base e, and "lb" is base 2 |
Grouped | (5 meter)/(30 second) | (5 m)/(30 s) |
value | Input value to convert. Value may be an integer, float/double, or list of integers and floats/doubles. Note that integers are automatically cast to floats/doubles |
fromUnits | Current units of the input value (see [UDUNITS-2 Manual] for valid string). |
toUnits | Desired units to convert the input value to (see [UDUNITS-2 Manual] for valid string). |
ignoreWarning | Ignore UDUNITS verbose warnings (default - True). Errors during unit conversions are still reported. |
TypeError | Wrong type [float(s)/double(s)/integer(s)] for value or non-string value for from/to-Units. |
ValueError | Error during unit conversion. See raised message for additional details. |