Units¶
All unit types share a common interface. They can be constructed from numeric values, compared and combined with other units of the same physical dimension, and are implicitly converted to SI base units when passed to functions.
Note
All unit types have the same interface, so only as huira.Meter is shown for reference.
- class huira.Meter¶
Meter unit.
Supports arithmetic with other units of the same dimension. Implicit conversion to SI base unit when passed to functions.
Example
>>> x = huira.Meter(1.0) >>> x.to_si()
- __init__(*args, **kwargs)¶
Overloaded function.
__init__(self: huira._huira.Meter) -> None
Default constructor (value = 0).
__init__(self: huira._huira.Meter, value: float) -> None
Create a Meter from a float.
__init__(self: huira._huira.Meter, value: int) -> None
Create a Meter from an int.
__init__(self: huira._huira.Meter, value: float) -> None
Create a Meter from a float.
- raw_value(self: huira._huira.Meter) float¶
Return the raw value in this unit’s scale.
- to_si(self: huira._huira.Meter) float¶
Return the value converted to SI base units (returns float).
Available Units¶
Dimension |
Types |
SI Base Unit |
|---|---|---|
Distance |
Kilometer, Meter, Centimeter, Millimeter, Micrometer, Nanometer, Foot, Yard, Mile, AstronomicalUnit |
Meter |
Mass |
Kilogram, Gram, Milligram |
Kilogram |
Time |
Second, Millisecond, Microsecond, Nanosecond, Femtosecond, Minute, Hour, Day, SiderealDay |
Second |
Temperature |
Kelvin, Celsius, Fahrenheit |
Kelvin |
Angle |
Radian, Degree, ArcMinute, ArcSecond |
Radian |
Solid Angle |
Steradian, SquareDegree |
Steradian |
OpticalPower |
Diopter, Millidiopter, Microdiopter |
Diopter |
Speed |
MetersPerSecond, KilometersPerSecond, MilesPerHour, KilometersPerHour |
MetersPerSecond |
Angular Rate |
RadiansPerSecond |
DegreesPerSecond |
Frequency |
Hertz, KiloHertz, MegaHertz, GigaHertz, TeraHertz |
Hertz |
Force |
Newton, KiloNewton |
Newton |
Pressure |
Pascal, Kilopascal |
Pascal |
Energy |
Joule, Kilojoule, Megajoule, ElectronVolt |
Joule |
Area |
SquareMeter, SquareCentimeter, SquareMillimeter |
SquareMeter |
Power |
Watt, Kilowatt, Megawatt, Gigawatt |
Watt |
Current |
Ampere |
Ampere |
Charge |
Coulomb |
Coulomb |
Luminous Intensity |
Candela |
Candela |
Luminous Flux |
Lumen |
Lumen |
Radiometric |
WattsPerMeterSquaredSteradian, WattsPerMeterSquared, WattsPerSteradian |
(SI derived) |