Public
Edited
Jun 27
Importers
1 star
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Routes.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Weather.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
weatherSubsets = d3.group(weather, r => r.RouteKey)
Insert cell
Insert cell
summary = d3.rollup(
weather,
(group) => new Object({
RouteKey: group[0].RouteKey,

// reiterate original location codes
CountryNum: group[0].CountryNum,
StateNum: group[0].StateNum,
Route: group[0].Route,

// count unique number of years and observers
YearCount: d3.count(new Set(group.map(e => e["Year"])).keys()),
ObsNCount: d3.count(new Set(group.map(e => e["ObsN"])).keys()),
...SumStats(group, "TotalSpp"),
...SumStats(group, "DayOfYear"),
...SumStats(group, "StartTimeM"),
...SumStats(group, "EndTimeM"),
...SumStats(group, "StartSky"),
...SumStats(group, "EndSky"),
...SumStats(group, "StartWind"),
...SumStats(group, "EndWind"),
...SumStats(group, "StartTempF"),
...SumStats(group, "EndTempF"),
}),

// the rollup key: every record in weather with the same RouteKey is grouped and summarized
(record) => record.RouteKey
);
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
mapRoutes = routes.filter(r => summary.has(r.RouteKey))
Insert cell
Insert cell
Insert cell
weatherStat = selectedStat.split("_", 1)[0]
Insert cell
Insert cell
statMax = weather.reduce((a, c) => {return a[weatherStat] > c[weatherStat] ? a : c;})[weatherStat];
Insert cell
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