clear

data=load_getmat('allbins_');

u=data.u.*data.nanmask;
v=data.v.*data.nanmask;

depth=data.depth;
dday=data.dday;

z=depth(:,1);

[na nb]=size(u);

fc=24/3;

for j=1:na
work=u(j,:)';
jj=find(~isnan(work));
work2=FouFilter(work(jj),dday(end)-dday(1),0,fc,10,0);
uf(j,:)=interp1(dday(jj),work2,dday);
work=v(j,:)';
jj=find(~isnan(work));
work2=FouFilter(work(jj),dday(end)-dday(1),0,fc,10,0);
vf(j,:)=interp1(dday(jj),work2,dday);
end

figure
ci=[-0.3:0.05:0.3];
cc=[-0.3 0.3];
subplot(2,1,1)
up=uf;
up(up<ci(1))=ci(1);
contourf(dday,z,up,ci)
hold on
contour(dday,z,up,ci)
caxis(cc)
b2rcolormap_mod(ci);
set(gca,'YDir','reverse')
axis([303 331 0 300])
xt=get(gca,'xtick');
yday=datenum([2011 1 1])+xt;
ydaystr=datestr(yday);
ys=ydaystr(:,1:6);
set(gca,'Xticklabels',ys)
colorbar
title('U (m/s)', 'FontSize', 16)

subplot(2,1,2)
up=vf;
up(up<ci(1))=ci(1);
contourf(dday,z,up,ci)
hold on
contour(dday,z,up,ci)
caxis(cc)
b2rcolormap_mod(ci);
set(gca,'YDir','reverse')
axis([303 331 0 300])
xt=get(gca,'xtick');
yday=datenum([2011 1 1])+xt;
ydaystr=datestr(yday);
ys=ydaystr(:,1:6);
set(gca,'Xticklabels',ys)
colorbar
title('V (m/s)', 'FontSize', 16)
orient('LandScape')


