import { aq, op } from "@uwdata/arquero"

bucket_base = "https://d33173dkfxwa5x.cloudfront.net/www/"

FA = FileAttachment
  import {aq as aq, op as op} from "@uwdata/arquero"
bucket_base = "https://d33173dkfxwa5x.cloudfront.net/www/"
FA = ƒ(name)
stationId = "014825"
statsPlace = Object {isit_answer: "Hell no!", isit_comment: "Are you kidding?! It's bloody cold", isit_maximum: 22.3, isit_maximum_dt: "2025-07-01T01:40:00+00:00", isit_minimum: 7.8, isit_minimum_dt: "2025-06-30T22:04:00+00:00", isit_current: 15.05, isit_average: 3.3000000000000003, isit_name: "Victoria River Downs", isit_label: "Victoria River Downs", isit_span: "1965 - 2023"}

Is it hot in Victoria River Downs right now?

answers = ({
  "Hell no!":   {color: "white",   fill1: "#5287d1", fill2: "#2166ac" },
  "No!":        {color: "white",   fill1: "#a2cdeb", fill2: "#67a9cf" },
  "Nope":       {color: "#333333", fill1: "#f5f8fa", fill2: "#d1e5f0" },
  "Not really": {color: "#333333", fill1: "#f7f7f7", fill2: "#ebebeb" },
  "Yup":        {color: "#333333", fill1: "#fddcca", fill2: "#f7cfb7" },
  "Yeah!":      {color: "white",   fill1: "#de7b49", fill2: "#fc946a" },
  "Hell yeah!": {color: "white",   fill1: "#d1231d", fill2: "#b2182b" }
})

html`
<div class="answer-icon-and-label">
  <span class="answer-icon" style="background-color: ${answers[statsPlace.isit_answer].fill2};">
  </span>
  <span>${statsPlace.isit_answer}</span>
</div>`
answers = Object {Hell no!: Object, No!: Object, Nope: Object, Not really: Object, Yup: Object, Yeah!: Object, Hell yeah!: Object}
Hell no!
md`${statsPlace.isit_comment}`

Are you kidding?! It's bloody cold

Here’s how today compares…

datefns = import("https://cdn.skypack.dev/date-fns@3.3.1?min")
tmaxWhen = new Date(Date.parse(statsPlace.isit_maximum_dt || null))
tminWhen = new Date(Date.parse(statsPlace.isit_minimum_dt || null))

tmaxWhenFriendly = isFinite(tmaxWhen) ?
  datefns.formatRelative(tmaxWhen, new Date()) : ""
tminWhenFriendly = isFinite(tminWhen) ?
  datefns.formatRelative(tminWhen, new Date()) : ""

percentRating = statsPlace.isit_average.toFixed(1) + "%"
datefns = Module {add: ƒ(t, c), addBusinessDays: ƒ(o, e), addDays: ƒ(e, r), addHours: ƒ(t, r), addISOWeekYears: ƒ(e, r), addMilliseconds: ƒ(t, r), addMinutes: ƒ(o, s), addMonths: ƒ(o, r), addQuarters: ƒ(o, r), addSeconds: ƒ(t, d), addWeeks: ƒ(o, r), addYears: ƒ(o, r), areIntervalsOverlapping: ƒ(n, o, f), clamp: ƒ(o, t), closestIndexTo: ƒ(s, N), closestTo: ƒ(e, u), compareAsc: ƒ(r, f), compareDesc: ƒ(r, f), constructFrom: ƒ(t, e), daysToWeeks: ƒ(e), …}
tmaxWhen = 2025-07-01T01:40Z
tminWhen = 2025-06-30T22:04Z
tmaxWhenFriendly = "today at 1:40 AM"
tminWhenFriendly = "yesterday at 10:04 PM"
percentRating = "3.3%"

md`${statsPlace.isit_minimum} °C  `

7.8 °C

md`${tminWhenFriendly}`

yesterday at 10:04 PM

md`${statsPlace.isit_maximum} °C  `

22.3 °C

md`${tmaxWhenFriendly}`

today at 1:40 AM

html`
<div class="answer-icon-and-label">
  <span class="answer-icon" style="background-color: ${answers[statsPlace.isit_answer].fill2};"></span>
  <span>${statsPlace.isit_current.toFixed(1)} °C</span>
</div>`
15.1 °C
md`Average so far<br>hotter than **${percentRating}** of days for this time of year.`

Average so far
hotter than 3.3% of days for this time of year.

This is the distribution of temperatures typical for this time of year, which we’ve defined as a seven day window either side of today. Just like a bell curve, the plot is higher at more common temperatures and lower at rare temperatures.

… and the rest of the year.

We’ve compared every day this year at Victoria River Downs to similar times of year in the past. Red days were hot compared to records; blue days were cold.

heatmapYear = "2025"

Here’s how the rest of Australia looks today so far.

nowHour = (new Date()).getUTCHours()
nowHour >= 10 && nowHour <= 22 ?
  md`Some places may still be cooling off as the night continues.` :
  md`Some places may still be heating up as the day continues.`
nowHour = 1

Some places may still be heating up as the day continues.

statsAllRaw = Object {066214: Object, 067105: Object, 063005: Object, 048245: Object, 086338: Object, 087031: Object, 070351: Object, 094029: Object, 040842: Object, 015590: Object, 014015: Object, 023000: Object, 009021: Object, 004032: Object, 091311: Object, 060168: Object, 076031: Object, 017043: Object, 039128: Object, 039083: Object, …}
statsAll = Array(54) [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, …]
currentStats = statsAll.filter(d => (!d.max_stale) && (!d.min_stale))
staleStats = statsAll.filter(d => d.max_stale || d.min_stale)
currentStats = Array(54) [Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, Object, …]
staleStats = Array(0) []
australia = Object {type: "FeatureCollection", name: "australia", crs: Object, features: Array(1)}
Plot = Module {Area: class, Arrow: class, BarX: class, BarY: class, Cell: class, Contour: class, Density: class, Dot: class, Frame: class, Geo: class, Hexgrid: class, Image: class, Line: class, Link: class, Mark: class, Raster: class, Rect: class, RuleX: class, RuleY: class, Text: class, …}
answer_domain = Array(7) ["Hell no!", "No!", "Nope", "Not really", "Yup", "Yeah!", "Hell yeah!"]
// breaking out the pointer layer for readability
// (and in case we decide to customise it later)
tipTemplate = Plot.pointer({
  x: "lon",
  y: "lat",
  channels: {
    place: {
      label: "",
      value: d => d.isit_label,
    },
    label: {
      label: "",
      value: d => d.isit_comment
    },
    separator: {
      label: "",
      value: d => ""
    },
    isit_maximum: {
      label: "Max:",
      value: d => d.isit_maximum + "°C"
    },
    isit_minimum: {
      label: "Min:",
      value: d => d.isit_minimum + "°C"
    }
  },
  fontSize: 20,
  fontFamily: "Roboto Condensed",
  format: {
    x: null,
    y: null
  },
  lineWidth: 20,
  lineHeight: 1.25,
  pointerSize: 0,
  fillOpacity: 0.8,
  strokeOpacity: 0
})
tipTemplate = Object {x: "lon", y: "lat", channels: Object, fontSize: 20, fontFamily: "Roboto Condensed", format: Object, lineWidth: 20, lineHeight: 1.25, pointerSize: 0, fillOpacity: 0.8, strokeOpacity: 0, render: ƒ(n, r, o, i, l, s)}

See websites from our international colleagues