Published
Edited
Mar 27, 2021
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
maxHR = 180
Insert cell
minHR = 48
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
alt_extent = {
const t = hr_route_dt.rollup({
minAlt: d => op.min(d.alt),
maxAlt: d => op.max(d.alt)
});
return [t.get("minAlt", 0), t.get("maxAlt", 0)];
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
zcolors = [z1_color, z2_color, z3_color, z4_color, z5_color]
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
localFileContent
Insert cell
Insert cell
Insert cell
json_data
Insert cell
function jdist(lat1, lon1, lat2, lon2) {
// const orig = t.slice(0, 1).objects()[0];
// const dest = t.slice(1, 2).objects()[0];
const R = 6385e3; // metres
const φ1 = (lat1 * Math.PI) / 180; // φ, λ in radians
const φ2 = (lat2 * Math.PI) / 180;
const Δφ = ((lat2 - lat1) * Math.PI) / 180;
const Δλ = ((lon2 - lon1) * Math.PI) / 180;

const a =
Math.sin(Δφ / 2) * Math.sin(Δφ / 2) +
Math.cos(φ1) * Math.cos(φ2) * Math.sin(Δλ / 2) * Math.sin(Δλ / 2);
const c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a));

const d = R * c; // in metres
return d; //{ φ1, φ2, Δφ, Δλ, a, c, d };
}
Insert cell
aq.addFunction('deltaDistance', jdist, { override: true })
Insert cell
Insert cell
route = hr_route.map(d => ({
idx: d.idx,
lat: d.lat,
lng: d.lng,
time: d.time
}))
Insert cell
hr_route_dt.view()
Insert cell
hr = hr_route.map(d => ({ idx: d.idx, hr: d.hr, time: d.time }))
Insert cell
// hr = json_data.features[0].[1].values.map((r, i) => ({ idx: i, time: r[0], hr: r[1] }))
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
{
function readFile(event) {
const inputElement = event.target;
const inputFile = inputElement.files[0];

var reader = new FileReader();
reader.onload = function(loadedEvent) {
const parsedResult = togeojson.gpx(
new DOMParser().parseFromString(inputFile, 'text/xml')
);

// const parsedResult = JSON.parse(loadedEvent.target.result);

mutable localFileContent = json_data;
};

reader.readAsText(inputFile);
}

return (window.readFile = readFile);
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
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