image thumbnail

Get Land Surface Temperatures

by

 

22 Oct 2012 (Updated )

Acquire land surface temps from Berkeley Earth Surface Temperature study, NOAA, and NASA-Goddard.

temp_record_examples.m
% temp_record_examples.m
% 
% 
% This script contains several examples for use of the temperature record
% retrieval functions best_tavg, giss_tavg, and noaa_tavg. 
% Chad A. Greene, October 2012. 
% 
% See best_tavg, giss_tavg, and noaa_tavg.  

% *********************************************************************** %
%% BEST example (generates BEST_example.png): 
[best_temp,best_dates,best_temp_unc] = best_tavg(datenum('Jan 1, 1850'),datenum('Jan 1, 2011'),'decadal');

figure
set(gcf,'position',[100 100 900 500])
bestfill = fill([best_dates;flipud(best_dates)],[best_temp+best_temp_unc;flipud(best_temp-best_temp_unc)],'b');hold on
set(bestfill,'facealpha',.2,'edgealpha',0);
plot(best_dates,best_temp,'b');
datetick
axis tight
ylabel('temperature anomalies (C)')
xlabel('date')
box off 
text(0,.9,'  Berkeley Earth Surface Temperature, decadally-averaged land record','units','normalized')

% *********************************************************************** %
%% GISS example (generates GISS_example.png): 
[giss_temp,giss_dates] = giss_tavg(datenum('Jan 1, 1880'),datenum('Jan 1, 2011'),'annual');

figure
set(gcf,'position',[100 100 900 500])
plot(giss_dates,giss_temp,'b');
datetick
axis tight
ylabel('temperature anomalies (C)')
xlabel('date')
box off 
text(0,.9,'  Goddard Institute for Space Studies, annually-averaged land temperature record','units','normalized')

% *********************************************************************** %
%% NOAA example (generates noaa_example.png): 
 
[noaa_temp,noaa_dates] = noaa_tavg(datenum('Jan 1, 1880'),datenum('Jan 1, 2011'),'annual');

figure
set(gcf,'position',[100 100 900 500])
plot(noaa_dates,noaa_temp,'b');
datetick
axis tight
ylabel('temperature anomalies (C)')
xlabel('date')
box off 
text(0,.9,'  NOAA''s annually-averaged land temperature record','units','normalized')

% *********************************************************************** %
%% Plot all three data sets together (generates full_data_set_example.png): 

start_date = datenum('Jan 1, 1750'); 
end_date = datenum(date);
moving_average = 'annual'; 

% Note that some innocuous warning messages will appear using the suggested
% dates above. They simply remind you that these dates are out of the range
% of some of the records. 

[best_temp,best_dates,best_temp_unc] = best_tavg(start_date,end_date,moving_average);
[giss_temp,giss_dates] = giss_tavg(start_date,end_date,moving_average);
[noaa_temp,noaa_dates] = noaa_tavg(start_date,end_date,moving_average);

% For comparison, adjust anomalies to their 20th century mean: 
noaa_temp = noaa_temp - mean(noaa_temp(noaa_dates>=datenum(1900,1,1)&noaa_dates<=datenum(2000,1,1)));
giss_temp = giss_temp - mean(giss_temp(giss_dates>=datenum(1900,1,1)&giss_dates<=datenum(2000,1,1)));
best_temp = best_temp - mean(best_temp(best_dates>=datenum(1900,1,1)&best_dates<=datenum(2000,1,1)));

figure
set(gcf,'position',[100 100 900 500])
bestfill = fill([best_dates;flipud(best_dates)],[best_temp+best_temp_unc;flipud(best_temp-best_temp_unc)],'b');hold on
set(bestfill,'facealpha',.2,'edgealpha',0);
plot(best_dates,best_temp,'b');
plot(giss_dates,giss_temp,'r')
plot(noaa_dates,noaa_temp,'k')

datetick
axis tight
ylabel('temperature anomalies (C)')
xlabel('date')
box off 
h=legend('BEST uncertainty','BEST','GISS','NOAA','location','southeast');
legend boxoff
title('Historical temperature records')


% *********************************************************************** %
%% "Proof" that global warming stopped in 1998:
% (just make sure you don't change the date range)  
% 
% This example generates a plot like end_of_global_warming_example.png

[best_temp,best_dates] = best_tavg(datenum('Jan 1, 1998'),datenum('July 1, 2003'));
best_lsq = [ones(size(best_temp)) best_dates]\best_temp;
best_linear = best_lsq(2)*best_dates + best_lsq(1); 

figure
set(gcf,'position',[100 100 900 500])
plot(best_dates,best_temp,'b'); hold on
plot(best_dates,best_linear,'k')

datetick
axis tight
ylabel('temperature anomalies (C)')
xlabel('date')
text(0,.05,['  BEST linear trend ',sprintf('%0.3f',best_lsq(2)*120),'C per decade'],'units','normalized')
box off 
legend('BEST land surface temp','linear least squares fit')
legend boxoff

% Note: If you've ever heard the myth that global warming stopped in 1998,
% this is where it comes from.  A linear least-squares fit starting in 1998
% and ending a few years later may indicate cooling.  This is because 1998
% was a particularly warm year due to a strong El Nino.  If you're
% interested in this stuff, you can also get an El Nino time series using
% my file found here: http://www.mathworks.com/matlabcentral/fileexchange/38629.


Contact us