Temperature

class Temperature(temperature=0.0)[source]

Bases: object

The Temperature class implements a concept of a temperature in degrees Centigrade.

This version adapted from the c++ and java implementations, originall authored by Allen Farris.

Methods Summary

almostEquals(otherTemperature, …)

Return True if and only if otherTemperature and toleranceTemperature are both Temperature instances are if the absolute value of the difference between this and otherTemperature is less than the absolute value of toleranceTemperature.

compareTo(otherTemperature)

Compare this Temperature to the specified otherTemperature, which must be a Temperature, returning -1, 0, or +1 if this temperature is less than, equal to, or greater than the specified other Temperature.

divide(a, factor)

Return a new Temperature that is a specified temperature divided by a specified factor, a / factor.

equals(otherTemperature)

Return True if and only if the specified other temperature is a Temperature and its value is equal to this temperature.

from1DBin(eis)

Read a list of binary Temperature values, in degrees Centigrade, from an EndianInput instance and return the resulting list.

from2DBin(eis)

Read a 2D list of binary Temperature values, in degrees Centigrade, from an EndianInput instance and return the resulting list.

from3Dbin(eis)

Read a 3D list of binary Temperature values, in degrees Centigrade, from an EndianInput instance and return the resulting list.

fromBin(eis)

Read the binary representation of an Temperature, in degrees Centigrade, from an EndianInput instance and use the read value to set a Temperature.

get()

Return the value of this temperature as a double in degrees Centigrade.

getInstance(stringList)

Retrieve a value from a list of strings and convert that to a Temperature

isZero()

Return True if and only if this temperature is zero (0.0).

listTo1DBin(temperatureList, eos)

Write a 1D list of Temperature to the EndianOutput

listTo2DBin(temperatureList, eos)

Write a 2D list of Temperature to the EndianOutput

listTo3DBin(temperatureList, eos)

Write a 3D list of Temperature to the EndianOutput

listToBin(temperatureList, eos)

Write a list of Temperature to the EndianOutput.

multiply(a, factor)

Return a new Temperature that is the product of a specified temperature and some specified factor, a * factor.

set(temperature)

Set the value of this temperature to the specified temperature in degrees Centigrade Any temperature is valid so long as it can be converted into a float using float(temperature) (including a parseable string).

subtract(a, b)

Return a new Temperature that is the difference of the specified temperatures, a - b.

sum(a, b)

Return a new Temperature that is the sum of the specified temperatures, a + b.

toBin(eos)

Write this Temperature out, in degrees Centigrade, to a EndianOutput.

values(items)

return a list of floats containing the value of the list of Temperature objects passed in the items argument.

Methods Documentation

almostEquals(otherTemperature, toleranceTemperature)[source]

Return True if and only if otherTemperature and toleranceTemperature are both Temperature instances are if the absolute value of the difference between this and otherTemperature is less than the absolute value of toleranceTemperature.

compareTo(otherTemperature)[source]

Compare this Temperature to the specified otherTemperature, which must be a Temperature, returning -1, 0, or +1 if this temperature is less than, equal to, or greater than the specified other Temperature.

static divide(a, factor)[source]

Return a new Temperature that is a specified temperature divided by a specified factor, a / factor. param a The base temperature param factor The factor that is used to divide the value. return A new Temperature that is the product of a specified temperature and some specified factor, a / factor.

equals(otherTemperature)[source]

Return True if and only if the specified other temperature is a Temperature and its value is equal to this temperature. param otherTemperature The other temperature to which this temperature is being compared. return True if and only if the specified other temperature is an Temperature and its value is equal to this temperature.

static from1DBin(eis)[source]

Read a list of binary Temperature values, in degrees Centigrade, from an EndianInput instance and return the resulting list.

static from2DBin(eis)[source]

Read a 2D list of binary Temperature values, in degrees Centigrade, from an EndianInput instance and return the resulting list.

static from3Dbin(eis)[source]

Read a 3D list of binary Temperature values, in degrees Centigrade, from an EndianInput instance and return the resulting list.

static fromBin(eis)[source]

Read the binary representation of an Temperature, in degrees Centigrade, from an EndianInput instance and use the read value to set a Temperature.

return an Temperature

get()[source]

Return the value of this temperature as a double in degrees Centigrade.

static getInstance(stringList)[source]

Retrieve a value from a list of strings and convert that to a Temperature

This is used when parsing Temperature lists from an XML representation to eventually construct a list of Temperature instances. The string values are float representation of an angular rate in radians per second.

Returns a tuple of (Temperature, stringList) where Temperature is the new Temperature created by this call and stringList is the remaining, unused, part of stringList after removing the first element.

isZero()[source]

Return True if and only if this temperature is zero (0.0).

static listTo1DBin(temperatureList, eos)[source]

Write a 1D list of Temperature to the EndianOutput

static listTo2DBin(temperatureList, eos)[source]

Write a 2D list of Temperature to the EndianOutput

static listTo3DBin(temperatureList, eos)[source]

Write a 3D list of Temperature to the EndianOutput

static listToBin(temperatureList, eos)[source]

Write a list of Temperature to the EndianOutput. The list may have 1, 2 or 3 dimensions.

static multiply(a, factor)[source]

Return a new Temperature that is the product of a specified temperature and some specified factor, a * factor. param a The base temperature param factor The factor that is used to multiply the value. return A new Temperature that is the product of a specified temperature and some specified factor, a * factor.

set(temperature)[source]

Set the value of this temperature to the specified temperature in degrees Centigrade Any temperature is valid so long as it can be converted into a float using float(temperature) (including a parseable string).

static subtract(a, b)[source]

Return a new Temperature that is the difference of the specified temperatures, a - b. param a The first Temperature of the pair. param b The second Temperature of the pair. return A new Temperature that is the difference of the specified temperatures, a - b.

static sum(a, b)[source]

Return a new Temperature that is the sum of the specified temperatures, a + b. param a The first Temperature of the pair. param b The second Temperature of the pair. return A new Temperature that is the sum of the specified temperatures, a + b.

toBin(eos)[source]

Write this Temperature out, in degrees Centigrade, to a EndianOutput.

static values(items)[source]

return a list of floats containing the value of the list of Temperature objects passed in the items argument. items may also be a list of lists(2D array) of Temperature 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.