function plotref(abs_U, sm_U, time, nav, lonlat, fbin, lbin)
%
% plots the raw and smoothed absolute reference layer velocity

nprfs = length(time);

%--- make raw absolutes bar-shaped for plotting ---
dt = diff(time)/2;
tt(1:2:2*nprfs-1) = [NaN time(1:nprfs-1)+dt];
tt(2:2:2*nprfs)   = [time(2:nprfs)-dt time(nprfs)];
uu(1:2:2*nprfs-1) = abs_U(1,:);
uu(2:2:2*nprfs)   = abs_U(1,:);
vv(1:2:2*nprfs-1) = abs_U(2,:);
vv(2:2:2*nprfs)   = abs_U(2,:);

%--- plot smoothed vs. unsmoothed absolute reference layer velocities ---
clf
orient tall
axes('position', [.0641 .73 .8846 .18])
h = plot(tt, uu, time, sm_U(1,:), '.');
axis([time(1) time(nprfs) -1.0 1.0])
grid
set(h, 'markersize', 10)
set(gca, xtl_str, [''])
ylabel('U (m/s)')
title(['Absolute Reference Layer Velocity (Using Bins ' int2str(fbin) ' - ' int2str(lbin) ')'])

axes('position', [.0641 .53 .8846 .18])
h = plot(tt, vv, time, sm_U(2,:), '.');
axis([time(1) time(nprfs) -1.0 1.0])
grid
set(h, 'markersize', 10)
ylabel('V (m/s)')

% plot the positions (vs. time)
if (max(abs(diff(lonlat(1,:)))) > 180) % ship is crossing the dateline
  neg_ind = find(lonlat(1,:) < 0);
  lonlat(1, neg_ind) = lonlat(1, neg_ind) + 360;
end;

llmarg = 0.1;
igood = find(~isnan(lonlat(1,:)));
minlon = min(lonlat(1,igood))-llmarg;
minlat = min(lonlat(2,igood))-llmarg;
maxlon = max(lonlat(1,igood))+llmarg;
maxlat = max(lonlat(2,igood))+llmarg;
dll = max([abs(maxlon-minlon) abs(maxlat-minlat)]);
axes('position', [.0641 .29 .8846 .18])
h = plot(time, nav(1,:), '+', time, lonlat(1,:), '-');
axis([time(1) time(nprfs) minlon minlon+dll])
set(h, 'markersize', 5)
set(gca, xtl_str, [''])
ylabel('Longitude')
grid

axes('position', [.0641 .09 .8846 .18])
h = plot(time, nav(2,:), '+', time, lonlat(2,:), '-');
axis([time(1) time(nprfs) minlat minlat+dll])
set(h, 'markersize', 5)
ylabel('Latitude'),
xlabel('Time (decimal days)')
grid
text(-0.25, -0.35, pctime, 'units', 'normalized', 'rotation', 90.0); 

