
fil='../tmp/co2_flux.nc';
egM=ncread(fil,'DICAS_EG');                egM=egM(1:69);
deM=ncread(fil,'DICAS_DEFAULT');           deM=deM(1:69);
coM=ncread(fil,'DICAS_KISOKGM600');        coM=coM(1:69);
irM=ncread(fil,'DICAS_DEFAULTIRONDOUBLE'); irM=irM(1:69);

%errplot_h([1:69],egM,egV.^0.5)

figure
 fs=12; ln=1.3; lnp=2;

subplot(3,1,1)
set(gca,'box','on','tickdir','out','nextplot','add','fontsize',fs,'linewidth',ln,'ygrid','on','xgrid','on','ylim',[-0.1 0.2])
 plot(deM,'k','linewidth',lnp)
 plot(egM,'b','linewidth',lnp)
 plot(coM,'r','linewidth',lnp)
 plot(irM,'g','linewidth',lnp)
 
 legend('FMCD','E&G','CON','IRON','location','SouthWest')
 ylabel('C uptake [PgC/yr]')
 xlabel('year')
 mean(deM(1:20))
 mean(egM(1:20))
 mean(coM(1:20))

%calculate linear regressions
 [Peg,Seg]     = polyfit([21:69]',egM([21:69]),1) 
 [Pfmcd,Sfmcd] = polyfit([21:69]',deM([21:69]),1) 
 [Pcon,Scon]   = polyfit([21:69]',coM([21:69]),1) 
 [Piron,Siron] = polyfit([21:69]',irM([21:69]),1) 

%print -depsc ../ps/co2_uptake.eps
