Airspeed conversions (true/calibrated/equivalent/Mach), atmospheric data, and more with built-in unit checking.
Project description
About
Airspeed conversions (true/calibrated/equivalent/Mach), atmospheric data, and more with built-in unit checking. Specific sub-modules include:
flightcondition: input altitude to compute common flight condition data. Easily swap between Mach number, true airspeed, calibrated airspeed, and equivalent airspeed. Includes atmospheric data.atmosphere: input altitude to compute 1993 International Standard Atmosphere data. Many relevant, derived quantities are included.units: built-in unit-checking and conversion using pint package.
See examples below for usage!.
Installation
Install Commands
Install using the pip package-management system. The easiest method is
to open the terminal and run:
pip install flightcondition
Alternatively, manually download the source code, unpack, and run:
pip install <path/to/flightcondition>
Dependencies
Usage
In a Python script or an ipython notebook, import all utilities with,
from flightcondition import *
or more explicitly as shown in the following examples.
Flight Condition
The Flightcondition class can be used to compute and interact with
common flight condition data.
Outputs include:
Mach number
machTrue airspeed
TASCalibrated airspeed
CASEquivalent airspeed
EASDynamic pressure
q_infReynolds number
reynolds_number(ell)Reynolds number per-unit-length
reynolds_number_per_unit_length(length_unit)Atmosphere data
atm(seeatmospherebelow)
Usage:
from flightcondition import FlightCondition, unit, dimless
# Compute flight conditions for a scalar or array of altitudes
altitudes = [0, 10e3, 33.5e3] * unit('ft')
fc = FlightCondition(altitudes, EAS=300*unit('knots'))
# Print flight condition data:
print(f"{fc}")
# Print extended output in Imperial units:
print(f"\n{fc.tostring(full_output=True, imperial_units=True)}")
# Access flight speed formats individually
M_inf, U_inf, U_CAS, U_EAS = fc.mach, fc.TAS, fc.CAS, fc.EAS
# Access atmospheric data alone (see Atmosphere class for options)
atm = fc.atm # access Atmosphere object 'atm'
p, T, rho, nu, a = atm.p, atm.T, atm.rho, atm.nu, atm.a
# Input true/calibrated/equivalent airspeed or Mach number
fc_TAS = FlightCondition(altitudes, TAS=300*unit('knots'))
fc_CAS = FlightCondition(altitudes, CAS=300*unit('knots'))
fc_EAS = FlightCondition(altitudes, EAS=300*unit('knots'))
fc_mach = FlightCondition(altitudes, mach=0.4535*dimless)
# Specify desired units on input and output
altitudes_in_km = [0, 3.048, 10.2108] * unit('km')
fc_other_units = FlightCondition(altitudes, EAS=154.33*unit('m/s'))
U_TAS = fc_other_units.TAS
print(f"\nThe true airspeed in m/s is {U_TAS.to('m/s'):.5g}")
print(f"The true airspeed in km/s is {U_TAS.to('km/s'):.5g}")
# Compute additional derived quantities (see class for all options)
print(f"\nThe dynamic pressure in psi is {fc.q_inf.to('psi'):.5g}")
ell = 60 * unit('in') # arbitrary length scale of interest
print(f"The Reynolds number is {fc.reynolds_number(ell):.5g}")
print(f"The Reynolds number per-unit-length [1/in] is "
f"{fc.reynolds_number_per_unit_length('in'):.5g}")
Atmosphere
The Atmosphere class can be used to compute and interact with common
standard atmosphere data and derived quantities.
Outputs include:
Pressure
pTemperature
TDensity
rhoSound speed
aDynamic viscosity
muKinematic viscosity
nuThermal conductivity
kLayer name
layer.nameGeometric altitude
hGeopotential altitude
HAcceleration due to gravity
gMean free path
mean_free_path
Usage:
from flightcondition import Atmosphere, unit
# Compute atmospheric data for a scalar or array of altitudes
h = [0.0, 12.7, 44.2, 81.0] * unit('km')
atm = Atmosphere(h)
# Print abbreviated output:
print(f"\n{atm}")
# Print extended output in Imperial units:
print(f"\n{atm.tostring(full_output=True, imperial_units=True)}")
# See also the linspace() function from numpy, e.g.
# h = linspace(0, 81.0, 82) * unit('km')
# Access individual properties and convert to desired units: "
p, T, rho, nu, a = atm.p, atm.T, atm.rho, atm.nu, atm.a
print(f"\nThe pressure in psi is {p.to('psi'):.5g}")
# Compute additional properties such as thermal conductivity,
# mean free path, and more (see class for all options)
print(f"\nThe thermal conductivity is {atm.k:.5g}"
f"\nThe mean free path = {atm.mean_free_path:.5g}")
Units
Conveniently input, output, and convert units using pint units.
from flightcondition import unit, printv
h = 33 * unit('km')
print(h.to('kft'))
# >>> 108.26771653543307 kft
printv(h, to='kft')
# >>> h = 108.27 kft
U_inf = 20 * unit('knots')
rho_inf = 1.225 * unit('kg/m^3')
q_inf = 0.5*rho_inf*U_inf**2
printv(q_inf, to='psi')
# >>> q_inf = 0.0094042 psi
Note that pint does not support conflicting
unit registries so avoid interactions between flightcondition.unit and
a separate pint.UnitRegistry.
License
flightcondition is licensed under the MIT LICENSE. See the LICENSE document.
Disclaimer
The software is provided “as is”, without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose and noninfringement. In no event shall the authors or copyright holders be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or the use or other dealings in the software.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file flightcondition-22.3.tar.gz.
File metadata
- Download URL: flightcondition-22.3.tar.gz
- Upload date:
- Size: 13.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d34902f18c4a4753b2cb21c7fd5427c2a7474d841c4246eb4f5cf4c45ac6b9a8
|
|
| MD5 |
b8faa8188fc3adb87d2391d59c80f7d6
|
|
| BLAKE2b-256 |
0030d521fc37627b529886ddf5ae8def5488b7296fe811fe14bb82d0db79dd7b
|
File details
Details for the file flightcondition-22.3-py3-none-any.whl.
File metadata
- Download URL: flightcondition-22.3-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.26.0 requests-toolbelt/0.9.1 urllib3/1.26.7 tqdm/4.62.3 importlib-metadata/4.8.1 keyring/23.1.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
393c20c18b19f10bf707d8a749abd5841fd7ec0b9df7b2576df032c9622281c3
|
|
| MD5 |
96cc364ffc732123611149d415bd990c
|
|
| BLAKE2b-256 |
871887cb80fa70f8b87712f65963b17218e9ec2057405223d5cb8ebd1e2b5519
|