generated from ParametricPress/issue-02-article-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.idyll
1922 lines (1624 loc) · 86.8 KB
/
index.idyll
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
[meta title:"Your Personal Carbon History" description:"You’ve lived through a period of unprecedented carbon emissions."
shareImageUrl:"https://parametric.press/issue-02/carbon-history/static/images/share.png"
shareImageWidth:"880"
shareImageHeight:"440" /]
[var name:"parametricSlug" value:"carbon-history" /]
[Nav fullWidth:true /]
[Header
title:`["Your Personal", "Carbon History"]`
longTitle:`["Your Personal", "Carbon History"]`
date:"October 19, 2020"
dek:"Why you’ve lived through a period of unprecedented carbon emissions."
fullWidth:true
authors:`[{
name: "Aatish Bhatia",
role: "author",
url: "https://aatishb.com/"
}]`
doi:"https://zenodo.org/badge/latestdoi/245052678"
archive:"https://parametric-press-archives.s3-us-west-2.amazonaws.com/issue-02.wacz"
source:`"https://github.com/ParametricPress/02-" + parametricSlug `
/]
[data name:"co2" source:"CO2.csv" /]
// NOTE: Set readerMode to true before publishing
[var name:"readerMode" value:true /]
Humans have been burning fossil fuels on an industrial scale for hundreds of years.
So you might guess that your life is just a blip in the centuries-long story of human carbon emissions.
Let's take a closer look at this assumption.
To get started, make a guess by dragging the slider below.
[var name:"guessPercent" value:0 /]
[Range value:guessPercent min:0 max:100 /]
I guess that [Display value:guessPercent format:"d" /][span style:`{color: "#fff"}`]%[/span] of all human carbon dioxide emissions occurred during my lifetime.
[var name:"guessMade" value:false /]
[Button onClick:`guessMade = true`]
Submit
[/Button]
[div fullWidth:true ]
[Conditional if:`guessMade || !readerMode`]
[TextContainer]
[br/]
What's the right answer? To find out, select the year you were born, and we'll pull up the numbers for your lifetime.
[var name:"birthYear" value:"1985" /]
I was born in [Select value:birthYear options:`Array(96).fill(0).map((e,i) => 1920 + i).map(e => e.toString())` /]
[var name:"birthYearSelected" value:false /]
[Button onClick:`birthYearSelected = true`]
Submit
[/Button]
[/TextContainer]
[Conditional if:`birthYearSelected || !readerMode`]
[TextContainer]
[br/]
You guessed that [Display value:guessPercent format:"d" /][span style:`{color: "#fff"}`]%[/span] of human carbon dioxide emissions occurred during your lifetime.
In reality, about [Display value:`100 * getCO2Fraction(birthYear)` format:"d"/][span style:`{color: "#fff"}`]%[/span] of human-caused carbon dioxide emissions occurred since you were born.
**If you're in high school**, roughly a quarter of all human carbon emissions occurred during your lifetime.
**If you're old enough to vote**, more than a third of all human carbon emissions occurred in your life.
**If you're old enough to run for president**, more than half of all human carbon emissions occurred in your life.
**If you're old enough to retire**, more than three-quarters of all human carbon emissions occurred in your life.
And that's just through 2019.
As we emit more carbon dioxide, the fraction emitted in your life will continue to grow.
[/TextContainer]
[var name:"ages" value:`Array(20).fill(0).map((e,i) => 5 * (i+1))` /]
[PlotlyComponentHover
isVisible: birthYearSelected
data: `[{
type: 'bar',
x: ages,
y: ages.map(e => 100 * getCO2Fraction(currentYear - e)),
text: ages.map(e => 100 * getCO2Fraction(currentYear - e)).map(e => Math.round(e)+'%'),
hoverinfo: 'text',
hoverlabel: { bgcolor: "#FFF"},
marker: {
color: ages.map(e => '#666666'),
},
}]`
layout: `(width) => ({
title: 'What Fraction of CO₂ Emissions Happened in a Lifetime?',
width: width,
height: Math.max(width / 1.61803 - 96, 300),
paper_bgcolor: '#222222',
plot_bgcolor: '#222222',
xaxis: {
title: {
text: 'Age',
},
dtick: 5,
color: '#7e7e7e',
fixedrange: true,
titlefont: {
size: 10 * width / 720
},
tickfont: {
size: 10 * width / 720
},
},
yaxis: {
title: {
text: '% Human CO₂ Emissions Emitted Within This Lifetime',
standoff: 10 * width / 720,
},
range: [0, 101],
color: '#7e7e7e',
fixedrange: true,
titlefont: {
size: 10 * width / 720
},
tickfont: {
size: 10 * width / 720
},
},
font: {
family: 'Graphik Web',
color: '#ffffff',
size: 16 * width / 720
},
margin: {
l: 100 * width / 720,
r: 50 * width / 720,
b: 50 * width / 720,
t: 100 * width / 720,
pad: 4 * width / 720
},
});`
/]
[caption]
Every age above shows the percentage of human CO₂ emissions that occurred within that lifetime.
*Human CO₂ emissions* are defined here as the rise in atmospheric CO₂ levels between the pre-industrial value of [280 parts per million](https://www.esrl.noaa.gov/gmd/ccgg/trends/weekly.html) and the 2019 average value.
This graph is inspired by one created by [link text:"Neil Kaye" url:"https://twitter.com/neilrkaye/status/1129347990777413632" /].
**Data Source:** CO₂ values compiled from [Keeling Curve](https://library.ucsd.edu/dc/object/bb3859642r) (1959 onwards) and [Law Dome Ice Core](https://www.ncdc.noaa.gov/paleo-search/study/9959) (before 1959).
[/caption]
[TextContainer]
We tend to think of the climate crisis as a historical problem.
But these numbers tell a different story.
The bulk of carbon emissions were emitted in just 35 years—a single generation.
No humans before us have ever witnessed such a steep rise in carbon dioxide.
To better understand this recent surge in carbon dioxide levels, let's take a personalized tour of the history of CO₂—personalized around *you*.
We'll trace our way backward through the years of your life, measuring carbon dioxide levels along the way.
And after reaching your birthday, we'll keep going, putting your life in the perspective of the millions of years that preceded it.
## Part 1: Your Life
To chart the history of carbon emissions, we first need to know how carbon dioxide is measured.
The unit used to measure CO₂ concentration is *parts per million*, or *ppm* for short.
A 1 ppm concentration of CO₂ means that one out of every million parts of air is carbon dioxide.
If we could see the world from the perspective of a molecule, here's what this might look like.
// for full screen viz, uncomment the following line and comment out the [/TextContainer] after the viz (around line 361)
// [/TextContainer]
[var name:"vizppm" value:1 /]
// p5 ppm visualization
[var name:"pauseAnimation1" value:true /]
[p5Component
ppm: vizppm
pauseAnimation: pauseAnimation1
onEnterView: `pauseAnimation1 = false`
onExitViewFully: `pauseAnimation1 = true`
className: "center"
resize: birthYearSelected
sketch:`(p, parent) => {
// visualizing ppm at different levels
// modifying code by Daniel Shiffman
// http://codingtra.in
// http://patreon.com/codingtrain
// Code for: https://youtu.be/17WoOqgXsRM
let canvas;
let stars, volume, depth;
let zoom = 6;
let speed = 10;
let concentration = 1;
function init() {
depth = 2 * p.width;
p.fill('255');
p.textSize(12);
p.textAlign(p.LEFT, p.CENTER);
p.noStroke();
volume = p.round((2*p.width) * (2*p.height) * depth / p.pow(zoom,3));
let numStars = p.round(volume * concentration / 1000000);
stars = [];
for (let i = 0; i < numStars; i++) {
stars.push(new Star());
}
}
p.setup = function() {
canvas = p.createCanvas(400,400);
let myWidth = canvas.canvas.parentElement.clientWidth;
p.resizeCanvas(myWidth,myWidth);
p.noLoop();
p.textFont('Graphik Web');
init();
};
p.draw = function() {
p.background('#222222');
p.text(concentration + ' ppm', 10, p.height - 10);
p.translate(p.width / 2, p.height / 2);
for (let star of stars) {
star.update();
star.show();
}
};
function Star() {
this.x = p.random(-p.width, p.width);
this.y = p.random(-p.height, p.height);
this.z = p.random(depth);
this.update = function() {
this.z = this.z - speed;
if (this.z < 1) {
this.z = depth;
this.x = p.random(-p.width, p.width);
this.y = p.random(-p.height, p.height);
}
};
this.show = function() {
p.circle(p.map(this.x / this.z, 0, 1, 0, p.width),
p.map(this.y / this.z, 0, 1, 0, p.height),
p.map(this.z, 1, depth, zoom, 1));
};
}
p.windowResized = function() {
let myWidth = canvas.canvas.parentElement.clientWidth;
p.resizeCanvas(myWidth,myWidth);
init();
}
p.onUpdate = function(props, oldProps) {
if (props.pauseAnimation !== oldProps.pauseAnimation) {
if (props.pauseAnimation) {
p.noLoop();
} else {
p.loop();
}
}
if (props.ppm !== oldProps.ppm) {
concentration = props.ppm;
init();
}
};
}
`
/]
[Aside]
[Conditional if:`vizppm == 1`]
[span className:"pull-number"]1 ppm[/span]
[span className:"pull-number-text"]
At 1 part per million, a few lone CO₂ molecules drift by.
Carbon dioxide is the main contributor to Earth's greenhouse effect, and without the greenhouse effect, we'd have a very, very cold planet—an average global temperature of about 0°F (-18°C).
[/span]
[/Conditional]
[Conditional if:`vizppm == 10`]
[span className:"pull-number"]10 ppm[/span]
[span className:"pull-number-text"]
At 10 parts per million, a handful of CO₂ molecules pass by.
At CO₂ levels this low, Earth would largely be a frozen, lifeless rock.
[/span]
[/Conditional]
[Conditional if:`vizppm == 100`]
[span className:"pull-number"]100 ppm[/span]
[span className:"pull-number-text"]
At 100 parts per million, more and more CO₂ molecules pass by.
We're dialing up the greenhouse effect and warming up the Earth.
[/span]
[/Conditional]
[Conditional if:`vizppm == 280`]
[span className:"pull-number"]280 ppm[/span]
[span className:"pull-number-text"]
280 parts per million was the CO₂ level before the Industrial Revolution.
Global average temperatures were roughly 1°C cooler than they are today.
[/span]
[/Conditional]
[Conditional if:`vizppm == 412`]
[span className:"pull-number"]412 ppm[/span]
[span className:"pull-number-text"]
412 parts per million was the CO₂ level in 2019.
This raised Earth's temperature by about 1°C compared to pre-industrial times.
[/span]
[/Conditional]
[/Aside]
[br/]
[var name:"ppmVizCompleted" value:false /]
[div className:"buttonwrapper"]
[Button onClick:`vizppm = 1` className:`vizppm == 1 ? 'gray' : ''` ]
1 ppm
[/Button]
[Button onClick:`vizppm = 10` className:`vizppm == 10 ? 'gray' : ''` ]
10 ppm
[/Button]
[Button onClick:`vizppm = 100` className:`vizppm == 100 ? 'gray' : ''` ]
100 ppm
[/Button]
[Button onClick:`vizppm = 280` className:`vizppm == 280 ? 'gray' : ''` ]
280 ppm
[/Button]
[Button
className:`vizppm == 412 ? 'gray' : ''`
onClick:`
vizppm = 412;
ppmVizCompleted = true;
`]
412 ppm
[/Button]
[/div]
[Conditional if:`!ppmVizCompleted`]
[div className:"center"]
[instructions]Click the buttons above to increase CO₂ levels.[/instructions]
[/div]
[/Conditional]
// comment the following line and uncomment the above [/TextContainer] (around line 172) for full screen viz
[/TextContainer]
[Conditional if:`ppmVizCompleted || !readerMode`]
[TextContainer]
[br/]
Now that we have a sense for what a *part per million* looks like, we can see how carbon dioxide levels changed during your lifetime.
The graph below displays the average [span className:"green"]carbon dioxide level[/span] in 2019.
Use the button below to see how CO₂ levels have changed during your life.
[/TextContainer]
[var name:"graphYear" value:2019 /]
[derived name:"stepSize" value:`(2020 - birthYear) / 5` /]
[derived name:"graphData" value:`[{
x: co2.map(e => e.year),
y: co2.map(e => e.ppm),
mode: 'lines',
type: 'scatter',
hovertemplate: '%{x}: %{y:.4r} parts per million of CO₂<extra></extra>',
hoverlabel: { bgcolor: "#FFF"},
line: {
color:'#D8FFA2',
width: 4
}
}]` /]
[PlotlyComponent
isVisible:ppmVizCompleted
data: graphData
layout: `(width) => ({
title: 'Your Life in CO₂',
width: width,
height: Math.max(width/1.618 - 96, 300),
showlegend: false,
paper_bgcolor: '#222222',
plot_bgcolor: '#222222',
hovermode: 'closest',
font: {
family: 'Graphik Web',
size: 16 * width / 720,
color: '#ffffff',
},
xaxis: {
range: [graphYear == 2019 ? 2018.01 : graphYear - stepSize + 1, 2019.99],
tickformat: 'd',
fixedrange: true,
color: '#ffffff',
titlefont: {
size: 10 * width / 720
},
tickfont: {
size: 10 * width / 720
},
showline: true,
linecolor: '#ffffff',
linewidth: 2,
},
yaxis: {
range: [graphYear == 2019 ? 399 :
co2.filter(e => e.year >= graphYear).map(e => e.ppm).reduce((a,b) => a < b ? a : b) / 1.1, // min of yvalues in xrange
425
],
title: {
text: 'Carbon Dioxide Level (ppm)',
},
tickformat: 'd',
fixedrange: true,
color: '#D8FFA2',
titlefont: {
size: 10 * width / 720
},
tickfont: {
size: 10 * width / 720
},
tickprefix: ' ',
ticksuffix: ' ',
showline: false,
side: 'right'
},
margin: {
l: 25 * width / 720,
r: 80 * width / 720,
b: 25 * width / 720,
t: 50 * width / 720,
pad: 2 * width / 720
},
transition: {
duration: 1000,
easing: 'cubic-in-out',
ordering: 'traces'
},
annotations: [
makeAnnotation(0.5, graphYear, 2019, width/720, 'down', '2019', 0, 40 * 0.75 * width/720, 'center', 'top', true),
makeAnnotation(0.5, graphYear, 2017, width/720, 'up', 'US Leaves<br>Paris Agreement'),
makeAnnotation(0.5, graphYear, 2015, width/720, 'down', 'Paris Climate<br>Agreement Signed'),
makeAnnotation(0.5, graphYear, 2012, width/720, 'up', 'Curiosity Rover<br>Lands on Mars'),
makeAnnotation(0.5, graphYear, 2007, width/720, 'down', 'iPhone<br>Launched 📱'),
makeAnnotation(0.5, graphYear, 2005, width/720, 'up', 'YouTube<br>Created'),
makeAnnotation(0.5, graphYear, 2001, width/720, 'down', 'First Harry Potter<br>Movie Released 🧙'),
makeAnnotation(0.5, graphYear, 1997, width/720, 'up', 'Titanic Movie<br>Released 🚢'),
makeAnnotation(0.5, graphYear, 1991, width/720, 'down', 'Soviet Union<br>Dissolved ☭'),
makeAnnotation(0.5, graphYear, 1989, width/720, 'up', 'Berlin Wall<br>Comes Down 🧱'),
makeAnnotation(0.5, graphYear, 1977, width/720, 'down', 'Star Wars<br>Released'),
makeAnnotation(0.5, graphYear, 1969, width/720, 'up', 'Humans Land<br>on Moon 🚀'),
makeAnnotation(0.5, graphYear, 1957, width/720, 'down', 'Sputnik<br>Launched 🛰️'),
makeAnnotation(0.5, graphYear, 1945, width/720, 'up', 'World War II<br>Ends'),
makeAnnotation(0.5, graphYear, 1939, width/720, 'down', 'World War II<br>Begins'),
].filter(e => e.x != birthYear)
.filter(e => !(e.direction == 'up' && e.x > birthYear && e.x - birthYear < 5))
.filter(e => e.x >= graphYear)
.filter(e => e.font.size >= 5 * rescaleCached(width/720))
.concat(graphYear <= birthYear ? [makeAnnotation(0.5, graphYear, birthYear, width/720, 'up', 'You Were<br>Born!<br>🎂🎉', 0, 40 * 0.75 * width/720)] : [])
});`
/]
[caption]
**Data Source:** Annualy averaged CO₂ levels compiled from [Keeling Curve](https://library.ucsd.edu/dc/object/bb3859642r) (1959 onwards) and [Law Dome Ice Core](https://www.ncdc.noaa.gov/paleo-search/study/9959) (before 1959).
[/caption]
[var name:"partOneCompleted" value:false/]
[var name:"graph2Year" value:`birthYear` /]
[var name:"buttonEnabled" value:true /]
[div className:"buttonwrapper"]
[Button onClick:`
if (buttonEnabled) {
buttonEnabled = false;
if ((graphYear - 2 * stepSize) > birthYear) {
graphYear = graphYear - stepSize;
} else {
graphYear = birthYear;
graph2Year = birthYear;
partOneCompleted = true;
}
setTimeout(() => {
buttonEnabled = true;
}, 1000);
}
`
className:`graphYear == birthYear ? 'gray' : ''`
]
Travel Back in Time
[/Button]
[Button onClick:`graphYear = 2019`]
Restart
[/Button]
[/div]
[Conditional if:`!partOneCompleted`]
[Conditional if:`graphYear == 2019`]
[div className:"center"]
[instructions]Click the button above to travel back through the years of your life.[/instructions]
[/div]
[/Conditional]
[Conditional if:`graphYear < 2019`]
[div className:"center"]
[instructions]Keep going! Click the button above to travel back through the years of your life.[/instructions]
[/div]
[/Conditional]
[/Conditional]
[Conditional if:`partOneCompleted || !readerMode`]
[TextContainer]
[br/]
We've arrived at [Display value:birthYear format:"d" /], the year that you were born.
Since CO₂ levels have been rising throughout your life, you can express your age in terms of the carbon dioxide level at your birth.
[Aside]
[span className:"pull-number"] [span className:"graytext"]You were born at[/span] [Display value:`getCO2Level(birthYear)` format:"d" /] [span className:"graytext"]ppm.[/span][/span]
[span className:"pull-number-text"]
In [Display value:birthYear format:"d" /], carbon dioxide levels averaged [Display value:`getCO2Level(birthYear)` format:"d" /] parts per million. In [Display value:'2019' /], they averaged [Display value:'412' /] parts per million.
[/span]
[/Aside]
[var name:"pauseAnimation2" value:true /]
[p5Component
className: "center"
birthYear: birthYear
resize: partOneCompleted
pauseAnimation: pauseAnimation2
onEnterView: `pauseAnimation2 = false`
onExitViewFully: `pauseAnimation2 = true`
sketch:`(p, parent) => {
let cake;
let numerals = [];
let flame = [];
let candles;
let year = birthYear;
p.preload = function() {
cake = p.loadImage('static/assets/cake/cake.png');
for (let i=0; i<=9; i++) {
numerals.push(p.loadImage('static/assets/cake/numeral'+i+'.png'));
}
for (let i=1; i<=4; i++) {
flame.push(p.loadImage('static/assets/cake/flame'+i+'.png'));
}
};
p.setup = function() {
p.createCanvas(400, 400);
p.imageMode(p.CENTER);
p.frameRate(10);
p.noLoop();
candles = p.round(getCO2Level(year)).toString().split('').map(Number).map(n => numerals[n]);
};
p.draw = function() {
p.background(255);
p.image(cake, 200, 200);
p.image(candles[0], 135, 170);
p.image(candles[1], 200, 185);
p.image(candles[2], 265, 170);
p.image(flame[p.frameCount%4], 135, 100);
p.image(flame[(p.frameCount+1)%4], 200, 100+15);
p.image(flame[(p.frameCount+2)%4], 265, 100);
};
p.onUpdate = function(props, oldProps) {
year = props.birthYear;
candles = p.round(getCO2Level(year)).toString().split('').map(Number).map(n => numerals[n]);
if (props.pauseAnimation !== oldProps.pauseAnimation) {
if (props.pauseAnimation) {
p.noLoop();
} else {
p.loop();
}
}
};
p.windowResized = function() {
}
}
`
/]
[br/]
## Part 2: Industry
Throughout your life, carbon dioxide levels have been rapidly rising.
But you've only been around for [Display value:`currentYear - birthYear - 1` format:"d" /] or [Display value:`currentYear - birthYear` format:"d" /] years.
In comparison, humans have been burning fossil fuels for hundreds of years.
So how does the rise in CO₂ *during your life* compare to the rise in CO₂ *before you were born*?
To find out, we need to go back to the moment that human societies began consuming fossil fuels on an industrial scale.
[/TextContainer]
[PlotlyComponent
isVisible:partOneCompleted
data: graphData
layout: `(width) => ({
title: 'The Birth of Industry',
width: width,
height: Math.max(width/1.618 - 96, 300),
showlegend: false,
paper_bgcolor: '#222222',
plot_bgcolor: '#222222',
font: {
family: 'Graphik Web',
size: 16 * width/720,
color: '#ffffff',
},
xaxis: {
range: [graph2Year == birthYear ? graph2Year - stepSize : graph2Year - 50/2, 2019.5],
tickformat: 'd',
fixedrange: true,
color: '#ffffff',
titlefont: {
size: 10 * width / 720
},
tickfont: {
size: 10 * width / 720
},
showline: true,
linecolor: '#ffffff',
linewidth: 2,
},
yaxis: {
range: [
co2.filter(e => e.year >= graph2Year).map(e => e.ppm).reduce((a,b) => a < b ? a : b) / 1.25, // min of yvalues in xrange
425
],
title: {
text: 'Carbon Dioxide Level (ppm)',
},
tickformat: 'd',
fixedrange: true,
color: '#D8FFA2',
titlefont: {
size: 10 * width / 720
},
tickfont: {
size: 10 * width / 720
},
tickprefix: ' ',
ticksuffix: ' ',
showline: false,
side: 'right'
},
margin: {
l: 25 * width / 720,
r: 80 * width / 720,
b: 25 * width / 720,
t: 50 * width / 720,
pad: 2 * width / 720
},
transition: {
duration: 1000,
easing: 'cubic-in-out'
},
annotations: [
makeAnnotation(0.5, graph2Year, 2019, width/720, 'up', '2019', -40 * 0.75 * width/720, 0, 'right', 'center', true),
makeAnnotation(0.5, graph2Year, 2017, width/720, 'up', 'US Leaves<br>Paris Agreement'),
makeAnnotation(0.5, graph2Year, 2015, width/720, 'down', 'Paris Climate<br>Agreement Signed'),
makeAnnotation(0.5, graph2Year, 2012, width/720, 'up', 'Curiosity Rover<br>Lands on Mars'),
makeAnnotation(0.5, graph2Year, 2007, width/720, 'down', 'iPhone<br>Launched 📱'),
makeAnnotation(0.5, graph2Year, 2005, width/720, 'up', 'YouTube<br>Created'),
makeAnnotation(0.5, graph2Year, 2001, width/720, 'down', 'First Harry Potter<br>Movie Released 🧙'),
makeAnnotation(0.5, graph2Year, 1997, width/720, 'up', 'Titanic Movie<br>Released 🚢'),
makeAnnotation(0.5, graph2Year, 1991, width/720, 'down', 'Soviet Union<br>Dissolved ☭'),
makeAnnotation(0.5, graph2Year, 1989, width/720, 'up', 'Berlin Wall<br>Comes Down 🧱'),
makeAnnotation(0.5, graph2Year, 1977, width/720, 'down', 'Star Wars<br>Released'),
makeAnnotation(0.5, graph2Year, 1969, width/720, 'up', 'Humans Land<br>on Moon 🚀'),
makeAnnotation(0.5, graph2Year, 1945, width/720, 'up', 'World War II<br>Ends'),
makeAnnotation(0.5, graph2Year, 1939, width/720, 'down', 'World War II<br>Begins'),
makeAnnotation(0.5, graph2Year, 1919, width/720, 'up', 'World War I<br>Ends'),
makeAnnotation(0.5, graph2Year, 1914, width/720, 'down', 'World War I<br>Begins'),
makeAnnotation(0.5, graph2Year, 1886, width/720, 'down', 'Statue of Liberty<br>Inaugurated 🗽'),
makeAnnotation(0.5, graph2Year, 1851, width/720, 'up', 'Industrial<br>Revolution<br>Ends'),
makeAnnotation(0.5, graph2Year, 1765, width/720, 'down', 'Steam Engine<br>Invented 🚂'),
makeAnnotation(0.5, graph2Year, 1760, width/720, 'up', 'Industrial<br>Revolution<br>Begins 🏭', -25 * 0.75 * width/720, 40 * 0.75 * width/720, 'center', 'bottom', true),
]
.concat(width >= 700 ? [makeAnnotation(0.5, graph2Year, 1957, width/720, 'down', 'Sputnik<br>Launched 🛰️')] : [])
.concat(width >= 700 ? [makeAnnotation(0.5, graph2Year, 1903, width/720, 'up', 'Wright<br>Brothers<br>Flight 🛩')] : [])
.concat(width >= 700 ? [makeAnnotation(0.5, graph2Year, 1807, width/720, 'down', 'Steamboat<br>Invented 🚢')] : [])
.concat(width >= 700 ? [makeAnnotation(0.5, graph2Year, 1804, width/720, 'up', 'Jacquard<br>Loom<br>Invented 🧶')] : [])
.filter(e => e.x != birthYear)
.filter(e => !(e.direction == 'up' && Math.abs(e.x - birthYear) < 5))
.filter(e => e.x >= graph2Year)
.filter(e => e.font.size >= 7 * rescaleCached(width/720))
.concat([makeAnnotation(0.5, graph2Year, birthYear, width/720, 'up', 'You Were Born!<br>🎂🎉', -25 * 0.75 * width/720, 40 * 0.75 * width/720, 'center', 'bottom', true)])
});`
/]
[caption]
**Data Source:** Annualy averaged CO₂ levels compiled from [Keeling Curve](https://library.ucsd.edu/dc/object/bb3859642r) (1959 onwards) and [Law Dome Ice Core](https://www.ncdc.noaa.gov/paleo-search/study/9959) (before 1959).
[/caption]
[var name:"partTwoCompleted" value:false/]
[div className:"buttonwrapper"]
[Button onClick:`
if (buttonEnabled) {
buttonEnabled = false;
if ((graph2Year - 100) > 1750) {
graph2Year = graph2Year - 50;
} else {
graph2Year = 1750;
partTwoCompleted = true;
}
setTimeout(() => {
buttonEnabled = true;
}, 1000);
}
`
className:`graph2Year == 1750 ? 'gray' : ''`
]
Travel Back in Time
[/Button]
[Button onClick:`graph2Year = birthYear`]
Restart
[/Button]
[/div]
[Conditional if:`!partTwoCompleted`]
[Conditional if:`graph2Year == birthYear`]
[div className:"center"]
[instructions]Click the button above to travel back through the history of industry.[/instructions]
[/div]
[/Conditional]
[Conditional if:`graph2Year < birthYear`]
[div className:"center"]
[instructions]Keep going! Click the button above to travel back through the history of industry.[/instructions]
[/div]
[/Conditional]
[/Conditional]
[Conditional if:`partTwoCompleted || !readerMode`]
[TextContainer]
[br/]
This graph shows us the history of industrialization as seen through the lens of CO₂.
With every passing decade, the graph grows steeper.
[b]Our carbon dioxide output is *accelerating*.[/b]
[br/][br/]
During the Industrial Revolution, industrialized nations began burning coal at a rate never seen before.
But the steep rise in CO₂ levels during your life, [largely driven by](https://folk.universitetetioslo.no/roberan/img/GCB2019/PNG/s85_2019_Total_Emissions_by_source.png) our growing consumption of [coal, oil, and natural gas](https://ourworldindata.org/fossil-fuels#global-fossil-fuel-consumption), makes the rise during the Industrial Revolution look like a gentle slope.
Everyone alive today is living through a great acceleration—an unprecedented growth of carbon consumption, and consequently, of carbon emissions.
## Part 3: Civilization
When you're living through a dramatic change, it's hard to get a sense of perspective.
To truly grasp the magnitude of this acceleration, we need to zoom out even further.
Let's see what our current trajectory looks like from the perspective of *all of human civilization*.
[/TextContainer]
[var name:"graph3Year" value:1720 /]
[derived name:"graph3Data" value:`[{
x: co2.map(e => e.yearsBefore2019),
y: co2.map(e => e.ppm),
mode: 'lines',
type: 'scatter',
hovertemplate: '%{x} Years Before 2019<br>%{y:.4r} parts per million of CO₂<extra></extra>',
hoverlabel: { bgcolor: "#FFF"},
line: {
color:'#D8FFA2',
width: 4
}
}]` /]
[PlotlyComponent
isVisible:partTwoCompleted
data: graph3Data
layout: `(width) => ({
title: 'The Rise of Civilization',
width: width,
height: Math.max(width / 1.618 - 96, 300),
showlegend: false,
paper_bgcolor: '#222222',
plot_bgcolor: '#222222',
hovermode: 'closest',
font: {
family: 'Graphik Web',
size: 16 * width / 720,
color: '#ffffff',
},
xaxis: {
range: [graph3Year == 1720 ? 2019 - graph3Year + 50/2 : 2019 - graph3Year + 1000/2, -10],
title: 'Years before 2019',
tickformat: ',',
fixedrange: true,
zeroline: false,
color: '#ffffff',
titlefont: {
size: 10 * width / 720
},
tickfont: {
size: 10 * width / 720
},
showline: true,
linecolor: '#ffffff',
linewidth: 2,
},
yaxis: {
range: [
co2.filter(e => e.year >= graph3Year).map(e => e.ppm).reduce((a,b) => a < b ? a : b) / 1.15, // min of yvalues in xrange
425
],
title: {
text: 'Carbon Dioxide Level (ppm)',
},
tickformat: 'd',
fixedrange: true,
zeroline: false,
color: '#D8FFA2',
titlefont: {
size: 10 * width / 720
},
tickfont: {
size: 10 * width / 720
},
tickprefix: ' ',
ticksuffix: ' ',
showline: false,
side: 'right'
},
margin: {
l: 25 * width / 720,
r: 80 * width / 720,
b: 50 * width / 720,
t: 50 * width / 720,
pad: 2 * width / 720
},
transition: {
duration: 1000,
easing: 'cubic-in-out'
},
shapes: [
{
type: 'rect',
xref: 'x',
yref: 'paper',
x0: 12000,
y0: 0,
x1: 10000,
y1: 1,
fillcolor: '#7e7e7e',
opacity: 0.5,
layer: 'below',
line: {
width: 0
}
}
],
annotations: [
{
x: 2019 - 11000,
y: 375,
xref: 'x',
yref: 'y',
xanchor: 'center',
yanchor: 'center',
text: 'Transition to<br>Agriculture',
font: {
size: 10 * rescaleCached(width/720),
},
showarrow: false,
},
makeAnnotation(0.5, graph3Year, 2019, width/720, 'up', '2019', -40 * 0.75 * width/720, 0, 'right', 'center', true),
makeAnnotation(0.5, graph3Year, birthYear, width/720, 'up', 'You Were Born! 🎂🎉', -40 * 0.75 * width/720, 0, 'right', 'center', true),
//makeAnnotation(0.5, graph3Year, 1830, width/720, 'up', 'Industrial<br>Revolution<br>Ends 🏭', -40 * 0.75 * width/720, 25 * 0.75 * width/720, 'right', 'center', true),
makeAnnotation(0.5, graph3Year, 1760, width/720, 'down', 'Industrial<br>Revolution<br>Begins 🏭', 40 * 0.66 * width/720, 50 * 0.66 * width/720, 'center', 'top', true),
makeAnnotation(0.9, graph3Year, 476, width/720, 'up', 'Fall of<br>Roman Empire'),
makeAnnotation(0.9, graph3Year, -508, width/720, 'down', 'Birth of<br>Democracy<br>in Athens'),
makeAnnotation(0.9, graph3Year, -653, width/720, 'up', 'Rise of<br>Persian<br>Empire'),
makeAnnotation(0.9, graph3Year, -1100, width/720, 'down', 'Use of<br>Iron<br>Spreads'),
makeAnnotation(0.9, graph3Year, -2200, width/720, 'up', 'Stonehenge<br>Completed'),
makeAnnotation(0.9, graph3Year, -2500, width/720, 'down', 'Mammoth<br>Extinct'),
makeAnnotation(0.9, graph3Year, -4000, width/720, 'up', '🌶️ Chilli<br>Peppers<br>Cultivated<br>in Mexico'),
makeAnnotation(0.9, graph3Year, -6000, width/720, 'down', '🍚 Rice<br>Cultivated<br>in China'),
makeAnnotation(0.9, graph3Year, -8500, width/720, 'up', '🐮 Cattle<br>Domesticated'),
makeAnnotation(0.9, graph3Year, -9600, width/720, 'up', '🌾 Wheat<br>Cultivated', -25 * 0.35 * width/720, 40 * 0.35 * width/720, 'center', 'bottom', true)
]
.concat( width >= 700 ? [makeAnnotation(0.9, graph3Year, -3300, width/720, 'up', '🍺 Beer brewed<br>from Barley<br>in Iran')] : [])
.concat( width >= 700 ? [makeAnnotation(0.9, graph3Year, -3200, width/720, 'down', '✍️ Invention of<br>Writing in<br>Egypt & Sumeria')] : [])
.concat( width >= 700 ? [makeAnnotation(0.9, graph3Year, -6000, width/720, 'up', 'Squash<br>Cultivated<br>in Mexico')] : [])
.concat( width >= 700 ? [makeAnnotation(0.9, graph3Year, -7000, width/720, 'up', '🌽 Corn<br>Cultivated<br>in Mexico')] : [])
.concat( width >= 700 ? [makeAnnotation(0.9, graph3Year, -8000, width/720, 'down', 'Mammoth Extinct<br>in Eurasia<br>and Americas')] : [])
.filter(e => e.x >= graph3Year)
.filter(e => e.font.size >= 5 * rescaleCached(width/720))
.map(e => (
{
x: 2019 - e.x,
y: e.y,
direction: e.direction,
xref: e.xref,
yref: e.yref,
xanchor: e.xanchor,
yanchor: e.yanchor,
text: e.text,
arrowcolor: e.arrowcolor,
font: e.font,
showarrow: e.showarrow,
arrowhead: e.arrowhead,
arrowwidth: e.arrowwidth,
ax: e.ax,
ay: e.ay,
}))
});`
/]
[caption]
**Data Source:** CO₂ levels compiled from [Keeling Curve](https://library.ucsd.edu/dc/object/bb3859642r) (1959 onwards), [Law Dome Ice Core](https://www.ncdc.noaa.gov/paleo-search/study/9959) (1 CE–1959 CE), and [EPICA Dome C Ice Core](https://www.ncdc.noaa.gov/paleo-search/study/6091) (12,000 BCE–1 BCE).
[/caption]
[var name:"partThreeCompleted" value:false/]
[div className:"buttonwrapper"]
[Button onClick:`
if (buttonEnabled) {
buttonEnabled = false;
if (graph3Year - 4000 > -10000) {
graph3Year = graph3Year - 2000;
} else {
graph3Year = -10000;
partThreeCompleted = true;
}
setTimeout(() => {
buttonEnabled = true;