# Standard atmosphere properties

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:

1. Find the highest layer A which has a base altitude lower than or equal to the altitude of interest.
2. Linearly interpolate between layers A and A+1 to find the properties at the altitude of interest.

For example, suppose you want to find the temperature at a geometric altitude above MSL of 40000m. Thus, A=3, and the temperature is (in degrees C):

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.

# Input

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 86000).

The input may come from any source desired (function input, stdio, etc.)

# Output

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.).

# Examples

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


# Scoring

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 100+126=226.

# MATL, 152 bytes

'!Q%:5-aeo\!=XBf=H]3|X"Pj7#UGj{r_DH&!+.eFc;u4 kG9Q[rQA(^D1dW- @[E8{Ul0!AXC|MDi8}:&D(j&1_zMU.[^HQvWoi5}*1UApz %Ld3A)N<\$A*7!wBgm'F4Y2'- .;e'hZaU1&Z)i&1Yn


Output is in the same order as described in the challenge

### Explanation

Most of the code, '!Q%:5...!wBgm', is a compressed string containing the table. F4Y2'- .;e'hZa decompresses this into the string -611 19 ... 6.961e-6. Note that some decimals have been removed, as they are not needed to fulfill the 0.1% accuracy criterion.

The decompressed string is interpreted as an array with U. This produces the 8×4 table with the required data. The first column shown in the challenge is not needed. Then 1&Z) separates the first column from the rest.

i takes a number as input, and &1Yn applies linear interpolation using the three types of data: first column of the table, remaining columns, input. The result of the interpolation is implicitly displayed.

The input can also be a column vector, and then each row of the output refers to one of the input values. This is used for verifying all test cases at once.

# Python 2, 372 bytes

h=-611,11019,20063,32162,47350,51413,71802,86000
i=input()
p=sum(x<=i for x in h)-1
a,b=h[p:p+2]
d=i-a+.0
d/=b-a
for e,f in[x[p:p+2]for x in[(19,-56.5,-56.5,-44.5,-2.5,-2.5,-58.5,-86.28),(108900,22632,5474.9,868.02,110.91,66.939,3.9564,0.3734),(1.29853103694,0.3639105,0.0880334745,0.0132247926,0.00142755556,0.000862248191,6.42095529e-05,6.96089485e-06)]]:print e+f*d-e*d
`

Try it online!