Pressure

class Pressure(value=0.0)[source]

Bases: object

The Pressure class implements a concept of an atmospheric pressure in hectopascals.

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

Methods Summary

almostEquals(otherPressure, tolerancePressure)

Return True if and only if otherPressure and tolerancePressure are both Pressure instances are if the absolute value of the difference between this and otherPressure is less than the absolute value of tolerancePressure.

compareTo(otherPressure)

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

divide(a, factor)

Return a new Pressure that is a specified pressure divided by a specified factor, a / factor.

equals(otherPressure)

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

from1DBin(eis)

Read a list of binary Pressure values, in hectopascals, from an EndianInput instance and return the resulting list.

from2DBin(eis)

Read a 2D list of binary Pressure values, in hectopascals, from an EndianInput instance and return the resulting list.

from3Dbin(eis)

Read a 3D list of binary Pressure values, in hectopascals, from an EndianInput instance and return the resulting list.

fromBin(eis)

Read the binary representation of an Pressure, in hectopascals, from an EndianInput instance and use the read value to set a Pressure.

get()

Return the value of this pressure as a double in hectopascals.

getInstance(stringList)

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

isZero()

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

listTo1DBin(pressureList, eos)

Write a 1D list of Pressure to the EndianOutput

listTo2DBin(pressureList, eos)

Write a 2D list of Pressure to the EndianOutput

listTo3DBin(pressureList, eos)

Write a 3D list of Pressure to the EndianOutput

listToBin(pressureList, eos)

Write a list of Pressure to the EndianOutput.

multiply(a, factor)

Return a new Pressure that is the product of a specified pressure and some specified factor, a * factor.

set(value)

Set the value of this pressure to the specified value in hectopascals.

subtract(a, b)

Return a new Pressure that is the difference of the specified hectopascals, a - b.

sum(a, b)

Return a new Pressure that is the sum of the specified hectopascals, a + b.

toBin(eos)

Write this Pressure out, in hectopascals, to a EndianOutput.

values(items)

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

Methods Documentation

almostEquals(otherPressure, tolerancePressure)[source]

Return True if and only if otherPressure and tolerancePressure are both Pressure instances are if the absolute value of the difference between this and otherPressure is less than the absolute value of tolerancePressure.

compareTo(otherPressure)[source]

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

static divide(a, factor)[source]

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

equals(otherPressure)[source]

Return True if and only if the specified other pressure is a Pressure and its value is equal to this pressure. param otherPressure The other pressure to which this pressure is being compared. return True if and only if the specified other pressure is an Pressure and its value is equal to this pressure.

static from1DBin(eis)[source]

Read a list of binary Pressure values, in hectopascals, from an EndianInput instance and return the resulting list.

static from2DBin(eis)[source]

Read a 2D list of binary Pressure values, in hectopascals, from an EndianInput instance and return the resulting list.

static from3Dbin(eis)[source]

Read a 3D list of binary Pressure values, in hectopascals, from an EndianInput instance and return the resulting list.

static fromBin(eis)[source]

Read the binary representation of an Pressure, in hectopascals, from an EndianInput instance and use the read value to set a Pressure.

return an Pressure

get()[source]

Return the value of this pressure as a double in hectopascals.

static getInstance(stringList)[source]

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

This is used when parsing Pressure lists from an XML representation to eventually construct a list of Pressure instances. The string values are float representation of a pressure in hectopascals.

Returns a tuple of (Pressure, stringList) where Pressure is the new Pressure 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 pressure is zero (0.0).

static listTo1DBin(pressureList, eos)[source]

Write a 1D list of Pressure to the EndianOutput

static listTo2DBin(pressureList, eos)[source]

Write a 2D list of Pressure to the EndianOutput

static listTo3DBin(pressureList, eos)[source]

Write a 3D list of Pressure to the EndianOutput

static listToBin(pressureList, eos)[source]

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

static multiply(a, factor)[source]

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

set(value)[source]

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

static subtract(a, b)[source]

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

static sum(a, b)[source]

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

toBin(eos)[source]

Write this Pressure out, in hectopascals, to a EndianOutput.

static values(items)[source]

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