Code
using Pkg
Pkg .activate (pwd ())
using Plots , Dates , CSV , DataFrames , Statistics
include ("TrendEstimators.jl" )
using .TrendEstimators
theme (: ggplot2)
Activating project at `~/Library/CloudStorage/OneDrive-AalborgUniversitet/Research/CLIMATE/Paris Goal/Odds-of-breaching-1.5C`
WARNING: replacing module TrendEstimators.
Code
rawtemp_hadcrut = CSV.read ("data/HadCRUT.5.0.2.0.analysis.ensemble_series.global.monthly.csv" , DataFrame)
first (rawtemp_hadcrut, 5 )
5×203 DataFrame
103 columns omitted
1
1850-01-01
0.53036
0.12529
-0.648141
-0.687369
-0.659397
-0.795922
-0.575723
-0.872706
-0.697845
-0.938079
-0.714489
-0.693846
-0.801877
-0.601654
-0.745235
-0.688707
-0.51959
-0.580684
-0.733635
-0.775802
-0.685629
-0.750843
-0.593316
-0.796245
-0.681935
-0.709096
-0.673113
-0.627142
-0.87027
-0.734045
-0.739397
-0.733723
-0.722726
-0.733075
-0.704837
-0.646199
-0.63273
-0.687739
-0.686664
-0.766938
-0.660519
-0.500427
-0.761633
-0.593218
-0.673419
-0.633932
-0.53979
-0.534376
-0.730824
-0.672585
-0.709929
-0.782612
-0.587371
-0.775013
-0.669417
-0.738468
-0.65991
-0.641778
-0.705
-0.728567
-0.854561
-0.622728
-0.666254
-0.762724
-0.654979
-0.698282
-0.566776
-0.641214
-0.608169
-0.721251
-0.643558
-0.737449
-0.638663
-0.610622
-0.526234
-0.738695
-0.819199
-0.678843
-0.683284
-0.784564
-0.613478
-0.755483
-0.777482
-0.624742
-0.627155
-0.62747
-0.688723
-0.854917
-0.592061
-0.583304
-0.820669
-0.859069
-0.661617
-0.548561
-0.743047
-0.796279
-0.746007
-0.975871
-0.626403
⋯
2
1850-02-01
0.471513
0.15873
-0.198692
-0.379979
-0.353424
-0.499135
-0.307929
-0.437846
-0.226076
-0.577648
-0.405545
-0.392731
-0.597314
-0.396609
-0.332673
-0.431029
-0.186967
-0.323219
-0.320514
-0.585462
-0.386137
-0.31327
-0.374146
-0.393756
-0.377606
-0.270782
-0.281058
-0.297886
-0.440194
-0.272709
-0.375954
-0.316262
-0.395188
-0.45457
-0.310405
-0.380035
-0.414555
-0.284795
-0.391644
-0.302887
-0.429657
-0.208564
-0.397717
-0.427922
-0.29149
-0.208944
-0.232016
-0.34283
-0.303425
-0.159931
-0.409084
-0.379061
-0.441772
-0.384035
-0.168103
-0.374769
-0.331487
-0.281074
-0.473583
-0.308901
-0.519065
-0.37427
-0.373581
-0.392881
-0.259453
-0.358303
-0.189542
-0.268094
-0.19915
-0.513153
-0.427336
-0.380227
-0.389459
-0.32174
-0.139402
-0.278627
-0.342224
-0.304565
-0.209553
-0.431765
-0.262323
-0.418606
-0.363407
-0.292048
-0.373431
-0.360892
-0.476022
-0.406109
-0.389504
-0.239712
-0.329308
-0.478804
-0.303512
-0.305987
-0.337012
-0.644136
-0.404883
-0.496024
-0.366001
⋯
3
1850-03-01
0.443069
0.146062
-0.559715
-0.58127
-0.613536
-0.770914
-0.649228
-0.674574
-0.422177
-0.66901
-0.633439
-0.52613
-0.742085
-0.673435
-0.500491
-0.750384
-0.441357
-0.66936
-0.684599
-0.871666
-0.528859
-0.450323
-0.676369
-0.747881
-0.515235
-0.564603
-0.517356
-0.65774
-0.799563
-0.562602
-0.7321
-0.708126
-0.601581
-0.750345
-0.491204
-0.521375
-0.63429
-0.650293
-0.695271
-0.567457
-0.661922
-0.402203
-0.729825
-0.630483
-0.591241
-0.595347
-0.520872
-0.534415
-0.675771
-0.521642
-0.579516
-0.71082
-0.538983
-0.637005
-0.613244
-0.527521
-0.518286
-0.549176
-0.646482
-0.474831
-0.749775
-0.593508
-0.65672
-0.616531
-0.641366
-0.579132
-0.353847
-0.593789
-0.379657
-0.577604
-0.665159
-0.552994
-0.700469
-0.621582
-0.519006
-0.692925
-0.651994
-0.63646
-0.483905
-0.629932
-0.463239
-0.664408
-0.699684
-0.507791
-0.731221
-0.577734
-0.688031
-0.647881
-0.681086
-0.607305
-0.700216
-0.774448
-0.562562
-0.489596
-0.625427
-0.771725
-0.605319
-0.642851
-0.665689
⋯
4
1850-04-01
0.477059
0.116737
-0.582562
-0.630568
-0.667448
-0.662525
-0.535898
-0.639695
-0.530702
-0.777102
-0.586981
-0.560966
-0.728786
-0.682735
-0.672664
-0.766407
-0.453648
-0.560511
-0.602442
-0.735504
-0.63805
-0.540513
-0.739323
-0.585814
-0.718682
-0.603517
-0.559599
-0.594016
-0.883967
-0.482028
-0.72607
-0.738021
-0.665697
-0.593461
-0.588228
-0.420146
-0.570728
-0.525597
-0.762746
-0.651996
-0.67501
-0.645
-0.770939
-0.635276
-0.575136
-0.474133
-0.439831
-0.45318
-0.473134
-0.518875
-0.570078
-0.59986
-0.661941
-0.67698
-0.512728
-0.550911
-0.497807
-0.615813
-0.453946
-0.432336
-0.790955
-0.860717
-0.531102
-0.672874
-0.730638
-0.601917
-0.429681
-0.665624
-0.535866
-0.594661
-0.656524
-0.685286
-0.49377
-0.605827
-0.551834
-0.556864
-0.688364
-0.615699
-0.659199
-0.586911
-0.499775
-0.698917
-0.642701
-0.524081
-0.586376
-0.729377
-0.701497
-0.737507
-0.544223
-0.426124
-0.786389
-0.706019
-0.53647
-0.61126
-0.617072
-0.755983
-0.614728
-0.72169
-0.544256
⋯
5
1850-05-01
0.487233
0.0959004
-0.405015
-0.493155
-0.550864
-0.544453
-0.47662
-0.672841
-0.49744
-0.602508
-0.587425
-0.501821
-0.602731
-0.661768
-0.543273
-0.610651
-0.416928
-0.468399
-0.599917
-0.601003
-0.517457
-0.532942
-0.559357
-0.613025
-0.540389
-0.424855
-0.623499
-0.473184
-0.582298
-0.488883
-0.597144
-0.580549
-0.596275
-0.515859
-0.479709
-0.451944
-0.450419
-0.513041
-0.654336
-0.641418
-0.526376
-0.440389
-0.501845
-0.485711
-0.625926
-0.433709
-0.496531
-0.421105
-0.541942
-0.478641
-0.559323
-0.551123
-0.677664
-0.617393
-0.537903
-0.498957
-0.40096
-0.499489
-0.400485
-0.450071
-0.640857
-0.553566
-0.649817
-0.483871
-0.56162
-0.587049
-0.408533
-0.486738
-0.515691
-0.4793
-0.607593
-0.468211
-0.523822
-0.490501
-0.496283
-0.508472
-0.526525
-0.486144
-0.449892
-0.609757
-0.281833
-0.624157
-0.528959
-0.380567
-0.620688
-0.520108
-0.608274
-0.551075
-0.464028
-0.444602
-0.423735
-0.538749
-0.574072
-0.397351
-0.445786
-0.760367
-0.51173
-0.664402
-0.439849
⋯
Saving the mean of the ensemble to be used later.
Code
menstemp_hadcrut = reduce (+ , eachcol (rawtemp_hadcrut[: , 4 : 203 ])) ./ ncol (rawtemp_hadcrut[: , 4 : 203 ]);
temp_hadcrut = DataFrame ("Dates" => rawtemp_hadcrut.Time , "Temperature" => menstemp_hadcrut[: ]);
first (temp_hadcrut, 5 )
1
1850-01-01
-0.674564
2
1850-02-01
-0.333416
3
1850-03-01
-0.591323
4
1850-04-01
-0.588721
5
1850-05-01
-0.508817
Code
oldbase_hadcrut = mean (temp_hadcrut.Temperature[(temp_hadcrut.Dates .>= Date (1850 , 1 , 1 )).& (temp_hadcrut.Dates .< Date (1900 , 1 , 1 ))]);
temp_hadcrut.Temperature = temp_hadcrut.Temperature .- oldbase_hadcrut;
first (temp_hadcrut, 5 )
1
1850-01-01
-0.31563
2
1850-02-01
0.0255188
3
1850-03-01
-0.232388
4
1850-04-01
-0.229786
5
1850-05-01
-0.149882
Code
widetemp = CSV.read ("data/GLB.Ts+dSST.csv" , DataFrame)
rawtemp_gistemp = TrendEstimators.longseries (widetemp)
T = size (rawtemp_gistemp, 1 );
dates = collect (Date (1880 , 1 , 1 ): Month (1 ): (Date (1880 , 1 , 1 )+ Dates .Month (T - 1 )));
temp_gistemp = DataFrame ("Dates" => dates, "Temperature" => rawtemp_gistemp[: ]);
first (temp_gistemp, 5 )
1
1880-01-01
-0.2
2
1880-02-01
-0.26
3
1880-03-01
-0.09
4
1880-04-01
-0.17
5
1880-05-01
-0.1
Code
oldbase_gistemp = mean (temp_gistemp.Temperature[(temp_gistemp.Dates .>= Date (1850 , 1 , 1 )).& (temp_gistemp.Dates .< Date (1901 , 1 , 1 ))]);
temp_gistemp.Temperature = temp_gistemp.Temperature .- oldbase_gistemp;
Code
rawtemp_berkeley = CSV.read ("data/BerkeleyEarth.csv" , DataFrame)
T = size (rawtemp_berkeley, 1 );
dates = collect (Date (1850 , 1 , 1 ): Month (1 ): (Date (1850 , 1 , 1 )+ Dates .Month (T - 1 )));
rawtemp_berkeley = DataFrame ("Dates" => dates, "Temperature" => rawtemp_berkeley[!, 3 ]);
Code
oldbase_berkeley = mean (rawtemp_berkeley.Temperature[(rawtemp_berkeley.Dates .>= Date (1850 , 1 , 1 )).& (rawtemp_berkeley.Dates .< Date (1900 , 1 , 1 ))]);
temp_berkeley = DataFrame ("Dates" => dates, "Temperature" => rawtemp_berkeley.Temperature .- oldbase_berkeley);
Code
rawtemp_noaa = CSV.read ("data/NOAA.csv" , DataFrame)
T = size (rawtemp_noaa, 1 );
dates = collect (Date (1850 , 1 , 1 ): Month (1 ): (Date (1850 , 1 , 1 )+ Dates .Month (T - 1 )));
temp_noaa = DataFrame ("Dates" => dates, "Temperature" => rawtemp_noaa[!, 3 ]);
Code
oldbase_noaa = mean (temp_noaa.Temperature[(temp_noaa.Dates .>= Date (1850 , 1 , 1 )).& (temp_noaa.Dates .< Date (1900 , 1 , 1 ))]);
temp_noaa.Temperature = temp_noaa.Temperature .- oldbase_noaa;
last (temp_noaa, 5 )
1
2024-04-01
1.34532
2
2024-05-01
1.39105
3
2024-06-01
1.39492
4
2024-07-01
1.44785
5
2024-08-01
1.45617
Code
plot (temp_hadcrut.Dates , temp_hadcrut.Temperature, label= "HadCRUT (pre-industrial baseline)" , xlabel= "Date (monthly)" , ylabel= "°C" , linewidth= 0.8 , linestyle= : dot, xticks= (temp_hadcrut.Dates [372 : 240 : end ], Dates .format .(temp_hadcrut.Dates [372 : 240 : end ], "Y" )), title= "Temperature anomalies" , color= 1 )
plot! (temp_gistemp.Dates , temp_gistemp.Temperature, label= "GISTEMP (pre-industrial baseline)" , linewidth= 0.8 , linestyle= : dot, color= 2 )
plot! (temp_berkeley.Dates , temp_berkeley.Temperature, label= "Berkeley Earth (pre-industrial baseline)" , linewidth= 0.8 , linestyle= : dot, color= 3 , xlims= (Date (1990 , 1 , 1 ), Date (2024 , 10 , 1 )))
plot! (temp_noaa.Dates , temp_noaa.Temperature, label= "NOAA (pre-industrial baseline)" , linewidth= 0.7 , linestyle= : dot, color= 4 , ylims= (- 0.2 , 1.8 ))
plot! (fontfamily= "Computer Modern" , legendfontsize= 12 , tickfontsize= 12 , titlefontfamily= "Computer Modern" , legendfontfamily= "Computer Modern" , tickfontfamily= "Computer Modern" , ylabelfontsize= 12 , xlabelfontsize= 12 , titlefontsize= 12 , legend=: bottomright)
Code
savefig ("figures/Temperature-Anomalies-All-Datasets.png" )
"/Users/jeddy/Library/CloudStorage/OneDrive-AalborgUniversitet/Research/CLIMATE/Paris Goal/Odds-of-breaching-1.5C/figures/Temperature-Anomalies-All-Datasets.png"
Code
[ last (temp_hadcrut.Temperature, 5 ), last (temp_gistemp.Temperature, 5 ), last (temp_berkeley.Temperature, 5 ), last (temp_noaa.Temperature, 5 ) ]
4-element Vector{Vector{Float64}}:
[1.4334640716722102, 1.4743430876722106, 1.4969345246722099, 1.5985191671722112, 1.4999801771722105]
[1.3774603174603173, 1.4574603174603173, 1.4174603174603173, 1.5174603174603174, 1.4474603174603173]
[1.513775, 1.531775, 1.530775, 1.683775, 1.573775]
[1.3453185816666666, 1.3910525816666666, 1.3949165816666667, 1.4478515816666666, 1.4561725816666666]
Code
paths_hadcrut = CSV.read ("tables/ProbabilityPathsHadCRUT5-Extensive.csv" , DataFrame);
paths_gistemp = CSV.read ("tables/ProbabilityPathsGISTEMP-Extensive.csv" , DataFrame);
paths_berkeley = CSV.read ("tables/ProbabilityPathsBerkeley-Extensive.csv" , DataFrame);
paths_noaa = CSV.read ("tables/ProbabilityPathsNOAA_breakmodel-Extensive.csv" , DataFrame);
Code
plot (paths_hadcrut."Date (month)" , [paths_hadcrut."1.5°C Threshold" ], label= "HadCRUT" , xlabel= "Date (monthly)" , ylabel= "Probability" , linewidth= 4 , linestyle= : dashdot, title= "" , color=: darkorange)
plot! (paths_gistemp."Date (month)" , [paths_gistemp."1.5°C Threshold" ], label= "GISTEMP" , linewidth= 4 , linestyle= : dot, color=: darkorange2)
plot! (paths_berkeley."Date (month)" , [paths_berkeley."1.5°C Threshold" ], label= "Berkeley Earth" , linewidth= 4 , linestyle= : dash, color=: darkorange3)
plot! (paths_noaa."Date (month)" , [paths_noaa."1.5°C Threshold" ], label= "NOAA" , linewidth= 4 , linestyle= : solid, color=: darkorange4)
plot! (xlims= (Date (2020 , 1 , 1 ), Date (2053 , 1 , 1 )), ylims= (0 , 1 ), xticks= (paths_hadcrut."Date (month)" [168 : 60 : end - 336 ], Dates .format .(paths_hadcrut."Date (month)" [168 : 60 : end - 336 ], "Y" )), fontfamily= "Computer Modern" , legendfontsize= 12 , tickfontsize= 12 , titlefontfamily= "Computer Modern" , legendfontfamily= "Computer Modern" , tickfontfamily= "Computer Modern" , ylabelfontsize= 12 , xlabelfontsize= 12 , titlefontsize= 12 , legend=: bottomright)
Code
savefig ("figures/Coverage-All-Datasets.png" )
"/Users/jeddy/Library/CloudStorage/OneDrive-AalborgUniversitet/Research/CLIMATE/Paris Goal/Odds-of-breaching-1.5C/figures/Coverage-All-Datasets.png"
GISTEMP. 2020.
“GISS Surface Temperature Analysis (GISTEMP), version 4 .” https://data.giss.nasa.gov/gistemp/ .
Huang, Boyin, Xungang Yin, Matthew J. Menne, Russell S. Vose, and Huai-Min Zhang. 2024.
“NOAA Global Surface Temperature Dataset (NOAAGlobalTemp).” NOAA National Centers for Environmental Information.
https://doi.org/10.25921/rzxg-p717 .
Morice, Colin P, John J Kennedy, Nick A Rayner, JP Winn, Emma Hogan, RE Killick, RJH Dunn, TJ Osborn, PD Jones, and IR Simpson. 2021. “An Updated Assessment of Near-Surface Temperature Change from 1850: The HadCRUT5 Data Set.” Journal of Geophysical Research: Atmospheres 126 (3): e2019JD032361.
Rohde, Robert A, and Zeke Hausfather. 2020.
“The Berkeley Earth Land/Ocean Temperature Record.” Earth System Science Data 12 (4): 3469–79.
https://doi.org/10.5194/essd-12-3469-2020 .