Public
Edited
May 15, 2024
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
formatter = d3.format(".2e")
Insert cell
formatter(0.0000234)
Insert cell
Insert cell
timeValueAgg = Plot.plot({
color: {
scheme: "orrd",
type: "log"
},
y: {
type: "linear",

// tickFormat: "~s",
tickFormat: ".2e",

label: "Concentration (Sv/s) ↑"
},
x: { tickFormat: Plot.formatAuto },
marks: [
Plot.rect(
dataSelected.filter((d) => d.StartTime > fromDateTime),
Plot.bin(
{ fill: "Count" },
{ x: "StartTime", y: "Value", thresholds: 40 }
)
)
],
marginLeft: 80,
height: 400,
width: 600
})
Insert cell
Plot.plot({
// x: {
// type: "utc"
// },
y: {
grid: true,
inset: 6
},
marks: [
Plot.boxY(
dataSelected.filter((d) => d.StartTime > fromDateTime),
{ x: "StartTime", y: "Value" }
)
]
})
Insert cell
Insert cell
Insert cell
hexTimeChart = Plot.plot({
// width: width,
x: {
type: "utc"
},
color: { scheme: "OrRd" },
y: {
type: yScaleType,
tickFormat: "~s",
label: "Dose rate ↑",
// grid: true,
inset: 6
},
marks: [
Plot.dot(
dataSelected.filter((d) => d.StartTime > fromDateTime),
Plot.hexbin(
// { fill: "count", r: "count" },
{ fill: "count" },
{
x: "StartTime",
y: "Value",
symbol: "hexagon",
fillOpacity: 0.9,
stroke: "black",
strokeWidth: 0.5,
strokeOpacity: 0.8,
binWidth: 7
}
)
)
]
})
Insert cell
timeChart = Plot.plot({
style: "overflow: visible;",
y: { grid: true, type: "linear", tickFormat: "~s", label: "Dose rate ↑" },
marks: [
Plot.ruleY([0]),
Plot.lineY(
dataSelected.filter((d) => d.StartTime > fromDateTime),
{
x: "StartTime",
y: "Value",
stroke: "Name",
sort: "StartTime",
tip: "x"
}
),
Plot.dot(
dataSelected.filter((d) => d.StartTime > fromDateTime),
{
x: "StartTime",
y: "Value",
stroke: "Name",
sort: "StartTime",
fill: "Name",
r: 2,
tip: "x"
}
)
// Plot.text(
// dataSelected,
// Plot.selectLast({
// x: "StartTime",
// y: "Value",
// z: "Name",
// text: "Name",
// textAnchor: "start",
// dx: 5
// })
// )
]
})
Insert cell
Plot.plot({
width: width,
tip: true,
y: { grid: true, type: yScaleType, tickFormat: "~s", label: "Dose rate ↑" },
// x: { type: "time" },
// color: { legend: true },
fx: {
interval: d3.utcHour.every(2),
// tickFormat: (d) => `${d.getUTCFullYear()}’s`,
label: null
},
marks: [
Plot.dot(
dataSelected.filter((d) => d.StartTime > fromDateTime),
Plot.dodgeX("middle", {
fx: "StartTime",
y: "Value",
r: 1,
opacity: 1,
tip: "x"
})
)
]
})
Insert cell
// histogram = Plot.plot({
// x: {
// type: "linear",
// tickFormat: "~s",
// label: "Dose rate"
// },
// marks: [
// Plot.rectY(
// dataSelected,
// Plot.binX({ y: "count" }, { x: "Value", tip: true, thresholds: 20 })
// ),
// Plot.ruleY([0])
// ]
// })
Insert cell
Plot.plot({
y: {
type: "linear",
tickFormat: "~s",
label: "Dose rate"
},
fx: {
interval: d3.utcDay.every(1),
// tickFormat: (d) => `${d.getUTCFullYear()}’s`,
label: null
},
// fx: {
// transform: (d) => timeScale(d),
// label: "Time →",
// reverse: false,
// domain: rangeTime
// },
// facet: {
// data: dataSelected,
// // y: "depth",
// x: "StartTime",
// marginLeft: 100
// },
marks: [
Plot.rectX(
dataSelected,
Plot.binY(
{ x: "count" },
{ y: "Value", tip: true, thresholds: 20, facet: "include" }
)
),
Plot.ruleX([0])
]
})
Insert cell
time = dataSelected.map((d) => d.StartTime)
Insert cell
// binsTime = d3.bin()(time)
Insert cell
// formatTime = d3.timeFormat("%Y-%m-%dT%H:%M:%S.%LZ")
formatTime = d3.timeFormat("%dT%H:%M:%S.%LZ")
Insert cell
// rangeTime = binsTime.map(
// (d) => `${formatTime(d3.min(d))} - ${formatTime(d3.max(d))}`
// )
Insert cell
binSize = 72 * 60 * 60 * 1000 // 1 hour in milliseconds
Insert cell
minTime = time.reduce((min, time) => Math.min(min, time), Infinity)
Insert cell
maxTime = time.reduce((max, time) => Math.max(max, time), -Infinity)
Insert cell
// Generate bins using d3.bin
binsTime = d3
.bin()
.domain([minTime, maxTime])
.thresholds(d3.range(minTime, maxTime + binSize, binSize))(time)
Insert cell
rangeTime = binsTime.map(
(d) => `${formatTime(d3.min(d))} - ${formatTime(d3.max(d))}`
)
Insert cell
domainTime = binsTime.map((d) => d3.min(d)).slice(1)
Insert cell
timeScale = d3.scaleThreshold().domain(domainTime).range(rangeTime)
Insert cell
Plot.plot({
height: 4000,
axis: null,
y: { domain: [0, step] },
color: { scheme: "YlGnBu" },
facet: { data: dataSelected, y: "Name" },
marks: [
d3.range(bands).map((i) =>
Plot.areaY(dataSelected, {
x: "StartTime",
y: (d) => d.Value - i * step,
fill: i,
clip: true,
sort: "StartTime"
})
),
Plot.text(
dataSelectedScaled,
Plot.selectFirst({
text: "Name",
frameAnchor: "top-left",
dx: 6,
dy: 6
})
),
Plot.frame()
]
})
Insert cell
dataSelectedScaled = dataSelected.map((d) => ({
...d,
ValueScaled: d.Value * Math.pow(10, 12)
}))
Insert cell
bands = 7
Insert cell
step = d3.max(dataSelected, (d) => d.Value) / bands
Insert cell
Insert cell
dataSelected = data.filter((d) =>
turf.booleanWithin(turf.point([d.Longitude, d.Latitude]), circle)
)
Insert cell
dataSelected.map((d) => d.EndTime)
Insert cell
features = turf.featureCollection(data.map((d) => turf.point([d.Longitude, d.Latitude])))
Insert cell
bbox = turf.envelope(features)
Insert cell
Insert cell
circle = d3
.geoCircle()
.center(center)
.radius((kms / (6371 * Math.PI * 2)) * 360)
.precision(2)()
Insert cell
Insert cell
// locations = getLocations(parsed)
Insert cell
// data = getData(parsed)
Insert cell
data
.map((d) => String(d.EndTime))
.filter((value, index, self) => self.indexOf(value) === index)
Insert cell
parsed = parse(fr_irsnfr_202307032200_doserates)
Insert cell
metadata = parsed.Report.Identification
Insert cell
Insert cell
Insert cell
Insert cell
import { parse, getData, getLocations } from "@francobollo/irix-parser"
Insert cell
turf = require("@turf/turf@6")
Insert cell
world = (
await fetch("https://cdn.jsdelivr.net/npm/world-atlas@2/land-50m.json")
).json()
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
data = _.flatten(
[
fr_irsnfr_202307040800_doserates,
fr_irsnfr_202307040700_doserates,
fr_irsnfr_202307040600_doserates,
fr_irsnfr_202307040500_doserates,
fr_irsnfr_202307040400_doserates,
fr_irsnfr_202307040300_doserates,
fr_irsnfr_202307040200_doserates1,
fr_irsnfr_202307040100_doserates
].map((d) => getData(parse(d)))
)
Insert cell
locations = _.flatten(
[
fr_irsnfr_202307040800_doserates,
fr_irsnfr_202307040700_doserates,
fr_irsnfr_202307040600_doserates,
fr_irsnfr_202307040500_doserates,
fr_irsnfr_202307040400_doserates,
fr_irsnfr_202307040300_doserates,
fr_irsnfr_202307040200_doserates1,
fr_irsnfr_202307040100_doserates
].map((d) => getLocations(parse(d)))
)
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