Published
Edited
Aug 26, 2020
3 forks
Importers
2 stars
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
us = d3.json("https://unpkg.com/us-atlas@3/counties-10m.json")
Insert cell
stateShapes = topojson.feature(us, us.objects.states)//.features
Insert cell
statesByName = new Map(stateShapes.features.map(d => [d.properties.name, d]))
Insert cell
V1_08_2020
Insert cell
Insert cell
Insert cell
Insert cell
california = statesByName.get("California")
Insert cell
// filtering using turf as learned from this notebook https://observablehq.com/@aboutaaron/racial-demographic-dot-density-map
V1_08_2020_CA = V1_08_2020.filter(d => {
let p = turf.point([d.longitude, d.latitude])
return turf.booleanPointInPolygon(p, california)
})
Insert cell
Insert cell
Insert cell
Insert cell
daily_V1_08_2020_CA = d3.group(V1_08_2020_CA, d => dateformat(new Date(+d.acq_date + 100000000)))
Insert cell
Insert cell
viewof day_2020 = Scrubber(daily_V1_08_2020_CA.keys(), {delay: 300, loop: false})
Insert cell
daily_V1_08_2020_CA.get(day_2020)
Insert cell
Insert cell
Insert cell
d3.extent(V1_08_2020_CA, d => d.frp)
Insert cell
d3.extent(V1_08_2020_CA, d => d.bright_ti4)
Insert cell
d3.extent(V1_08_2020_CA, d => d.bright_ti5)
Insert cell
frpdata = V1_08_2020_CA.map(d => d.frp)
Insert cell
Insert cell
import {chart as frp2020} with { frpdata as data, histoheight as height} from "@d3/histogram"
Insert cell
frp2020
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
frpColor = d3.scaleSequential(d3.interpolateReds)
.domain(d3.extent(frpdata))
Insert cell
frpColor(2)
Insert cell
Insert cell
Insert cell
ti4Color = d3.scaleSequential(d3.interpolateMagma)
.domain(d3.extent(ti4data))
Insert cell
Insert cell
Insert cell
viewof day2_2020 = Scrubber(daily_V1_08_2020_CA.keys(), {delay: 300, loop: false})
Insert cell
Insert cell
Insert cell
countyShapes = topojson.feature(us, us.objects.counties)//.features
Insert cell
// Choose a couple counties that define the extent I care about
countyExtent = ({type: "FeatureCollection", features: countyShapes.features.filter(d => (d.properties.name == "Tehama" || d.properties.name == "San Benito") && d.id.slice(0,2) == "06") })
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
height = 500
Insert cell
numformat = d3.format(",d")
Insert cell
dateformat = d3.timeFormat("%Y-%m-%d")
Insert cell
Insert cell
Insert cell
Insert cell

One platform to build and deploy the best data apps

Experiment and prototype by building visualizations in live JavaScript notebooks. Collaborate with your team and decide which concepts to build out.
Use Observable Framework to build data apps locally. Use data loaders to build in any language or library, including Python, SQL, and R.
Seamlessly deploy to Observable. Test before you ship, use automatic deploy-on-commit, and ensure your projects are always up-to-date.
Learn more