The International Standard Atmosphere (ISA) is a model of the Earth's atmosphere at "reference" conditions. It includes information on pressure, temperature, and density change vs. altitude.
The ISA tabulates these properties at various layers, and an estimation of the value of interest can by found by the following procedure:
- Find the highest layer
Awhich has a base altitude lower than or equal to the altitude of interest.
- Linearly interpolate between layers
A+1to find the properties at the altitude of interest.
For example, suppose you want to find the temperature at a geometric altitude above MSL of
A=3, and the temperature is (in degrees
T = (-2.5+44.5)*(40000-32000)/(47000-32000)-44.5 = -22.1
The goal of this challenge is given a geometric altitude above MSL, find the standard temperature, pressure, and density at that altitude.
For the purposes of this challenge, use the table of the 1976 ISA model (presented on Wikipedia). Here is a link a Gist containing the data in CSV format. Note that the CSV file includes the missing density values from Wikipedia's page.
The input is a single finite real number representing the geometric altitude above MSL in meters. This number is guaranteed to be between
[-611,86000) (i.e. it is greater than or equal to
-611, and is strictly less than
The input may come from any source desired (function input, stdio, etc.)
The output are the 3 real numbers representing the standard temperature, pressure, and density at the input altitude. The answer should be accurate to within
0.1%. The answer may be in order desired, as long as it is obvious which value represents which quantity (ex.: the first number is always temperature, the second number is always density, and the third number is always pressure). Note that the magnitude of the quantity does not count as make it obvious what the value represents.
You are welcome to choose any units to output your answers in as long as they properly describe the quantity of interest. Ex.: you may output temperature in degrees Fahrenheit, Celsius, Kelvin, etc., but you can't output the temperature in meters. Your code does not need to output the units abbreviation if it is always the same for a given quantity, but you should specify in your answer what units your answer uses.
The output may be to any sink desired (stdio, return value, output parameter, etc.).
All examples use meters for input, and output in the order temperature (C), pressure (Pa), density (kg/m^3).
-611 19, 108900, 1.2985 0 15.0335, 104368, 1.24943 12000 -56.5, 20771, 0.333986 47350 -2.5, 110.91, 0.0014276 71803 -58.502, 3.95614764, 6.42055e-5
This is code golf; shortest answer in bytes wins. Standard loopholes are prohibited. You may use any built-ins desired. If you are using any external resources to store the tabulated data, you must include the size of the resource (in bytes) as read into your program as part of your score.
Ex.: Say you read in a compressed version of the CSV table I linked which is
100 bytes long (uncompressed is
333 bytes), and your code is
126 bytes long. Then your net score is