istart=1; 

clear all
%close all

addpath /home/stephdut/matlab/m_map


runstr=['run24_2'];  fign=1;

 logvolexp=[-141300:.513:-0.6900+25*.513];
 logvol=(10*ones(size(logvolexp))).^logvolexp;
 logdm=2*((3/4*logvol/pi).^(1/3));

 nphyt=31; nzoo=17; nbac=2; nplank=nphyt+nzoo+nbac;
   
 tsize=[1 2 3:4  5:9  5:9 5:15 7:16 7:22 1];
 ptype=[1 2 3 3 4 4 4 4 4 5 5  5 5 5 6 6 6 6 6  6 6 6 6 6 6 7 7 7  7 7 7 7 7 7 8];

 load grid_ecco.mat
 
 nx=length(X); ny=length(Y); nz=length(Z);
 for k=1:nz,
   volc(k,:,:)=rA(:,:)*drF(k);
 end
%filand1=find(squeeze(HFacC(:,:,1))==0);

   xtrans=-158;
   GrX=180+(180+xtrans);
   GrY=[22:1:53]; GrY1=[22:1:54];

   Grj=find(Y>=GrY(1)-0.5 & Y<=GrY(length(GrY))+0.5);
   Gri=find(X>=GrX-0.5 & X<GrX+0.5);
   GrYT=Y(Grj);
 

  for it=[1:12],
     it
     eval(['load /nfs/micklab001/stephdut/DAR3_MAT/',runstr,'_m',num2str(it),'_car_nut.mat;']);

    cars(it,:,:,:,:)=car;

%%%%%%%%%%%%%%%%%%%%%

%%
%%% PLOT TRANSECT %%%%%%%%%%%%%%%%%%
   figure(fign)

   cax1=0; cax2=2;
   
  for ip=1:3
    subplot(3,1,ip);
    if (ip==1), tmp=squeeze(car(1,:,:,:)); tstr='Pro'; cstr=['g'];  end
    if (ip==2), tmp=squeeze(sum(car(2,:,:,:),1)); tstr='Syn';  cstr=['y']; end
    if (ip==3), tmp=squeeze(sum(car([3:4],:,:,:),1)); tstr=['1.2-4\micro m'];  cstr='k'; end
%   if (ip==4), tmp=squeeze(sum(car(48:50,:,:,:),1));; tstr='Het Bact'; end
%   if (ip==5), tmp=squeeze(sum(car(32:34,:,:,:),1)); tstr='Small Zoo'; end
 %%%   
    if (it<4), ccstr=[cstr,'--']; end
    if (it>3 & it< 7), ccstr=[cstr,'-']; end
    if (it>6 & it<10), ccstr=[cstr,'-.']; end
    if (it>9), ccstr=[':']; end
    clear tmp2
    tmp2=squeeze(tmp(Gri,Grj,1));
    tmp2=tmp2*12;
    plot(GrYT,tmp2',ccstr,'LineWidth',2); hold on
    bolder
  end % for ip
%  axis([20 45 cax1 cax2])
  ylabel('biomass'), xlabel('latitude');

end % for irun

