pyCAPS
pyCAPS: A Python Extension Module for CAPS
Classes | Functions
pyCAPS Namespace Reference

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

Detailed Description

Python extension module for CAPS.

Function Documentation

◆ capsConvert()

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 meterN.m
Quotientmeter per second m/s
Scaled 60 second 60 s
Prefixedkilometer 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)
Parameters
valueInput 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
fromUnitsCurrent units of the input value (see [UDUNITS-2 Manual] for valid string).
toUnitsDesired units to convert the input value to (see [UDUNITS-2 Manual] for valid string).
ignoreWarningIgnore UDUNITS verbose warnings (default - True). Errors during unit conversions are still reported.
Returns
Return the input value(s) in the specified units.
Exceptions
TypeErrorWrong type [float(s)/double(s)/integer(s)] for value or non-string value for from/to-Units.
ValueErrorError during unit conversion. See raised message for additional details.