Public
Edited
Jun 21, 2023
1 star
Insert cell
Insert cell
Insert cell
getBlob = (data) => {return new Blob([d3.csvFormat(data)], {type: "text/csv"})}
Insert cell
hennepinLakes = minnesotaLakesLakesBiggerThan10Acresdata
.slice()
.filter((lake) => lake["County"] === "Hennepin")
Insert cell
minneapolisLakes = [
"Bde Maka Ska",
"Brownie",
"Cedar",
"Diamond",
"Grass",
"Harriet",
"Hiawatha",
"Lake of the Isles",
"Nokomis",
"Powderhorn Lake",
"Ryan"
]
Insert cell
minneapolisLakesData = hennepinLakes
.slice()
.filter((lake) => minneapolisLakes.includes(lake["Name"]))
Insert cell
Insert cell
Insert cell
DOM.download(getBlob(lakeMinnetonkaRecords), "minnetonka.csv")
Insert cell
Insert cell
Insert cell
Insert cell
Minnesota Lakes - Lakes bigger than 10 acres.csv
Type SQL, then Shift-Enter. Ctrl-space for more options.

Insert cell
hydrodb
SELECT * from lakedb WHERE acres >= 10 AND wb_class = 'Lake or Pond'
Insert cell
allLakesDNR
Insert cell
allDNRLakeIds = allLakesDNR.reduce((acc, curr) => {
if (curr.dowlknum !== null) {
return [...acc, curr.dowlknum];
}
return acc;
}, [])
Insert cell
allDNRLakeIds.length
Insert cell
allDowlingLakeIds = allLakesDNR.reduce((acc, curr) => {
if (curr.dowlknum !== null) {
return [...acc, curr.dowlknum];
}
return acc;
}, [])
Insert cell
DOM.download(getBlob(allLakesDNR), "DNRAllLakesNOTCA.csv")
Insert cell
dnr_hydro_features_all.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
unnamedLakes = minnesotaLakesLakesBiggerThan10Acresdata
.slice()
.filter((lake) => !lake["Name"]).length
Insert cell
topLakes = minnesotaLakesLakesBiggerThan10Acresdata
.slice()
.sort((a, b) => d3.descending(a.area_acres, b.area_acres))
Insert cell
Plot.plot({
marginLeft: 200,
marginRight: 60,
x: { label: "Acres" },
y: { label: "Lake" },
marks: [
Plot.barX(topLakes.slice(0, 11), {
y: "Name",
x: "area_acres",
sort: { y: "x" }
})
]
})
Insert cell
DOM.download(getBlob(topLakes), "topLakes.csv")
Insert cell
Plot.plot({
marginLeft: 125,
x: { grid: true },
color: { legend: true },
marks: [
Plot.barX(
minnesotaLakesLakesBiggerThan10Acresdata,
Plot.groupY(
{ x: "count" },
{
y: "County",
sort: { y: "x" }
}
)
),
Plot.ruleX([0])
]
})
Insert cell
Minnesota Lakes - Lakes bigger than 10 acres.csv
Type Table, then Shift-Enter. Ctrl-space for more options.

Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
hydrodb = DuckDBClient.of({
lakedb: FileAttachment("dnr_hydro_features_all.csv")
})
Insert cell
lakedb = DuckDBClient.of({
lake: FileAttachment("Minnesota Lakes - Lakes bigger than 10 acres.csv")
})
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