%make plots of the MOMSO grid

%get grid information
 load ../dat/mod/other/grid.mat

%plot vertical grid
 dz=diff([0; zb]);

set(gca,'nextplot','add','xgrid','on','ygrid','on','box','on','linewidth',1.5, ...
        'fontsize',18,'xlim',[0 280],'ylim',[0 5600], ...
        'position',[0.1300    0.1190    0.7750./2    0.8060./2],'ydir','reverse')
 plot(dz,zt,'k.','linewidth',4,'markersize',16)
 xlabel('\Delta z   [m]')
 ylabel('Depth   [m]')
 print -deps ../ps/vGrid.eps


 dx=gradient(x_T);
 dy=gradient(y_T')';
 dxk=dx; dyk=dy;

 [I,J]=size(dx);
 for i=1:I
  i
  for j=1:J
   dxk(i,j)=dist([y_T(i,j) y_T(i,j)]'        ,[x_T(i,j) x_T(i,j)+dx(i,j)]')./1000;
   dyk(i,j)=dist([y_T(i,j) y_T(i,j)+dy(i,j)]',[x_T(i,j) x_T(i,j)]')./1000;
  end
 end
 
    figure; drawnow
         in=[3.5:0.5:16];
         m_proj('Mercator','long',[min(x_T(:)) max(x_T(:))],'lat', [min(y_T(:)) max(y_T(:))]);
          hold on
          [xxtt,yytt]=m_ll2xy(x_T,y_T);
          flat_pcolor(xxtt,yytt,dxk), shading flat;
          amcolormap(jet,in); amcaxis(in);

          [cc]=amcolorbar('horiz',in);
          set(cc,'linewidth',2,'tickdir','out','fontweight','bold', ...
                  'xtick',in([1:4:end]),'xticklabel',in([1:4:end]),'position', ...
                  [0.130+0.15 0.1100+0.1 0.7750-0.3 0.0611/4], ...
                  'fontsize',10)
          m_grid('xtick',12,'tickdir','out','ytick',[-70:20:20],'linest','-', ...
                 'color','k');

          m_coast('patch',[0.7 0.7 0.7])
          print -depsc ../ps/xGrid.eps


    figure; drawnow
         in=[11:10:220];
         m_proj('Mercator','long',[min(x_T(:)) max(x_T(:))],'lat', [min(y_T(:)) max(y_T(:))]);
          hold on
          [xxtt,yytt]=m_ll2xy(x_T,y_T);
          flat_pcolor(xxtt,yytt,dyk), shading flat;
          amcolormap(jet,in); amcaxis(in);

          [cc]=amcolorbar('horiz',in);
          set(cc,'linewidth',2,'tickdir','out','fontweight','bold', ...
                  'xtick',in([1:4:end]),'xticklabel',in([1:4:end]),'position', ...
                  [0.130+0.15 0.1100+0.1 0.7750-0.3 0.0611/4], ...
                  'fontsize',10)
          m_grid('xtick',12,'tickdir','out','ytick',[-70:20:20],'linest','-', ...
                 'color','k');

          m_coast('patch',[0.7 0.7 0.7])
          print -depsc ../ps/yGrid.eps

    figure; drawnow
         in=[0:100:5200];
         m_proj('Mercator','long',[min(x_T(:)) max(x_T(:))],'lat', [min(y_T(:)) max(y_T(:))]);
          hold on
          [xxtt,yytt]=m_ll2xy(x_T,y_T);
          flat_pcolor(xxtt,yytt,depth_t), shading flat;
          amcolormap(flipud(ferretc('ocean_blue',length(in))),in); amcaxis(in);

          [cc]=amcolorbar('horiz',in);
          set(cc,'linewidth',2,'tickdir','out','fontweight','bold', ...
                  'xtick',in([1:10:end]),'xticklabel',in([1:10:end]),'position', ...
                  [0.130+0.15 0.1100+0.1 0.7750-0.3 0.0611/4], ...
                  'fontsize',10)
          m_grid('xtick',12,'tickdir','out','ytick',[-70:20:20],'linest','-', ...
                 'color','k');

          m_coast('patch',[0.7 0.7 0.7])
          print -depsc ../ps/bathy.eps

