PySharp Units of Measure
Units of Measure in Python
|
A MeasurementSystem is a collection of units of measure that have a linear relationship to each other: y = ax + b where x is the unit to be converted, y is the converted unit, a is the scaling factor and b is the offset. More...
Public Member Functions | |
def | __init__ (self) |
def | primeUomCache (self) |
def | getUOM (self, unit) |
Get the unit of measure with this unique enumerated type. More... | |
def | getOne (self) |
def | createScalarUOM (self, unitType, unit, name, symbol, description) |
Create a unit of measure that is not a power, product or quotient. More... | |
def | createBaseSIUnit (self, unit) |
def | createSIUnit (self, unit) |
def | createCustomaryUnit (self, unit) |
def | createUSUnit (self, unit) |
def | createBRUnit (self, unit) |
def | createFinancialUnit (self, unit) |
def | createUOMForUnit (self, unit) |
def | getQuantity (self, constant) |
Get the quantity defined as a constant value. More... | |
def | createPowerUOM (self, unitType, unit, name, symbol, description, base, exponent) |
Create a unit of measure with a base raised to an integral power. More... | |
def | createUnclassifiedPowerUOM (self, base, exponent) |
Create an anonymous unit of measure with a base raised to an integral power. More... | |
def | createProductUOM (self, unitType, unit, name, symbol, description, multiplier, multiplicand) |
Create a unit of measure that is the product of two other units of measure. More... | |
def | createUnclassifiedProductUOM (self, multiplier, multiplicand) |
Create an anonymous unit of measure that is the product of two other units of measure. More... | |
def | createUnclassifiedQuotientUOM (self, dividend, divisor) |
Create a unit of measure that is a UOM divided by another UOM. More... | |
def | createQuotientUOM (self, unitType, unit, name, symbol, description, dividend, divisor) |
Create a unit of measure that is a UOM divided by another UOM. More... | |
def | createUOM (self, unitType, unit, name, symbol, description) |
def | getSecond (self) |
def | getMinute (self) |
def | getHour (self) |
def | getDay (self) |
def | getRegisteredUOMs (self) |
Get all units currently cached by this measurement system. More... | |
def | getUnitsOfMeasure (self, unitType) |
Get all the units of measure of the specified type. More... | |
def | getUOMBySymbol (self, symbol) |
def | createPrefixedUOM (self, prefix, uom) |
Create a unit of measure linearly scaled by the Prefix against the target unit of measure. More... | |
def | quantityFromPrefixedUnit (self, amount, prefix, unit) |
def | quantityFromUnit (self, amount, unit) |
def | quantityFromStringUnit (self, strAmount, unit) |
def | convertQuantityToUnit (self, quantity, unit) |
Convert this quantity to the target unit. More... | |
def | convertQuantityToPrefixUnit (self, quantity, prefix, unit) |
Convert this quantity to the target unit with the specified prefix. More... | |
def | quantityToPower (self, quantity, exponent) |
Raise this quantity to the specified power. More... | |
Static Public Member Functions | |
def | instance () |
def | getUOMKey (uom) |
Static Public Attributes | |
unifiedSystem = None | |
A MeasurementSystem is a collection of units of measure that have a linear relationship to each other: y = ax + b where x is the unit to be converted, y is the converted unit, a is the scaling factor and b is the offset.
See
The MeasurementSystem class creates:
def uom.measurement_system.MeasurementSystem.convertQuantityToPrefixUnit | ( | self, | |
quantity, | |||
prefix, | |||
unit | |||
) |
def uom.measurement_system.MeasurementSystem.convertQuantityToUnit | ( | self, | |
quantity, | |||
unit | |||
) |
def uom.measurement_system.MeasurementSystem.createPowerUOM | ( | self, | |
unitType, | |||
unit, | |||
name, | |||
symbol, | |||
description, | |||
base, | |||
exponent | |||
) |
Create a unit of measure with a base raised to an integral power.
unitType | UnitType |
unit | Unit |
name | Name of unit of measure |
symbol | Symbol (must be unique) |
description | Description of unit of measure |
base | UnitOfMeasure |
exponent | Exponent |
def uom.measurement_system.MeasurementSystem.createPrefixedUOM | ( | self, | |
prefix, | |||
uom | |||
) |
Create a unit of measure linearly scaled by the Prefix against the target unit of measure.
prefix | Prefix Scaling prefix with the scaling factor, e.g. 1000 |
uom | abscissa UnitOfMeasure |
def uom.measurement_system.MeasurementSystem.createProductUOM | ( | self, | |
unitType, | |||
unit, | |||
name, | |||
symbol, | |||
description, | |||
multiplier, | |||
multiplicand | |||
) |
Create a unit of measure that is the product of two other units of measure.
unitType | UnitType |
unit | Unit |
name | Name of unit of measure |
symbol | Symbol (must be unique) |
description | Description of unit of measure |
multiplier | UnitOfMeasure multiplier |
multiplicand | UnitOfMeasure multiplicand |
def uom.measurement_system.MeasurementSystem.createQuotientUOM | ( | self, | |
unitType, | |||
unit, | |||
name, | |||
symbol, | |||
description, | |||
dividend, | |||
divisor | |||
) |
Create a unit of measure that is a UOM divided by another UOM.
unitType | UnitType |
unit | Unit |
name | Name of unit of measure |
symbol | Symbol (must be unique) |
description | Description of unit of measure |
dividend | UnitOfMeasure |
divisor | UnitOfMeasure |
def uom.measurement_system.MeasurementSystem.createScalarUOM | ( | self, | |
unitType, | |||
unit, | |||
name, | |||
symbol, | |||
description | |||
) |
Create a unit of measure that is not a power, product or quotient.
unitType | UnitType |
unit | Unit |
name | Name of unit of measure |
symbol | Symbol (must be unique) |
description | Description of unit of measure |
def uom.measurement_system.MeasurementSystem.createUnclassifiedPowerUOM | ( | self, | |
base, | |||
exponent | |||
) |
Create an anonymous unit of measure with a base raised to an integral power.
base | UnitOfMeasure |
exponent | Exponent |
def uom.measurement_system.MeasurementSystem.createUnclassifiedProductUOM | ( | self, | |
multiplier, | |||
multiplicand | |||
) |
Create an anonymous unit of measure that is the product of two other units of measure.
multiplier | UnitOfMeasure multiplier |
multiplicand | UnitOfMeasure multiplicand |
def uom.measurement_system.MeasurementSystem.createUnclassifiedQuotientUOM | ( | self, | |
dividend, | |||
divisor | |||
) |
Create a unit of measure that is a UOM divided by another UOM.
dividend | UnitOfMeasure |
divisor | UnitOfMeasure |
def uom.measurement_system.MeasurementSystem.getQuantity | ( | self, | |
constant | |||
) |
def uom.measurement_system.MeasurementSystem.getRegisteredUOMs | ( | self | ) |
Get all units currently cached by this measurement system.
def uom.measurement_system.MeasurementSystem.getUnitsOfMeasure | ( | self, | |
unitType | |||
) |
Get all the units of measure of the specified type.
unitType | UnitType |
def uom.measurement_system.MeasurementSystem.getUOM | ( | self, | |
unit | |||
) |
def uom.measurement_system.MeasurementSystem.quantityToPower | ( | self, | |
quantity, | |||
exponent | |||
) |
Raise this quantity to the specified power.
quantity | Quantity |
exponent | Exponent |