% Script: load Period, HadCRUT4, CO2, TSI
% Data obtainable independently from the three indicated files
% Origin changed to 1971 values for CO2 and TSI

% 1.  PERIOD COVERED BY ALL THREE DATASETS
Period = (1854:2017)';

% 2.  CLIMATE DATASET
% Global HadCRUT for 1854-2017 from  Hadley Climate center
%` https://crudata.uea.ac.uk/cru/data/temperature/HadCRUT4-gl.dat
% Annual data taken from rightmost column (column 14)
HadCRUT4 = [  % Origin fine as is (HadCRUT4 already given as anomalies)
-0.248
-0.272
-0.358
-0.461
-0.467
-0.284
-0.343
-0.407
-0.524
-0.278
-0.494
-0.279
-0.251
-0.321
-0.238
-0.262
-0.276
-0.335
-0.227
-0.304
-0.368
-0.395
-0.384
-0.075
 0.035
-0.230
-0.227
-0.200
-0.213
-0.296
-0.409
-0.389
-0.367
-0.418
-0.307
-0.171
-0.416
-0.330
-0.455
-0.473
-0.410
-0.390
-0.186
-0.206
-0.412
-0.289
-0.203
-0.259
-0.402
-0.479
-0.520
-0.377
-0.283
-0.465
-0.511
-0.522
-0.490
-0.544
-0.437
-0.424
-0.244
-0.141
-0.383
-0.468
-0.333
-0.275
-0.247
-0.187
-0.302
-0.276
-0.294
-0.215
-0.108
-0.210
-0.206
-0.350
-0.137
-0.087
-0.137
-0.273
-0.131
-0.178
-0.147
-0.026
-0.006
-0.052
 0.014
 0.020
-0.027
-0.004
 0.144
 0.025
-0.071
-0.038
-0.039
-0.074
-0.173
-0.052
 0.028
 0.097
-0.129
-0.190
-0.267
-0.007
 0.046
 0.017
-0.049
 0.038
 0.014
 0.048
-0.223
-0.140
-0.068
-0.074
-0.113
 0.032
-0.027
-0.186
-0.065
 0.062
-0.214
-0.149
-0.241
 0.047
-0.062
 0.057
 0.092
 0.140
 0.011
 0.194
-0.014
-0.030
 0.045
 0.192
 0.198
 0.118
 0.296
 0.254
 0.105
 0.148
 0.208
 0.325
 0.183
 0.390
 0.539
 0.306
 0.294
 0.441
 0.496
 0.505
 0.447
 0.545
 0.506
 0.491
 0.395
 0.506
 0.560
 0.425
 0.470
 0.514
 0.579
 0.763
 0.797
 0.676
];	% End of HadCRUT4 data (no rescaling needed)

% 3. CO2 DATASET
% Scripps Atmospheric CO2 Data
% http://scrippsco2.ucsd.edu/data/atmospheric_co2/icecore_merged_products/spline_merged_ice_core_yearly.csv
% Data taken from the second column for the years 1854-2017
CO2 = 1/326 * [ % Origin changed to 1971 value (327 ppm), log2(1/327) = -8.353
286.861
286.851
286.823
286.784
286.738
286.691
286.648
286.613
286.592
286.589
286.608
286.654
286.727
286.828
286.955
287.104
287.270
287.449
287.636
287.828
288.022
288.212
288.402
288.593
288.789
288.994
289.210
289.440
289.688
289.956
290.248
290.567
290.912
291.278
291.662
292.058
292.464
292.872
293.278
293.677
294.063
294.432
294.776
295.093
295.387
295.663
295.929
296.192
296.460
296.741
297.039
297.356
297.690
298.039
298.399
298.767
299.140
299.520
299.911
300.312
300.722
301.139
301.559
301.980
302.397
302.809
303.212
303.608
303.999
304.386
304.771
305.152
305.529
305.902
306.269
306.631
306.987
307.338
307.686
308.029
308.370
308.705
309.031
309.343
309.636
309.903
310.140
310.344
310.519
310.670
310.805
310.933
311.063
311.203
311.361
311.543
311.753
311.993
312.267
312.581
312.938
313.341
313.790
314.283
314.819
315.398
316.017
316.673
317.365
318.093
318.858
319.661
320.506
321.393
322.323
323.296
324.313
325.373
326.475
327.621
328.809
330.037
331.307
332.616
333.963
335.344
336.753
338.186
339.639
341.107
342.587
344.077
345.572
347.071
348.570
350.067
351.562
353.056
354.555
356.068
357.603
359.166
360.765
362.400
364.076
365.791
367.545
369.339
371.172
373.045
374.954
376.898
378.876
380.886
382.928
385.003
387.112
389.256
391.433
393.642
395.877
398.134
400.405
402.685
];

% 4.  TSI DATASET
% 1854-2017
% NOAA Climate Data Record of Total Solar Irradiance (TSI), NRLTSI Version 2
% https://www.ncei.noaa.gov/data/total-solar-irradiance/access/yearly/tsi_v02r01_yearly_s1610_e2017_c20180227.nc
% Distribution format NetCDF (use any software to extract TSI)
TSI_Lean = [ %  Origin changed to 1971 value, namely 1361 W/m2
1360.5
1360.4
1360.4
1360.5
1360.7
1360.9
1361
1360.9
1360.7
1360.7
1360.7
1360.6
1360.5
1360.4
1360.6
1360.8
1361.1
1361
1360.9
1360.7
1360.6
1360.4
1360.4
1360.4
1360.4
1360.3
1360.5
1360.6
1360.5
1360.5
1360.7
1360.5
1360.4
1360.3
1360.3
1360.3
1360.3
1360.5
1360.6
1360.8
1360.9
1360.8
1360.6
1360.4
1360.4
1360.3
1360.3
1360.3
1360.3
1360.5
1360.7
1360.6
1360.8
1360.7
1360.7
1360.6
1360.5
1360.4
1360.3
1360.3
1360.4
1360.7
1361
1361.2
1361.1
1360.8
1360.6
1360.5
1360.4
1360.4
1360.5
1360.7
1360.8
1361
1360.9
1360.8
1360.8
1360.7
1360.6
1360.5
1360.6
1360.8
1361.2
1361.2
1361.1
1361.1
1361
1360.9
1360.8
1360.6
1360.7
1360.9
1361.1
1361.4
1361.5
1361.4
1361.1
1360.8
1360.8
1360.7
1360.7
1360.9
1361.4
1361.9
1361.9
1361.6
1361.4
1361
1360.8
1360.7
1360.7
1360.8
1361
1361.2
1361.3
1361.4
1361.4
1361
1361.1
1360.9
1360.8
1360.7
1360.7
1360.9
1361.2
1361.6
1361.6
1361.7
1361.2
1361.2
1360.8
1360.6
1360.6
1360.8
1361.1
1361.6
1361.6
1361.5
1361.3
1360.9
1360.7
1360.7
1360.7
1360.8
1361.2
1361.5
1361.7
1361.6
1361.6
1361.1
1360.9
1360.7
1360.7
1360.6
1360.6
1360.6
1360.8
1361.1
1361.2
1361.3
1361.4
1361.4
1361
1360.7
];
load TSI_Leif.csv
%Uncomment the next line for Leif's TSI and the following line for no TSI
%TSI = -1361.13 + TSI_Leif(:, 2);
%TSI = TSI*0;
