Public
Edited
Jul 26, 2024
2 forks
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
// Adjust it manually based on histogram
// activityBins = [1, 10, 100, 1000, 10000] // FNDPP
activityBins = [1, 20, 1000, 10000] // FNDPP
Insert cell
// Adjust it based on known events, behaviours, ...
timePeriod = [1960, 2010, 2011, 2012, 2013, 2015, 2017, 2021] // FNDPP
// timePeriod = [1960, 1970, 1980, 1990, 2000, 2010, 2021] // North sea area
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
dataWithinRadius
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = dataRaw.map((d) => ({
area: d["areaname"],
nuclide: d["nusymbol"],
lon: d["longitude"],
lat: d["latitude"],
time: d["samplingyear"],
activity: d["activity"],
unit: d["unit"],
depth: d["sampdepth"]
}))
Insert cell
dataNuclide = data.filter((d) => d.nuclide == nuclide)
Insert cell
Insert cell
dataDepth = dataNuclide.filter((d) => d.depth <= depth)
Insert cell
Insert cell
minYear = d3.min(dataWithinRadius.map((d) => d.time))
Insert cell
maxYear = d3.max(dataWithinRadius.map((d) => d.time))
Insert cell
timeDomain = timePeriod.slice(1, -1)
Insert cell
timeRange = d3.pairs(timePeriod).map((d) => `${d[0]} - ${d[1]}`)
Insert cell
timeScale = d3.scaleThreshold().domain(timeDomain).range(timeRange)
Insert cell
timeScale(2011)
Insert cell
world = (
await fetch("https://cdn.jsdelivr.net/npm/world-atlas@2/land-50m.json")
).json()
Insert cell
land = topojson.feature(world, world.objects.land)
Insert cell
circle = d3
.geoCircle()
.center(center)
.radius((kms / (6371 * Math.PI * 2)) * 360)
.precision(10)()
Insert cell
// dataWithinRadiusTurf = dataNuclide.filter((d) =>
// turf.booleanWithin(turf.point([d.lon, d.lat]), circle)
// )
Insert cell
// isInCircle = geoContainsCache(circle)
Insert cell
// dataWithinRadius = dataNuclide.filter((d) =>
// // d3.geoContains(circle, [d.lon, d.lat])
// isInCircle([d.lon, d.lat])
// )
Insert cell
dataWithinRadius = dataDepth.filter(
(d) => d3.geoDistance([d.lon, d.lat], center) < kms / 6371
)
Insert cell
Insert cell
// import { geoContainsCache } from "@fil/another-hex-map"
Insert cell
// source: https://observablehq.com/@mkfreeman/plot-tooltip
import { Plot } from "@mkfreeman/plot-tooltip"
Insert cell
Insert cell
// simple = import("simple-statistics@7")
Insert cell
// turf = require("@turf/turf@6")
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