===== ANALYSIS.md ===== # One weather archive, one story The unified demo asks: **What makes a day exceptional?** It opens with a result found in the supplied file, then distinguishes three different descriptions of rarity: a recorded temperature, the archive's supplied integer rank, and the observed count in a comparable seasonal window. It does not claim a return period, a causal explanation, or a climate trend. ## Evidence Reproduce with `python3 examples/story/weather/analyze.py`. The exact source hash, profile, year counts and independently computed half-degree bins are in [weather-analysis.json](weather-analysis.json). The controlling source is `examples/story/weather/archive.json`, copied from the earlier case-study archive. No external station series has been substituted. | Check | Result | Consequence | | --- | --- | --- | | Grain / duplicates | 82,033 date-and-measure records; 0 duplicate keys | Each selected point/unit is one recorded daily measure | | Daily maxima | 41,016, 1910-01-01–2022-04-19 | The final year is partial | | Daily minima | 41,017, 1910-01-01–2022-04-20 | Measure-specific coverage differs by one day | | Missing dates | 2021-07-08 in both measures | Missing observations remain missing, never zero | | Paired minimum > maximum | 0 | No contradiction in paired daily values was found | | Source labels | 80,354 acorn; 1,679 raw | Provenance/preparation cannot be independently recovered from these labels | | Maximum daily maximum | Unique 45.9°C, 2009-02-07, acorn-labelled | An archive-specific opening fact; not an independently verified station-record claim | | Default seasonal window | 31 January–14 February; 1,695 observations / 113 years | A same-season reference rather than a summer/winter comparison | | Supplied rank ≥95 | 118 / 1,695 = 6.96%, displayed 7.0% | Not exactly the top 5% of this window | | Supplied rank ≥100 | 21 observations, 39.5–45.9°C | An integer rank label does not isolate the single maximum | | Observations ≥45.9°C in the window | 1 | An observed sample count, not a forecast probability or return period | The supplied percentile reference population and rounding procedure are unknown. This is a material limit for rank interpretation. The mixed source labels and incomplete final year also prevent an unqualified climate-trend reading. The 2009 line gives the opening a time sequence: five archived daily maxima at or above 40°C (20, 28, 29, 30 January and 7 February). The 28–30 January values are 43.2, 44.1 and 44.9°C. The maximum on 8 February is 20.9°C, 25°C lower than the previous day's maximum. This describes consecutive daily maxima, not an instantaneous temperature drop. The chosen seasonal window starts on 31 January and therefore excludes the earlier three-day run; that selection limit is visible in the story instead of treating a ±7-day window as the whole episode. ## Narrative and charts 1. **One year:** a native line chart places the starting date in the complete 2009 record (365 daily maxima). Other selections show their actual available records, including partial years. 2. **Same season:** points show the ±7-day common-calendar window across available years. The observed count at or above the selected temperature is explicit. 3. **Choose the tail:** the percentile control filters native point data. Prose reads the native filtered rows and reports both the selected count and its actual seasonal-window denominator. 4. **Keep their dates:** the same selected identities move to year stacks. The chart locates records in time without asserting a trend. Slots are inherited from the full window, so subset gaps are explained. 5. **Read their temperatures:** the same identities move to temperature stacks. The actual selected temperature range is stated in the prose. 6. **One dot per day:** selected source records become native unit marks in 0.5°C bins. One mark still represents one observation. 7. **The distribution:** native bar rollup counts those same selected records. The sum of bin counts must equal the point and unit population. Empty bins retain a slot in the native bar domain, so gaps preserve the half-degree spacing without adding artificial zero-valued observations. The single story preserves the strongest parts of both earlier demos. Station locations are omitted because the archive contains observations for Melbourne only. A single-year 1910 comparison is omitted because it is a weak basis for judging rarity. Restoring all days and comparing an annual histogram to a seasonal subset are omitted to avoid changing the denominator during the final argument. Old weather adapter exports remain compatible with saved MDX documents, but the Studio toolbar and both example URLs resolve to one authored story. ## Calendar and selection rules Seasonal comparison maps month/day to a common non-leap reference year (2001), using the smaller circular distance on 365 days, inclusive ±7 days. February 29 observations are excluded from seasonal windows. A February 29 selection uses February 28 as its seasonal centre, while its actual selected observation and annual line are retained. This avoids shifting all dates after February in leap years. Windows wrap around New Year and use available records only; coverage near archive boundaries is not silently completed. The annual line uses actual day-of-year and retains leap days. Every data-derived sentence follows the selected date/measure/threshold. Static 2009 facts explicitly say they describe the starting settings. High-ranked daily minima mean warm nights. The story does not substitute other stations' observations or fill gaps. ## Verification Archive predicates independently establish the opening maximum, seasonal sample, rank counts and per-bin totals. Browser checks cover all seven views in both directions, hashes, actual selected marks, control/prose/style edits, archive retry, missing observations, minimum-temperature wording, narrow layouts and slider latency. Native filtered row IDs, unit row IDs and histogram sums are reconciled. ===== PROVENANCE.md ===== # Melbourne archive from case_David_2 This is a local archive from the user's predecessor case study, not a live feed. - Original: `case_David_2/src/data/rich_mel_data.csv` - Original SHA-256: `9c26a773b23d96d3398c2f44c547d6785beacc8dcf5794ecc6c1db21fa19a27a` - 82,033 records; city `Melbourne` only; unique `(date, type)`. - `tmax`: 41,016 records, 1910-01-01 through 2022-04-19. - `tmin`: 41,017 records, 1910-01-01 through 2022-04-20. - Original source labels: 80,354 `acorn`, 1,679 `raw`. - No empty temperatures, no imputation, no downsampling. Each tuple in `archive.json` follows its `columns` declaration: `date, metric, temperature, percentile, source, day_of_year`. The numeric values and ranks are preserved from the original CSV. Other original derived columns are omitted because they are not used by this story. The original preparation script, full upstream attribution and percentile reference population have not been recovered. The story calls these archived observations and archived percentile ranks; it does not claim an independently verified climate baseline. These city-level records are not identified solely with the station ID shown in the separate location list. `prepare-data.mjs` selects the January 31–February 14 window and emits tidy `data.json` for this website. The original full archive remains in the repository; the website serves the prepared rows without the full archive download. ===== chart.mjs ===== import {point} from 'visdelta/point'; import {bar} from 'visdelta/bar'; /** Tidy archived observations are supplied before constructing charts. */ export function states(rows,metric,threshold) { const base=point(rows.filter(row=>row.metric===metric)).key('id').datumKey('id') .x('calendar_day',{label:'Seasonal day (January 31–February 14)',format:'d'}) .y('temperature',{label:'Temperature (°C)'}) .color('series',{domain:['2009','Other years'],range:['#dc532d','#b9bec4']}) .pointSize(2.8).tooltip(['date','temperature','percentile','source']); const extreme=base.where({percentile:{gte:threshold}}); return [base,base.highlight({year:2009}),extreme, extreme.x('year',{label:'Year',format:'d'}), extreme.x('temperature',{label:'Temperature (°C)'}).y('year',{label:'Year',format:'d'})]; } export function distribution(rows,metric,threshold){ return bar(rows.filter(row=>row.metric===metric)).datumKey('id').where({percentile:{gte:threshold}}) .x('bin',{label:'Temperature bin (°C), width 0.5°C'}).y('one',{label:'Archived days'}) .rollup({op:'sum',label:'Archived days'}).sort('bin'); } ===== index.html ===== One hot day, a century of context · VisDelta Story

Archived Melbourne observations · 1910–2022

One hot day,
a century of context.

The archive records 45.9°C on 7 February 2009. A hot day tells us little on its own. Compare observations from the same 15-day seasonal window, then rearrange the same days to see their dates and temperatures.

This is a historical example, not a live weather service or a climate attribution study.

Loading archived observations…

Keep the season comparable.

Each dot is one archived observation between January 31 and February 14. A common calendar aligns the same month and day across years. Missing observations remain missing.

Locate 2009 in that context.

Highlighting preserves every observation. Orange marks identify 2009; the surrounding years remain available for comparison.

Ask which days were unusual.

The filter uses the archive’s supplied percentile ranks. It changes the participating days. It does not recompute those ranks or establish a new climate baseline.

Spread the same days across years.

Changing the horizontal field exposes when the selected observations occurred. Their keys, temperatures and archived ranks stay attached to the same dots.

Read temperature and year together.

One final remapping places temperature horizontally and year vertically. This view invites a comparison, not a causal conclusion; station history and the original ranking method require independent evidence.

Count the days behind the ranks.

At the initial maximum-temperature threshold, 118 of 1,695 seasonal observations have archived rank ≥95. That is an observed archive count, not a return period or a recalculated percentile.

===== main.mjs ===== import {render} from './runtime.mjs'; import {mount as mountCharts} from './mount.mjs'; import {states,distribution} from './chart.mjs'; const host=document.querySelector('#chart'); const position=document.querySelector('#position'); const metric=document.querySelector('#metric'); const threshold=document.querySelector('#threshold'); const status=document.querySelector('#status'); const steps=[...document.querySelectorAll('[data-step]')]; const rows=await fetch('./data.json').then(response=>{if(!response.ok)throw Error('Archive could not be loaded.');return response.json();}); let controller,summary,generation=0,frame,anchors=[],disposed=false; function measure(){anchors=steps.map(step=>scrollY+step.getBoundingClientRect().top-innerHeight*.55);} function seek(value){position.value=String(value);void controller?.seek(value).catch(error=>status.textContent=error.message);steps.forEach((step,index)=>step.setAttribute('aria-current',Math.round(value)===index?'step':'false'));} function scroll(){if(frame)return;frame=requestAnimationFrame(()=>{frame=null;const end=anchors.findIndex(anchor=>scrollYrow.metric===metric.value).length.toLocaleString()} archived days · ${metric.selectedOptions[0].text} · no imputation`; document.documentElement.dataset.storyReady='true'; }catch(error){next?.destroy();mount.remove();nextSummary?.destroy();summaryMount.remove();if(revision===generation)status.textContent=error.message;} } position.addEventListener('input',()=>{const value=Number(position.value);seek(value);const index=Math.floor(value);scrollTo({top:index<4?anchors[index]+(value-index)*(anchors[index+1]-anchors[index]):anchors[4],behavior:'instant'});}); metric.addEventListener('change',()=>void build()); threshold.addEventListener('change',()=>void build()); threshold.addEventListener('input',()=>document.querySelector('#percentile').value=threshold.value); addEventListener('scroll',scroll,{passive:true}); let width=host.clientWidth; const resize=new ResizeObserver(()=>{if(host.clientWidth!==width){width=host.clientWidth;measure();controller?.resize();summary?.resize();scroll();}});resize.observe(host); addEventListener('resize',measure);measure();await build();scroll(); addEventListener('pagehide',()=>{disposed=true;generation++;controller?.destroy();summary?.destroy();resize.disconnect();cancelAnimationFrame(frame);removeEventListener('scroll',scroll);removeEventListener('resize',measure);},{once:true}); ===== mount.mjs ===== import {transition} from 'visdelta/transition'; import {render} from './runtime.mjs'; /** A case-local cache: prepare only the endpoint or pair the reader requests. */ export function mount(target,states){ const cache=new Map(); let disposed=false,ticket=0,active; const dimensions=()=>({width:target.clientWidth,height:target.clientHeight}); function prepare(index,endpoint){ const key=`${endpoint?'state':'leg'}:${index}`; if(cache.has(key))return cache.get(key); const host=document.createElement('div');host.dataset.active='false';host.setAttribute('aria-hidden','true');host.style.cssText='position:absolute;inset:0;visibility:hidden';target.append(host); const pending=(async()=>{ try{ const controller=endpoint?await render(host,states[index],dimensions()):await transition(states[index],states[index+1],{target:host,...dimensions()}); if(disposed){controller.destroy();host.remove();return;} return {host,controller,endpoint}; }catch(error){host.remove();cache.delete(key);throw error;} })(); cache.set(key,pending);target.dataset.prepared=String(cache.size);return pending; } return { async seek(value){ const revision=++ticket; const position=Math.max(0,Math.min(states.length-1,value)); const index=Math.floor(position),endpoint=Number.isInteger(position); const next=await prepare(index,endpoint); if(!next||disposed||revision!==ticket)return; if(active&&active!==next){active.host.style.visibility='hidden';active.host.dataset.active='false';active.host.setAttribute('aria-hidden','true');} if(!endpoint)next.controller.progress(position-index); next.host.style.visibility='';next.host.dataset.active='true';next.host.removeAttribute('aria-hidden');active=next;target.dataset.position=String(position); }, resize(){for(const pending of cache.values())void pending.then(value=>{if(!disposed)value?.controller.resize(dimensions());},()=>{});}, destroy(){if(disposed)return;disposed=true;ticket++;for(const pending of cache.values())void pending.then(value=>{value?.controller.destroy();value?.host.remove();},()=>{});cache.clear();}, }; } ===== prepare-data.mjs ===== // Run once when changing the archived example's seasonal window. This is data preparation, not chart code. import {readFile,writeFile} from 'node:fs/promises'; const archive=JSON.parse(await readFile(new URL('./archive.json',import.meta.url),'utf8')); const rows=archive.rows.map(values=>Object.fromEntries(archive.columns.map((column,index)=>[column,values[index]]))) .filter(row=>row.date.slice(5)!=='02-29') .map(row=>({...row,year:Number(row.date.slice(0,4)),calendar_day:Math.round((Date.parse(`2001-${row.date.slice(5)}T00:00:00Z`)-Date.UTC(2001,0,1))/86400000)+1})) .filter(row=>Math.abs(row.calendar_day-38)<=7) .map(row=>({...row,id:`${row.date}-${row.metric}`,one:1,bin:Math.floor(row.temperature*2)/2,series:row.year===2009?'2009':'Other years'})); await writeFile(new URL('./data.json',import.meta.url),JSON.stringify(rows)+'\n'); ===== runtime.mjs ===== import {createRenderer} from 'visdelta/render'; import {pointModule} from 'visdelta/point'; import {barModule} from 'visdelta/bar'; export const {render}=createRenderer({modules:[pointModule,barModule]});