
%clear all; %close all;

%load sim
id2=id'; lon2=lon'; lat2=lat'; t2=(ones(size(id,1),1)*t)';
q=find(id2>0);
id2=id2(q); lon2=lon2(q); lat2=lat2(q); t2=t2(q);
q=find(lon2<30);lon2(q)=lon2(q)+360;

Lon=floor(min(lon2)):2.1:ceil(max(lon2));
Lat=floor(min(lat2)):2.1:ceil(max(lat2));


clf;wysiwyg; orient tall;

J=[1 round(length(t)/3)  round(2*length(t)/3) length(t)];
Cmax=0;

for sub_ind=1:length(J);
    
    subplot(length(J),1,sub_ind);
      
    q=find(t2==t(J(sub_ind)));
    ID=unique(id2(q));
    
    C=zeros(length(Lat),length(Lon));
    for i=1:length(Lat); 
        for j=1:length(Lon);
            q2=find(lat2(q)>=Lat(i)-2.52 & lat2(q)<Lat(i)+2.52 & ...
                lon2(q)>=Lon(j)-2.52 & lon2(q)<Lon(j)+2.52);
            C(i,j)=length(q2);
        end;
    end;
    if (sub_ind==1) 
        Cmax=max(max(C));
        Csum1=sum(sum(C));
    end;
    Csum=sum(sum(C)); 
     
    patchmap(Lon,Lat,C./Csum);
    caxis([0 Cmax./Csum1])
    
    title(['Day ',num2str(t(J(sub_ind)))],'fontsize',10);
    mapaxis([min(Lon) max(Lon) min(Lat) max(Lat)])
    coasts(1,0,[],[]);
    
%     pos=get(gca,'pos');
%     if (jind==1)
%         set(gca,'pos',pos-[0 .07 0 0]);
%     elseif (jind==length(J))
%         set(gca,'pos',pos+[0 .07 0 0]);
%     end;
    
end;
