%
%       co2_plot.m
%
%   ....This is a MATLAB SCRIPT to create a plot of the atmospheric carbon dioxide
%       record at Mauna Loa, Hawaii.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                           DATA REFERENCES                                           
%                                                                                
%BACASTOW, R.B., AND C.D. KEELING. 1981.  ATMOSPHERIC CARBON DIOXIDE             
%     CONCENTRATION AND THE OBSERVED AIRBORNE FRACTION.  PP. 103-112 IN          
%     B. BOLIN, (ED.), CARBON CYCLE MODELLING, SCOPE 16. JOHN WILEY AND          
%     SONS, NEW YORK.                                                            
%                                                                                
%BACASTOW, R.B., C.D. KEELING, AND T.P. WHORF. 1985. SEASONAL AMPLITUDE          
%     INCREASE IN ATMOSPHERIC CO2 CONCENTRATION AT MAUNA LOA, HAWAII,            
%     1959-1982. JOURNAL OF GEOPHYSICAL RESEARCH 90(D6):10,529-540.              
%                                                                                
%KEELING, C.D., R.B. BACASTOW, A.F. CARTER, S.C. PIPER, T.P. WHORF,              
%     M. HEIMANN, W.G. MOOK, AND H. ROELOFFZEN. 1989. A THREE                    
%     DIMENSIONAL MODEL OF ATMOSPHERIC CO2 TRANSPORT BASED ON                    
%     OBSERVED WINDS: 1. ANALYSIS OF OBSERVATIONAL DATA. IN D.H.                 
%     PETERSON (ED.) ASPECTS OF CLIMATE VARIABILITY IN THE PACIFIC               
%     AND THE WESTERN AMERICAS. GEOPHYSICAL MONOGRAPH 55:165-235.                
%                                                                                
%KEELING, C.D., R.B. BACASTOW, A.E. BAINBRIDGE, C.A. EKDAHL, JR., P.R.           
%     GUENTHER, L.S. WATERMAN, AND J.F.S. CHIN. 1976.  ATMOSPHERIC               
%     CARBON DIOXIDE VARIATIONS AT MAUNA LOA OBSERVATORY, HAWAII.                
%     TELLUS 28(6):538-551.                                                      
%                                                                                
%KEELING, C.D., R.B. BACASTOW, AND T.P. WHORF. 1982.  MEASUREMENTS OF            
%     THE CONCENTRATION OF CARBON DIOXIDE AT MAUNA LOA OBSERVATORY,              
%     HAWAII. PP. 377-385 IN W.C. CLARK, (ED.), CARBON DIOXIDE REVIEW:           
%     1982. OXFORD UNIVERSITY PRESS, NEW YORK.
%
%KEELING, C.D., T.P. WHORF, M. WHALEN, AND J. van der PLICHT. 1995.
%     INTERANNUAL EXTREMES IN THE RATE OF RISE OF ATMOSPHERIC      
%     CARBON DIOXIDE SINCE 1980. NATURE 375:666-670.
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%       Script written by Von P. Walden
%                         26 January 1998
%

%
%   ....Loads the data.
%
load ndp001r7.dat

%  Define constants. 
nmonths = 12; 
nyears = length(ndp001r7); 

%  Create a vector of times corresponding roughly to the months of the year. 
time = 1958+(1:nmonths*nyears)*(1/nmonths); 
       
%  Create a vector of CO2 amounts from the data matrix. 
tmp = ndp001r7(:,2:13); 
co2 = reshape(tmp',1,nyears*nmonths); 

%  Find the indices in the CO2 vector that are not missing values (-99.99). 
ind = find(co2 ~= -99.99); 

%  Plot the data and anotate the graph. 
plot(time(ind),co2(ind)); 
xlabel('Year') 
ylabel('CO2 concentration') 
title('Atmospheric carbon dioxide concentration at Mauna Loa, Hawaii (Data from Keeling and Whorf)') 
