Humidity¶
-
class
Humidity(percent=0.0)[source]¶ Bases:
objectThe Humidity class implements a concept of a relative humidity in percent.
This version adapted from the c++ and java implementations, originall authored by Allen Farris.
Methods Summary
almostEquals(otherHumidity, toleranceHumidity)Return True if and only if otherHumidity and toleranceHumidity are both Humidity instances are if the absolute value of the difference between this and otherHumidity is less than the absolute value of toleranceHumidity.
compareTo(otherHumidity)Compare this Humidity to the specified otherHumidityt, which must be a Humidity, returning -1, 0, or +1 if this percent is less than, equal to, or greater than the specified other Humidity.
divide(a, factor)Return a new Humidity that is a specified percent divided by a specified factor, a / factor.
equals(otherHumidity)Return True if and only if the specified other humidity is a Humidity and its value is equal to this percent.
from1DBin(eis)Read a list of binary Humidity values, in percent, from an EndianInput instance and return the resulting list.
from2DBin(eis)Read a 2D list of binary Humidity values, in percent, from an EndianInput instance and return the resulting list.
from3DBin(eis)Read a 3D list of binary Humidity values, in percent, from an EndianInput instance and return the resulting list.
fromBin(eis)Read the binary representation of an Humidity, in percent, from an EndianInput instance and use the read value to set a Humidity.
get()Return the value of this percent in percents.
getInstance(stringList)Retrieve a value from a list of strings and convert that to a Humidity.
isZero()Return True if and only if this percent is zero (0.0).
listTo1DBin(humidityList, eos)Write a 1D list of Humidity to the EndianOutput
listTo2DBin(humidityList, eos)Write a 2D list of Humidity to the EndianOutput
listTo3DBin(humidityList, eos)Write a 3D list of Humidity to the EndianOutput
listToBin(humidityList, eos)Write a list of Humidity to the EndianOutput.
multiply(a, factor)Return a new Humidity that is the product of a specified percent and some specified factor, a * factor.
set(percent)Set the value of this percent to the specified percent in percents.
subtract(a, b)Return a new Humidity that is the difference of the specified percents, a - b.
sum(a, b)Return a new Humidity that is the sum of the specified percents, a + b.
toBin(eos)Write this Humidity out, in percent, to a EndianOutput.
values(items)return a list of floats containing the value of the list of Humidity objects passed in the items argument.
Methods Documentation
-
almostEquals(otherHumidity, toleranceHumidity)[source]¶ Return True if and only if otherHumidity and toleranceHumidity are both Humidity instances are if the absolute value of the difference between this and otherHumidity is less than the absolute value of toleranceHumidity.
-
compareTo(otherHumidity)[source]¶ Compare this Humidity to the specified otherHumidityt, which must be a Humidity, returning -1, 0, or +1 if this percent is less than, equal to, or greater than the specified other Humidity.
-
static
divide(a, factor)[source]¶ Return a new Humidity that is a specified percent divided by a specified factor, a / factor. param a The base percent param factor The factor that is used to divide the value. return A new Humidity that is the product of a specified percent and some specified factor, a / factor.
-
equals(otherHumidity)[source]¶ Return True if and only if the specified other humidity is a Humidity and its value is equal to this percent. param otherHumidity The other humidity to which this humidity is being compared. return True if and only if the specified other humidity is an Humidity and its value is equal to this humidity.
-
static
from1DBin(eis)[source]¶ Read a list of binary Humidity values, in percent, from an EndianInput instance and return the resulting list.
-
static
from2DBin(eis)[source]¶ Read a 2D list of binary Humidity values, in percent, from an EndianInput instance and return the resulting list.
-
static
from3DBin(eis)[source]¶ Read a 3D list of binary Humidity values, in percent, from an EndianInput instance and return the resulting list.
-
static
fromBin(eis)[source]¶ Read the binary representation of an Humidity, in percent, from an EndianInput instance and use the read value to set a Humidity.
return an Humidity
-
static
getInstance(stringList)[source]¶ Retrieve a value from a list of strings and convert that to a Humidity.
This is used when parsing Humidity lists from an XML representation to eventually construct a list of Humidity instances. The string values are float representation of a relative humidity in percent.
Returns a tuple of (Humidity, stringList) where Humidity is the new Humidity created by this call and stringList is the remaining, unused, part of stringList after removing the first element.
-
static
listToBin(humidityList, eos)[source]¶ Write a list of Humidity to the EndianOutput. The list may have 1, 2 or 3 dimensions.
-
static
multiply(a, factor)[source]¶ Return a new Humidity that is the product of a specified percent and some specified factor, a * factor. param a The base percent param factor The factor that is used to multiply the value. return A new Humidity that is the product of a specified percent and some specified factor, a * factor.
-
set(percent)[source]¶ Set the value of this percent to the specified percent in percents. Any value is valid so long as it can be converted into a float using float(percent) (including a parseable string).
-
static
subtract(a, b)[source]¶ Return a new Humidity that is the difference of the specified percents, a - b. param a The first Humidity of the pair. param b The second Humidity of the pair. return A new Humidity that is the difference of the specified hectopascals, a - b.
-
static
sum(a, b)[source]¶ Return a new Humidity that is the sum of the specified percents, a + b. param a The first Humidity of the pair. param b The second Humidity of the pair. return A new Humidity that is the sum of the specified hectopascals, a + b.
-
static
values(items)[source]¶ return a list of floats containing the value of the list of Humidity objects passed in the items argument. items may also be a list of lists(2D array) of Humidity objects. If the first item is a list then this method assumes that items is a list of lists and the return value is a list of lists of floats. The list of lists case is done by calling this method recursively and so it should work for higher orders of lists of lists. That use case is not tested.
-