% routine to plot Signell 15s bathy data

exy=exist('fn');

if exy==0;   

    wc=computer;
    if wc(1:3)=='SGI';
      fn='/data5/jmanning/bathy/gom15';
    else;
      fn='f:\bathy\gom15';
    end;
    exy=exist([fn,'.mat']);
    if exy==0;

       disp(['May need to unzip ',fn]);

    end;

    disp(['Loading ',fn,'...']);
    eval(['load ',fn]);

    x=lon;y=lat;
    bnd=[-70 -67 40 42];
    disp(['Hardcoded bounds to: ',num2str(bnd)]);
    id=find(lon>bnd(1)&lon<bnd(2));
    id2=find(lat>bnd(3)&lat<bnd(4));
    x=x(id);y=y(id2);z=z(id2,id);

end;
  inc=30;
  %  v=50:inc:300;

  v=[40 60 80 100 200 300 1000];

  disp(['Harcoded depth increments: ',num2str(v)]);
  wcon=menu('Which contour?','2-d','3-d');
%   wcon=1;
   if wcon==1;  

      cd e:\atsee\newextc
     % extcontour(x,y,-1*z,[20 40 60 80 100 120],'fill');

     % hold on;

      extcontour(x,y,-1*z,v,'label',500,'color',[1 .62 .4]);

      %    hbar=cbar(gca,'h',inc,inc*2,'fontsize',14);
    axis([bnd(1) bnd(2) bnd(3) bnd(4)])
    set(gca,'box','on','aspectratio',[1 .78]);
    lllabel(60,60,40,42,-70,-67);
    hold on;
%    text(-67.317 ,40.968,'ST2','horizontalalignment','right')
  else;
%   rid of all depths >40
    [nr,nc]=size(z);
    %for i=1:nc;
     % id3=find(z(:,i)<-40);
     % z(id3,i)=NaN*ones(length(id3),1);
    %end;

   v=[-60 -80 -100]

   ctour3jm(x,y,z,v)
   %surfcjm(x,y,z)
   %shading interp

    axis([-69 -67 40 42 -100 0])

    

    hold on;

%   add some arrows
    if wc(1:3)=='PCW';
      load f:\moor\moor82\eofs
      load e:\wcr\position\position_sec_all.dat
      p=position_sec_all;
      h1=quiver3(p(:,8),p(:,7),-1*p(:,5),-1*v(:,8),0,0,0);

      set(h1,'color','r','linewidth',2)

      h2=quiver3(p(:,8),p(:,7),-1*p(:,5),v(:,7),0,0,0);

      set(h2,'color','g','linewidth',2,'linestyle','-')

      for i=[1 2 5 8];

         text(p(i,8),p(i,7),-1*p(i,5)+5,num2str(p(i,1)),...

            'fontsize',24,'color','m','horizontalalignment','center');

      end;

      h6=text(-67.75,42,-60,'60m','rotation',45);

      h8=text(-68,40.8,-80,'80m','rotation',30);

   end;

%   make a flic of this
%    mkflc=menu('Make movie?','y','n');
    mkflc=2;
    nf=1
    for i=1:nf/2;
      view(-30,90-(60/(nf/2))*i);
      pause;
      if mkflc==1;eval(['print -dgif8 ',num2str(i)]);end;
    end;
    for i=nf/2+1:nf;
      view(-30+30/(nf/2)*(i-nf/2),30);
      pause;
      if mkflc==1;eval(['print -dgif8 ',num2str(i)]);end;
    end;
    %!~/flic/xanim2703/fbm2fli list.dat ridges.flc
    %!xanim +Sr ridges.flc

    view(-40,30);

    xlabel('Longitude')

    ylabel('Latitude')

    zlabel('Depth(m)')

    title('Mode 1 (red) and 2 (green)','fontsize',18)

    colormap(1-gray)

 end;
