% ******************************************************************************
%                     PROGRAM FRATAN_WIDE_HR
% ******************************************************************************
% ******************************************************************************
  function fratan_wide_hr(fl_a,fl_v)  
% displays SLAs in wide domain (28-38 N, 75-45 W) with the geostrophic
% velocity field overlayed;
% fl_a=1/0 -- draw altimetry map;
% fl_v=1/0 -- draw velocity field;
% SLAs displayed from June 1 (day 3439), to Aug 31, 2001 (day 3530). 
% call as:
%                fratan_wide_hr(1,1)
%                fratan_wide_hr(1,0)
%                fratan_wide_hr(0,1)
% ************************************************************************************
     if(nargin<1)
     disp('this is a function: please enter arguments')
     return
     end
     if(nargin<2)
     disp('this is a function: please enter another one argument')
     return
     end
     if(nargin>2)
     disp('this is a function: too many arguments')
     return
     end
 
% load .mat file
       load fratan
% set up the beginning day of the movie
       t=3439;tend=3530;
       jul=t+datenum(1992,1,1);
       datestr(jul,0)
       kbeg=t;
% filter 
       hh=fspecial('gaussian',5,.8);
% ===================================
       figure
       set(gcf,'Position',[100 100 1200 860])

       set(gcf,'Defaultaxesfontname','times');
       set(gcf,'Defaultaxesfontsize',12);
% start main loop    
      for i = [kbeg:tend];
      clf
      b1=reshape(data(i-3438,:),52,132);
      ux=reshape(wx(i-3438,:),50,130);
      vy=reshape(wy(i-3438,:),50,130);

% plot SLA field
       set(gcf,'color','w');
% draw altimetry map
       if(fl_a==1)
       contourf3(x3,y3,b1,[-500:50:-150 -125:25:125 150:50:500]);
       caxis([-350 350]);
       colormap jet(28)
       h2=colorbar('horiz');
       set(h2,'Position',[0.2800    0.1800    0.4750    0.018])
       set(h2,'fontsize',12);
       set(gca,'GridLineStyle',':');
       hold on;
       plot(berm(:,1),berm(:,2),'k-','color',[.1 .1 .1],'LineWidth',[1.0]);      
       plot(x0,y0,'o','markerfacecolor','r','markeredgecolor','w','MarkerSize',10);
       text(x0,y0,['  BATS '],'color',[.1 .1 .1],'HorizontalAlignment','left',...
       'FontWeight','bold','FontSize',12);
       hold off
       set(h2,'XColor','k','YColor','k');
       set(h2,'ticklength',[0.025 0.025]);
       set(h2,'Xtick',[-350:50:350]);
       set(h2,'Xticklabel','|-300||-200||-100||0||100||200||300|')
       end
       if(fl_v==1)    
       hold on
       quiver(x1,y1,ux,vy,7.0,'k')
       hold off
       end

       axis([-75 -45. 28. 38.]);
       setaxis;

       set(gca,'Position',[0.070    0.1100    0.90    0.8150]) 
       set(gca,'XColor','k','YColor','k');
       set(gca,'FontWeight','bold','FontSize',14);
       xlabel('Longitude, E','color','k','FontWeight','bold',...
       'fontname','courier','FontSize',16);
       ylabel('Latitude, N','color','k','FontWeight','bold',...
       'fontname','courier','FontSize',16);
       title(['SLA from Jason, T/P, GFO, and ERS altimetry, ',datestr(jul,1)],'color','b',...
       'fontname','courier','FontWeight','bold','FontSize',18);
       set(gca,'Xminortick','on')
       set(gca,'XGrid','on','color','w','YGrid','on','color','w');
       box on
       set(gca,'Ytick',[28:38])
       set(gca,'Yticklabel',...
       '28||30||32||34||36||38|')
       hold off
       grid

       set(gcf,'PaperPosition',[-2.5 0.75 13.5 9.5]);
       t=t+1
       jul=jul+1;  
       disp('PRESS "ENTER" TO SEE NEXT PLOT')      
       input('?')
       end

