Published
Edited
Feb 12, 2018
Importers
Insert cell
Insert cell
Insert cell
data = d3.csv("https://gist.githubusercontent.com/bmershon/f8fc6765e356539391624e0d8334c156/raw/2032bbbba758c8b305bd426c7752512ad8ce6cff/international_standard_atmosphere.csv")
Insert cell
// Returns the index of the ISA layer which contains the given altitude. If the altitude is not defined by the
// ISA, the returned index is -1.
findLayerIndex = (altitude) => {
// Ensure the argument is within the altitude domain specified by the International Standard Atmosphere.
if (altitude < +data[0].geopotential || altitude > +data[data.length - 1].geopotential) {
return -1;
}
// Find the layer of the atmosphere that contains the given altitude.
for (let i = data.length - 1; i >= 0; i--) {
if (altitude < +data[i].geopotential) {
continue;
}
return i;
}
}
Insert cell
// Returns the name of the standard layer of the ISA containing the given altitude (e.g. "Tropopause").
standardLayer = (altitude) => {
let i = findLayerIndex(altitude);
return (i === -1) ? undefined : data[i].name;
}
Insert cell
standardTemperature = (altitude) => {
let i = findLayerIndex(altitude);
return (i === -1)
? undefined
: +data[i].temperature + +data[i].lapse * (altitude - +data[i].geopotential) / 1000;
}
Insert cell
Insert cell
Insert cell
temp = standardTemperature(altitude) // Celsius
Insert cell
Insert cell
import {chart} from "@bmershon/standard-lapse-rate"
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more