Speed

class Speed(speed=0.0)[source]

Bases: object

The Speed class implements a concept of an atmospheric speed in meters per second.

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

Methods Summary

almostEquals(otherSpeed, toleranceSpeed)

Return True if and only if otherSpeed and toleranceSpeed are both Speed instances are if the absolute value of the difference between this and otherSpeed is less than the absolute value of toleranceSpeed.

compareTo(otherSpeed)

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

divide(a, factor)

Return a new Speed that is a specified speed divided by a specified factor, a / factor.

equals(otherSpeed)

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

from1DBin(eis)

Read a list of binary Speed values, in meters per second, from an EndianInput instance and return the resulting list.

from2DBin(eis)

Read a 2D list of binary Speed values, in meters per second, from an EndianInput instance and return the resulting list.

from3Dbin(eis)

Read a 3D list of binary Speed values, in meters per second, from an EndianInput instance and return the resulting list.

fromBin(eis)

Read the binary representation of an Speed, in meters per second, from an EndianInput instance and use the read value to set a Speed.

get()

Return the value of this speed as a double in meters per second.

getInstance(stringList)

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

isZero()

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

listTo1DBin(speedList, eos)

Write a 1D list of Speed to the EndianOutput

listTo2DBin(speedList, eos)

Write a 2D list of Speed to the EndianOutput

listTo3DBin(speedList, eos)

Write a 3D list of Speed to the EndianOutput

listToBin(speedList, eos)

Write a list of Speed to the EndianOutput.

multiply(a, factor)

Return a new Speed that is the product of a specified speed and some specified factor, a * factor.

set(speed)

Set the value of this speed to the specified speed in meters per second.

subtract(a, b)

Return a new Speed that is the difference of the specified Speeds, a - b.

sum(a, b)

Return a new Speed that is the sum of the specified Speeds, a + b.

toBin(eos)

Write this Speed out, in meters per second, to a EndianOutput.

values(items)

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

Methods Documentation

almostEquals(otherSpeed, toleranceSpeed)[source]

Return True if and only if otherSpeed and toleranceSpeed are both Speed instances are if the absolute value of the difference between this and otherSpeed is less than the absolute value of toleranceSpeed.

compareTo(otherSpeed)[source]

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

static divide(a, factor)[source]

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

equals(otherSpeed)[source]

Return True if and only if the specified other speed is a Speed and its value is equal to this speed. param otherSpeed The other speed to which this speed is being compared. return True if and only if the specified other speed is an Speed and its value is equal to this speed.

static from1DBin(eis)[source]

Read a list of binary Speed values, in meters per second, from an EndianInput instance and return the resulting list.

static from2DBin(eis)[source]

Read a 2D list of binary Speed values, in meters per second, from an EndianInput instance and return the resulting list.

static from3Dbin(eis)[source]

Read a 3D list of binary Speed values, in meters per second, from an EndianInput instance and return the resulting list.

static fromBin(eis)[source]

Read the binary representation of an Speed, in meters per second, from an EndianInput instance and use the read value to set a Speed.

return an Speed

get()[source]

Return the value of this speed as a double in meters per second.

static getInstance(stringList)[source]

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

This is used when parsing Speed lists from an XML representation to eventually construct a list of Speed instances. The string values are float representation of a speed in meters per second.

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

static listTo1DBin(speedList, eos)[source]

Write a 1D list of Speed to the EndianOutput

static listTo2DBin(speedList, eos)[source]

Write a 2D list of Speed to the EndianOutput

static listTo3DBin(speedList, eos)[source]

Write a 3D list of Speed to the EndianOutput

static listToBin(speedList, eos)[source]

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

static multiply(a, factor)[source]

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

set(speed)[source]

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

static subtract(a, b)[source]

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

static sum(a, b)[source]

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

toBin(eos)[source]

Write this Speed out, in meters per second, to a EndianOutput.

static values(items)[source]

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