stdatm.atmosphere module

Simple implementation of International Standard Atmosphere.

class stdatm.atmosphere.Atmosphere(altitude: Union[float, Sequence[float]], delta_t: Union[float, Sequence[float]] = 0.0, altitude_in_feet: bool = True)[source]

Bases: object

Simple implementation of International Standard Atmosphere for troposphere and stratosphere.

Atmosphere properties are provided in the same “shape” as provided altitude:

  • if altitude is given as a float, returned values will be floats

  • if altitude is given as a sequence (list, 1D numpy array, …), returned values will be 1D numpy arrays

  • if altitude is given as nD numpy array, returned values will be nD numpy arrays

Usage:

Also, after instantiating this class, setting one speed parameter allows to get value of other ones. Provided speed values should have a shape compatible with provided altitudes.

>>> atm1 = Atmosphere(30000)
>>> atm1.true_airspeed = [100.0, 250.0]
>>> atm1.mach
array([0.32984282, 0.82460705])

>>> atm2 = Atmosphere([0, 1000, 35000])
>>> atm2.equivalent_airspeed = 200.0
>>> atm2.true_airspeed
array([200.        , 202.95792913, 359.28282052])

>>> atm2.mach = [1.0, 1.5, 2.0]
>>> atm2.true_airspeed
array([340.29526405, 508.68507243, 593.0730464 ])

>>> atm2.equivalent_airspeed = [[300, 200, 100],[50, 100, 150]]
>>> atm2.true_airspeed
array([[300.        , 202.95792913, 179.64141026],
       [ 50.        , 101.47896457, 269.46211539]])
Parameters
  • altitude – altitude (units decided by altitude_in_feet)

  • delta_t – temperature increment (°C) applied to whole temperature profile

  • altitude_in_feet – if True, altitude should be provided in feet. Otherwise, it should be provided in meters.

get_altitude(altitude_in_feet: bool = True) Union[float, Sequence[float]][source]
Parameters

altitude_in_feet – if True, altitude is returned in feet. Otherwise, it is returned in meters

Returns

altitude provided at instantiation

property delta_t: Union[float, Sequence[float]]

Temperature increment applied to whole temperature profile.

property temperature: Union[float, numpy.ndarray]

Temperature in K.

property pressure: Union[float, numpy.ndarray]

Pressure in Pa.

property density: Union[float, numpy.ndarray]

Density in kg/m3.

property speed_of_sound: Union[float, numpy.ndarray]

Speed of sound in m/s.

property dynamic_viscosity: Union[float, numpy.ndarray]

Dynamic viscosity in kg/m/s.

property kinematic_viscosity: Union[float, numpy.ndarray]

Kinematic viscosity in m2/s.

property mach: Union[float, numpy.ndarray]

Mach number.

property true_airspeed: Union[float, numpy.ndarray]

True airspeed (TAS) in m/s.

property equivalent_airspeed: Union[float, numpy.ndarray]

Equivalent airspeed (EAS) in m/s.

property unitary_reynolds: Union[float, numpy.ndarray]

Unitary Reynolds number in 1/m.

property dynamic_pressure: Union[float, numpy.ndarray]

Theoretical (true) dynamic pressure in Pa.

It is given by q = 0.5 * mach**2 * gamma * static_pressure.

property impact_pressure: Union[float, numpy.ndarray]

Compressible dynamic pressure (AKA impact pressure) in Pa.

property calibrated_airspeed: Union[float, numpy.ndarray]

Calibrated airspeed in m/s.

class stdatm.atmosphere.AtmosphereSI(altitude: Union[float, Sequence[float]], delta_t: float = 0.0)[source]

Bases: stdatm.atmosphere.Atmosphere

Same as Atmosphere except that altitudes are always in meters.

Parameters
  • altitude – altitude in meters

  • delta_t – temperature increment (°C) applied to whole temperature profile

property altitude

Altitude in meters.