Package: ambiance
Ambianceis a full implementation of the ICAO standard atmosphere 1993 written in Python.International Standard Atmosphere (Wikipedia)International Civil Aviation Organization ; Manual Of The ICAO Standard Atmosphere – 3rd Edition 1993 (Doc 7488) – extended to 80 kilometres (262 500 feet)Basic usageAtmospheric properties are computed from anAtmosphereobject which takes the altitude (geometric height) as input. For instance, to simply retrieve sea level properties, you can write:>>>fromambianceimportAtmosphere>>>sealevel=Atmosphere(0)>>>sealevel.temperaturearray([288.15])>>>sealevel.pressurearray([101325.])>>>sealevel.kinematic_viscosityarray([1.46071857e-05])List of available atmospheric propertiesCollision frequency (collision_frequency)Density (density)Dynamic viscosity (dynamic_viscosity)Geometric height aboveMSL(h)Geopotential height (H)Gravitational acceleration (grav_accel)Kinematic viscosity (kinematic_viscosity)Layer names (layer_name) [string array]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)Vector and matrix inputsAmbiancealso handles list-like input (list, tuples,Numpyarrays). The following code demonstrates how to produce a temperature plot withMatplotlib. In the example,Numpy’slinspace()function is used to produce an array with altitudes.importnumpyasnpimportmatplotlib.pyplotaspltfromambianceimportAtmosphere# Create an atmosphere objectheights=np.linspace(-5e3,80e3,num=1000)atmosphere=Atmosphere(heights)# Make plotplt.plot(atmosphere.temperature_in_celsius,heights/1000)plt.ylabel('Height [km]')plt.xlabel('Temperature [°C]')plt.grid()plt.show()The output isSimilarly, you can also pass in entirematrices. Example:>>>importnumpyasnp>>>fromambianceimportAtmosphere>>>h=np.array([[0,11,12],[20,21,35],[0,80,50]])*1000>>>h# Geometric heights in metresarray([[0,11000,12000],[20000,21000,35000],[0,80000,50000]])>>>Atmosphere(h).temperaturearray([[288.15,216.7735127,216.65],[216.65,217.58085353,236.51337209],[288.15,198.63857625,270.65]])>>>Atmosphere(h).speed_of_soundarray([[340.29398803,295.15359145,295.06949351],[295.06949351,295.70270856,308.29949587],[340.29398803,282.53793156,329.798731]])>>>Atmosphere([30000,0]).layer_namearray(['stratosphere','troposphere'],dtype='<U42')Instantiating from given pressure or densityIn some contexts it may be convenient to instantiate anAtmosphereobject from a given ambient pressure or density. This can be easily achieved by using theAtmosphere.from_pressure()orAtmosphere.from_density()methods, respectively. Both methods returnAtmosphereobjects from which all other properties, like temperature, can be requested.>>>Atmosphere.from_pressure([80e3,20e3])# 80 kPa and 20 kPaAtmosphere(array([1949.58557497,11805.91571135]))>>>Atmosphere.from_pressure([80e3,20e3]).pressurearray([80000.,20000.])>>>Atmosphere.from_density(1.0)# 1.0 kg/m^3Atmosphere(array([2064.96635895]))Complete user guideFor a comprehensive and detailed user guide, please see thecomplete documentation.InstallationPip (recommended)Ambianceis available onPyPIand may simply be installed withpip install ambianceCondaThe package can be installed via theCondaenvironment withconda install -c conda-forge ambianceRequirementsUsingAmbiancerequiresPython 3.6or higherNumPySciPyFor developers: Recommended packages may be installed with therequirements.txt.pip install -r requirements.txtLicenseLicense:Apache-2.0