for k=[7]; % 11];

ncload ../data/mod/noed/run/INPUT/grid_spec.nc

load ../data/processed/ref/surfmom.mat


udm= 3 %12
in = [0:0.01:0.1]

%define lims
 xlim = [19 24];
 ylim = [58 61];

 udm=1;
 xlim = [12.75 14.5];
 ylim = [55.15 55.5];
%load data
 depth        = depth_t; clear depth_t 
 u_ave        = squee(UU(:,:,k))'; 
 v_ave        = squee(VV(:,:,k))'; 
 uabs_ave     = squee(Uab(:,:,k))'; 
 uavevave_abs = (u_ave.^2+v_ave.^2).^0.5; 
 per          = squee(PE(:,:,k))'.*100; 

%more ini
 [X,Y]=meshgrid(x,y);
% xlim = [12 max(x)];
% ylim = [min(y) max(y)];
 u_ave = u_ave./uavevave_abs;
 v_ave = v_ave./uavevave_abs;

figure
 drawnow
        m_proj('Mercator','long', ...
                xlim, ...
               'lat',ylim);
         hold on
         [xxtt,yytt]=m_ll2xy(X,Y);
         flat_pcolor(xxtt,yytt,uabs_ave'), shading flat;

         m_vec(9,X(1:udm:end,1:udm:end), ...
                   Y(1:udm:end,1:udm:end), ...
                   u_ave(1:udm:end,1:udm:end)',  ...
                   v_ave(1:udm:end,1:udm:end)',  ...
                   [1 1 1], ...
                   'shaftwidth',0.9, ...
                   'headlength',4,'centered','yes')

         amcolormap(jet,in); amcaxis(in);

         [cc]=amcolorbar('horiz',in);
         set(cc,'linewidth',2,'tickdir','out','fontweight','bold', ...
                 'xtick',in(1:2:end),'xticklabel',in(1:2:end),'position', ...
                 [0.130+0.15 0.1100+0.21 0.7750-0.3 0.0611/4], ...
                 'fontsize',14)
%         m_gshhs_f('line','color','k')
         m_gshhs_f('patch',[0.75 0.75 0.75])
         m_grid('box','fancy','tickdir','in','linestyle','none', ...
                'fontsize',14);

brighten(0.5)

if k==7
 print -r400 -depsc ../ps/uave_sw_jul.eps
 print -r500 -dtiff ../ps/uave_sw_jul.tiff
elseif k==11
 print -r400 -depsc ../ps/uave_sw_nov.eps
end


in = [0:10:90];
figure
 drawnow
        m_proj('Mercator','long', ...
                xlim, ...
               'lat',ylim);
         hold on
         flat_pcolor(xxtt,yytt,per'), shading flat;

%         m_vec(9,X(1:udm:end,1:udm:end), ...
%                   Y(1:udm:end,1:udm:end), ...
%                   u_ave(1:udm:end,1:udm:end)',  ...
%                   v_ave(1:udm:end,1:udm:end)',  ...
%                   [1 1 1], ...
%                   'shaftwidth',0.9, ...
%                   'headlength',4,'centered','yes')

         [cc,hh]=m_contour(X,Y,depth,[10 20 30 40],'-.','color',[0.7 0.7 0.7],'linewidth',2.5)
         hhh=clabel(cc,hh,'manual');
         set(hhh,'color',[0.5 0.5 0.5],'fontsize',16)
 
         amcolormap(jet,in); amcaxis(in);

         [cc]=amcolorbar('horiz',in);
         set(cc,'linewidth',2,'tickdir','out','fontweight','bold', ...
                 'xtick',in(1:2:end),'xticklabel',in(1:2:end),'position', ...
[0.1300 0.1100+0.21 0.7750 0.0611/3.5], ...
                 'fontsize',20)

%                 [0.130+0.15 0.1100+0.21 0.7750-0.3 0.0611/4], ...
%                 'fontsize',14)
%         m_gshhs_f('line','color','k')
         m_gshhs_f('patch',[0.75 0.75 0.75])
         m_grid('box','fancy','tickdir','in','linestyle','none', ...
                'fontsize',14);
brighten(0.5)

if k==7
 print -r400 -depsc ../ps/persitop_sw_jul.eps
 print -r500 -dtiff ../ps/persitop_sw_jul.tiff
elseif k==11
 print -r400 -depsc ../ps/persitop_sw_nov.eps
end

end
