pyatmos.utils package

pyatmos.utils.lookup module

Contains the following atmospheric functions:

  • alt = get_alt_for_density(density, density_units=’slug/ft^3’, alt_units=’ft’,
    nmax=20, tol=5.)
  • alt = get_alt_for_eas_with_constant_mach(equivalent_airspeed, mach,
    velocity_units=’ft/s’, alt_units=’ft’, nmax=20, tol=5.)
  • alt = get_alt_for_q_with_constant_mach(q, mach, pressure_units=’psf’, alt_units=’ft’,
    nmax=20, tol=5.)
  • alt = get_alt_for_pressure(pressure, pressure_units=’psf’, alt_units=’ft’,
    nmax=20, tol=5.)

All the default units are in English units because the source equations are in English units.

pyatmos.utils.lookup.get_alt_for_density(density, density_units='slug/ft^3', alt_units='ft', nmax=20, tol=5.0)[source]

Gets the altitude associated with a given air density.

Parameters:
density : float

the air density in slug/ft^3

density_units : str; default=’slug/ft^3’

the density units; slug/ft^3, slinch/in^3, kg/m^3

alt_units : str; default=’ft’

sets the units for the output altitude; ft, m, kft

nmax : int; default=20

max number of iterations for convergence

tol : float; default=5.

tolerance in alt_units

Returns:
alt : float

the altitude in feet

pyatmos.utils.lookup.get_alt_for_eas_with_constant_mach(equivalent_airspeed, mach, velocity_units='ft/s', alt_units='ft', nmax=20, tol=5.0)[source]

Gets the altitude associated with a equivalent airspeed.

Parameters:
equivalent_airspeed : float

the equivalent airspeed in velocity_units

mach : float

the mach to hold constant

alt_units : str; default=’ft’

the altitude units; ft, kft, m

nmax : int; default=20

max number of iterations for convergence

tol : float; default=5.

tolerance in alt_units

Returns:
alt : float

the altitude in alt units

pyatmos.utils.lookup.get_alt_for_pressure(pressure, pressure_units='psf', alt_units='ft', nmax=20, tol=5.0)[source]

Gets the altitude associated with a pressure.

Parameters:
pressure : float

the pressure lb/ft^2 (SI=Pa)

pressure_units : str; default=’psf’

the pressure units; psf, psi, Pa, kPa, MPa

alt_units : str; default=’ft’

the altitude units; ft, kft, m

nmax : int; default=20

max number of iterations for convergence

tol : float; default=5.

tolerance in alt_units

Returns:
alt : float

the altitude in alt_units

pyatmos.utils.lookup.get_alt_for_q_with_constant_mach(q, mach, pressure_units='psf', alt_units='ft', nmax=20, tol=5.0)[source]

Gets the altitude associated with a dynamic pressure.

Parameters:
q : float

the dynamic pressure lb/ft^2 (SI=Pa)

mach : float

the mach to hold constant

pressure_units : str; default=’psf’

the pressure units; psf, psi, Pa, kPa, MPa

alt_units : str; default=’ft’

the altitude units; ft, kft, m

nmax : int; default=20

max number of iterations for convergence

tol : float; default=5.

tolerance in alt_units

Returns:
alt : float

the altitude in alt_units

pyatmos.utils.unitless module

Contains functions that have both consistent units and are vectorized:

  • q = dynamic_pressure_p_mach(p, mach)
  • q = dynamic_pressure_rho_vel(rho, vel)
  • sos = speed_of_sound(T, R=1716., gamma=1.4)
pyatmos.utils.unitless.dynamic_pressure_p_mach(p, mach)[source]

Calculates dynamic pressure without options for units

pyatmos.utils.unitless.dynamic_pressure_rho_vel(rho, vel)[source]

Calculates dynamic pressure without options for units

pyatmos.utils.unitless.speed_of_sound(T, R=1716.0, gamma=1.4)[source]

Calculates the speed of sound without options for units

Parameters:
T : float, np.ndarray

the temperature

R : float; default=1716.0

1716.59, dry air, R=287.04 J/kg*K

gamma : float; default=1.4

the ratio of Cp/Cv

Module contents