Skip to main content

Toolbox for aeronautic units and conversions

Project description

pitot

tests Code Coverage Checked with mypy Code style: black License
PyPI version PyPI downloads Conda version Conda Downloads

pitot is a Python toolbox providing efficient aeronautic calculations.

Implementations are:

  • efficient, based on NumPy or state-of-the-art libraries;
  • provided with typing stubs;
  • unambiguous with physical units, with the help of the pint library.
    All parameters may be passed with or without a physical unit (default units are explicit in the documentation), but all return values come with a physical unit.

The following functions are currently available:

  • International Standard Atmosphere (temperature, density, pressure and speed of sound);
  • conversions between various air speeds: CAS, TAS, EAS and Mach number;
  • geodetic calculations (distance, bearing, great circle, etc.) on a WGS84 ellipsoid.

Installation

Latest release

pip install pitot

Development version

poetry install

Basic usage

Physical units are not mandatory for arguments, but return values are all pint quantities

>>> from pitot.isa import temperature
>>> temperature(0)
Default unit [m] will be used for argument 'h'.
<Quantity(288.15, 'kelvin')>
>>> temperature([0, 1000])
Default unit [m] will be used for argument 'h'.
<Quantity([288.15 281.65], 'kelvin')>

You may access the value with the m (stands for magnitude) attribute:

>>> temperature(0).m  # in Kelvin by default
Default unit [m] will be used for argument 'h'.
288.15
>>> temperature(0).to("°C").m
Default unit [m] will be used for argument 'h'.
15.0

It is preferable to avoid warnings by passing values with a physical unit:

>>> from pitot import Q_
>>> temperature(Q_([0, 1000], "ft")).to("°C")
<Quantity([15.     13.0188], 'degree_Celsius')>

Things also work with NumPy arrays...

>>> import numpy as np
>>> temperature(Q_(np.array([0, 1000]), "ft"))
<Quantity([288.15   286.1688], 'kelvin')>
>>> temperature(Q_(np.array([0, 1000]), "ft")).to("°C").m
array([15.    , 13.0188])

... or with Pandas Series:

>>> import pandas as pd
>>> temperature(pd.Series([0., 1000], dtype="pint[ft]")).pint.to("°C")
0                  15.0
1    13.018799999999999
dtype: pint[°C]

Contributions

Any input, feedback, bug report or contribution is welcome.

Before opening a PR, please check your commits follow a number of safeguards with hooks to install as follow:

poetry run pre-commit install

Then you should prefix you git commit commands as follow:

poetry run git commit -m "fantastic commit message"

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

pitot-0.2.0.tar.gz (9.3 kB view hashes)

Uploaded Source

Built Distribution

pitot-0.2.0-py3-none-any.whl (9.1 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