% Sample Matlab script for reading and plotting Biosonics data

fname = 'C:\Documents and Settings\Daniel\Data\P6314\Moored ADCP\CO08B001.000';
adcp = rdradcp(fname,1);
%save adcp.mat adcp
%clear;
%load adcp.mat;

z = adcp.config.ranges;
u = adcp.east_vel;
v = adcp.north_vel;
w = adcp.vert_vel;

time = adcp.mtime;
t0 = 1.0e+005 * 7.336885424815164;
time = time-t0;
tmin = 0;
tmax = max(time);

umin=-0.25; umax=0.25;
wmin=-0.025; wmax=0.025;
zmin = 0; zmax = 33;

subplot(3,1,1);
pcolor(time,z,u);
shading('interp');
colorbar;
caxis([umin umax]);
set(gca,'tickdir','out','yminortick','on','xlim', [tmin tmax],'ylim', [zmin zmax],'XTickLabel',[])
%datetick('x',7,'keeplimits');
ylabel('Depth (mab)');
title ('u (m/s)')

subplot(3,1,2);
pcolor(time,z,v);
shading('interp');
colorbar;
caxis([umin umax]);
set(gca,'tickdir','out','yminortick','on','xlim', [tmin tmax],'ylim', [zmin zmax],'XTickLabel',[])
%datetick('x',7,'keeplimits');
ylabel('Depth (mab)');
title ('v (m/s)')

subplot(3,1,3);
pcolor(time,z,w);
shading('interp');
colorbar;
caxis([wmin wmax]);
set(gca,'tickdir','out','yminortick','on','xlim', [tmin tmax],'ylim', [zmin zmax])
%datetick('x',7,'keeplimits');
ylabel('Depth (mab)');
xlabel('Days');
title ('w (m/s)')