Chapter 4 of The Nature of Code, Particle Systems, builds emitters that spawn short-lived particles at a controlled rate. The controlling variable here is a measured concentration of airborne particles.

I let Open-Meteo PM2.5 readings set each city’s spawn rate, so the particle system is driven by measured particulate load rather than a fixed emitter constant.

Each of three cities is an emitter whose spawn rate and particle color are set by its current PM2.5 reading, the mass concentration of fine particulate matter, from the Open-Meteo air-quality forecast. The rendered particles stand for the measured particulates, so the emission rate is a physical scalar rather than a chosen constant.

Each particle integrates by explicit (forward) Euler, \(\mathbf{x}_{t+1} = \mathbf{x}_t + \mathbf{v}_t\,\Delta t\), and carries a finite lifespan. The number spawned per frame is proportional to concentration, \(r \propto C_{\text{PM2.5}}\), where \(C\) is in \(\mu\mathrm{g}/\mathrm{m}^3\); the WHO 24-hour guideline is \(15\,\mu\mathrm{g}/\mathrm{m}^3\). PM2.5 denotes particulate matter with aerodynamic diameter \(\le 2.5\,\mu\mathrm{m}\).

Data source: Open-Meteo Air Quality API
Endpoint: https://air-quality-api.open-meteo.com/v1/air-quality?latitude=...&longitude=...&hourly=pm2_5
Access: Public, no key. Loaded from an hourly server-side refresh when possible, with a bundled snapshot fallback, and a live browser fetch only when the API allows CORS. Data window: Oct 26, 2026 (pulled Oct 26, 2026 UTC)

Latest data pull 72 rows
Oct 26, 2026 (pulled Oct 26, 2026 UTC)
City
Hour
PM2.5 (µg/m³)
Berlin
0
4
Berlin
1
4.4
Berlin
2
4.6
Berlin
3
4.6
Berlin
4
4.8
Berlin
5
5.1
Berlin
6
5.9
Berlin
7
6.4
Berlin
8
7
Berlin
9
6.4
Berlin
10
6.5
Berlin
11
5.7
Berlin
12
5.6
Berlin
13
5.9
Berlin
14
6.4
Berlin
15
7.4
Berlin
16
8.6
Berlin
17
9.6
Berlin
18
9.6
Berlin
19
9.3
Berlin
20
8.9
Berlin
21
9.1
Berlin
22
9.3
Berlin
23
8.9
Delhi
0
72.6
Delhi
1
75.7
Delhi
2
80.1
Delhi
3
81
Delhi
4
75
Delhi
5
58.7
Delhi
6
46.7
Delhi
7
45.9
Delhi
8
48
Delhi
9
51.1
Delhi
10
57.7
Delhi
11
66.1
Delhi
12
79.6
Delhi
13
94.8
Delhi
14
104.8
Delhi
15
112.2
Delhi
16
117.6
Delhi
17
120.1
Delhi
18
118.3
Delhi
19
112.7
Delhi
20
105.9
Delhi
21
99.4
Delhi
22
93.6
Delhi
23
89.2
Los Angeles
0
11.1
Los Angeles
1
9.7
Los Angeles
2
12
Los Angeles
3
14.8
Los Angeles
4
17.9
Los Angeles
5
20.2
Los Angeles
6
22.1
Los Angeles
7
24.4
Los Angeles
8
27.7
Los Angeles
9
30.5
Los Angeles
10
32.1
Los Angeles
11
33.8
Los Angeles
12
35
Los Angeles
13
35.9
Los Angeles
14
36.4
Los Angeles
15
37.7
Los Angeles
16
32.8
Los Angeles
17
21.4
Los Angeles
18
15.7
Los Angeles
19
13.2
Los Angeles
20
11.7
Los Angeles
21
10.6
Los Angeles
22
9.6
Los Angeles
23
8.6

All 72 hourly PM2.5 samples are listed below.