Skip to main content

A full implementation of the ICAO standard atmosphere 1993

Project description

Latest PyPI version Documentation Status License Build status Coverage

Ambiance

Ambiance is a full implementation of the ICAO standard atmosphere 1993 written in Python.

Usage

Atmospheric properties are computed from an “Atmosphere object” which takes the altitude (geometric height) as input. For instance, to simply retrieve sea level properties, you can write:

>>> from ambiance import Atmosphere
>>> sealevel = Atmosphere(0)

>>> sealevel.temperature
array([288.15])

>>> sealevel.pressure
array([101325.])

>>> sealevel.kinematic_viscosity
array([1.46071857e-05])

List of available atmospheric properties

  • Collision frequency (collision_frequency)

  • Density (density)

  • Dynamic viscosity (dynamic_viscosity)

  • Gravitational acceleration (grav_accel)

  • Kinematic viscosity (kinematic_viscosity)

  • Mean free path (mean_free_path)

  • Mean particle speed (mean_particle_speed)

  • Number density (number_density)

  • Pressure (pressure)

  • Pressure scale height (pressure_scale_height)

  • Specific weight (specific_weight)

  • Speed of sound (speed_of_sound)

  • Temperature (temperature, temperature_in_celsius)

  • Thermal conductivity (thermal_conductivity)

List-like input

Ambiance also handles list-like input (list, tuples, Numpy arrays). The following code demonstrates how to produce a temperature plot with Matplotlib. In the example, Numpy’s linspace() function is used to produce an array with altitudes.

import numpy as np
import matplotlib.pyplot as plt
from ambiance import Atmosphere

# Make an atmosphere object
heights = np.linspace(-5e3, 80e3, num=1000)
atmosphere = Atmosphere(heights)

# Make plot
plt.plot(atmosphere.temperature_in_celsius, heights/1000)
plt.ylabel('Height [km]')
plt.xlabel('Temperature [°C]')
plt.grid()
plt.show()

The output is

Temperature plot

Matrix-like input

Similarly, you can also pass in entire matrices. Example:

>>> import numpy as np
>>> from ambiance import Atmosphere

>>> h = np.array([[0, 11, 12], [20, 21, 35], [0, 80, 50]])*1000
>>> h  # Geometric heights in metres
array([[    0, 11000, 12000],
       [20000, 21000, 35000],
       [    0, 80000, 50000]])

>>> Atmosphere(h).temperature
array([[288.15      , 216.7735127 , 216.65      ],
       [216.65      , 217.58085353, 236.51337209],
       [288.15      , 198.63857625, 270.65      ]])

>>> Atmosphere(h).speed_of_sound
array([[340.29398803, 295.15359145, 295.06949351],
       [295.06949351, 295.70270856, 308.29949587],
       [340.29398803, 282.53793156, 329.798731  ]])

For all functionality see the complete documentation.

Installation

Ambiance is available on PyPI and may simply be installed with

pip install ambiance

Requirements

Using Ambiance requires

  • Python 3.6 or higher

  • Numpy

For developers: Recommended packages may be installed with the requirements.txt.

pip install -r requirements.txt

License

License: Apache-2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ambiance-0.2.1.tar.gz (12.7 kB view hashes)

Uploaded Source

Built Distribution

ambiance-0.2.1-py3-none-any.whl (12.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page