%   add drifter tracks during this transect
    hold on

%   use every nth points in observed drifter files?
    shm=1;
    disp(['Hardcoded to use every ',num2str(shm),' fix']);
    

%   reference circle size 
%    refd=menu('How to reference circles?','time','longitude');
    refd=1;

%    refd=menu('How to reference x-sec distance?','lat/lon','isobath');
    refx=2;
    if refx==2;load isobath60;end;

%    dfn=['oc303/d1a';'oc303/d4a';'oc303/d6a';'oc303/d4b'];
%    dfm=[411 441 461 442];
     dfn=['oc303/d4a'];
%    dfm=441;
%    [hm,hm2]=size(dfn);

%    hm=input('How many drifters do you want overlyed?');
    hm=1;
    disp(['Hardcoded to ',num2str(hm),' drifters overlayed']);

    kk=1;
    for kk=1:hm;

%     dfn=input('Enter drifter cruise and filename w/slash & w/out .dat: ','s');
      disp(['Hardcoded to post ',dfn(kk,:)]);
      eval(['load /data5/jmanning/drift/',dfn(kk,:),'.dat'])
      idd=find(dfn(kk,:)=='/');
      dds=eval(dfn(kk,idd+1:length(dfn(kk,:))));
      id=find(dds(:,1)>miny&dds(:,1)<=maxy);
      dds=dds(id,:);
      k=0;
      [nr,nc]=size(yadcp);
      if length(id)~=0;
        disp(['loop through obs drifters for times ',num2str(dds(1,5)),' to ',num2str(dds(length(id),5))]);
        for ki=1:shm:length(id);
          k=k+1;

%         find the cross-sectional distance depending on reference
          if refx==1; 
            if yadcp(1,2)>yadcp(nr,2);
              dd(k)=dist(yadcp(1,2),yadcp(1,1),dds(ki,3),dds(ki,2));
            else;
              dd(k)=dist(yadcp(nr,2),yadcp(nr,1),dds(ki,3),dds(ki,2));
            end;

%         here is where we find dist from certain isobath
%         by incrementing north along this longitude (dds(id(ki),2)
          else;
%            keyboard;
%            lats=dds(id(ki),3)-.5:.1:dds(id(ki),3)+.4;
%            wd=w_depth(dds(id(ki),2)*ones(10,1),lats);
%            [yy,ii]=sort(wd);
            reflat=interp1(lon60,lat60,dds(ki,2));
%            reflat1=interp1(yy,lats(ii),100);
%            shlfwdth=dist(reflat,dds(ki),2),reflat1,dds(ki),2));
            dd(k)=dist(reflat,dds(ki,2),dds(ki,3),dds(ki,2));
          end;
        end;

%        ddep=input('enter drifter depth (positive value) : ');
        ddep=33;
        disp(['Hardcoded drifters to ',num2str(ddep),'m']);
%       make dot size relative to time or longitude
        if refd==1;
          dsiz=3*(dds(1,1)-dds(1:shm:length(id),1))/(max(dds(:,1))-min(dds(:,1)));
        elseif refd==2;
          dsiz=-3*(max(dds(:,2))-dds(1:shm:length(dds),2))/(max(dds(:,2))-min(dds(:,2)));
        end;
        if isnan(dsiz)==1;dsiz=-1;end
        cdot=['c',num2str(kk)];
        disp('WARNING: observed drifter post commented out');
%        sizesym(dd,-ddep*ones(length(dd),1),dsiz,2,-1,cdot);
%        text(dd(length(dd)),-ddep,dfn(kk,idd+2:length(dfn)),...
%          'horizontalalignment','center','color',cdot)
        clear dd ddep dsiz 
      end;




%     now post analogous model drifter
%      disp(['Hardcoded to post model drifter # ',num2str(dfm(kk))]);
%      eval(['load /data5/jmanning/drift/',dfn(kk,:),'.dat'])
      model='fundy';
      if model=='fundy';
        load /home3/ocn/jmanning/model/d3/old_drog3d/test4.mtl
        mtl=test4;
        ydm=mtl(:,4);
        disp('Note: We are eliminating the outer bank drifters');
        id=find(ydm>miny&ydm<=maxy&mtl(:,10)<21);
      else;
        load /data5/jmanning/model/bank150/may97/r63/r63.mtl
        mtl=r63;
        cdm=calday(mtl(1,3),maxy);
        idm=find(mtl(:,1)==cdm(3));
        mtl=mtl(idm,:);
        ydm=mtl(:,4)+julian(mtl(1,2),cdm(3),mtl(1,3),1);
        id=find(ydm>miny&ydm<=maxy&mtl(:,9)==dfm(kk));
      end;
      k=0;
      if length(id)~=0;
%        disp(['loop through model drifters for times ',num2str(ydm(1)),5),' to ',num2str(ydm(length(id))),5)]);
%       skip how many points in observed drifter files?
        shm=1;
        disp(['Hardcoded to skip every ',num2str(shm),' fix']);
        for ki=1:shm:length(id);
          k=k+1;

%         find the cross-sectional distance depending on reference
          if refx==1; 
            if yadcp(1,2)>yadcp(nr,2);
              dd(k)=dist(yadcp(1,2),yadcp(1,1),mtl(id(ki),6),mtl(id(ki),5));
            else;
              dd(k)=dist(yadcp(nr,2),yadcp(nr,1),dds(id(ki),3),dds(id(ki),2));
            end;

          else;
%           here is where we find dist from certain isobath
%            lats=mtl(ki),6)-.09:.1:mtl(ki),6)+.4;
%            wd=w_depth(mtl(ki),5)*ones(5,1),lats);
%            [yy,ii]=sort(wd);
%           note that "x" and "y" were loaded with "isobath60"
            reflat=interp1(lon60,lat60,mtl(id(ki),5));
            dd(k)=dist(reflat,mtl(id(ki),5),mtl(id(ki),6),mtl(id(ki),5));
            if reflat<mtl(id(ki),6);dd(k)=-1*dd(k);end;
          end;
%         ddep=input('enter drifter depth (positive value) : ');
          ddep(k)=mtl(id(ki),7);
        end;

%        disp(['Hardcoded drifters to ',num2str(ddep),'m']);
%       make dot size relative to time or longitude
        if refd==1;
          dsiz=3*(ydm(1)-ydm(1:shm:length(id)))/(max(ydm(id))-min(ydm(id)));
          if isnan(dsiz)==1;dsiz=-1;end
        elseif refd==2;
          dsiz=-10*(max(mtl(id,5))-mtl(1:shm:length(id),5))/(max(mtl(id,5))-min(mtl(id,5)));
          if isnan(dsiz)==1;dsiz=-1;end
        end;
        clear cdot
        for k=1:shm:length(id);
%         color by model drifter id
%          cdot(k,:)=['c',num2str(rem(mtl(k,10),8)+1)];
%         color by model drifter original depth
          cdot(k,:)=['c',num2str(rem(mtl(k,10),4)+4)];
        end;
%       ['c',num2str(kk)]
        if ddep(length(ddep))~=-33;
          sizesym(dd,ddep,dsiz,4,1,cdot);
        end;
%        text(dd(1),ddep(1),dfn(kk,idd+2:length(dfn)),...
%          'horizontalalignment','center','color',cdot)
%        clear dd ddep dsiz 
      end;
    end;
