function rlookit2(data, config, reflrange);
% rlookit2(data, config);
% show measu, measv, mease, measw and measured reflu,v
%
% eg: dd = read(nb,..)
%     [data, config] = restruct(nb, dd);
%     rlookit2(data, config, [3 5])

if (nargin ~=3)
   help rlookit
   error('must specify beamnum and refl range')
end

if ~(exist('reflrange'))
   reflrange = [3 8];
end


data.mins = 24*60*(data.dday - data.dday(1));
config.abc_name = 'mins';
config.xlim = [data.mins(1) data.mins(end)];
numplots = 5;
reflrange = unique(reflrange);



if (length(reflrange) > 1)
   refu = mstdgap(data.umeas([reflrange(1):reflrange(2)],:));
   refv = mstdgap(data.vmeas([reflrange(1):reflrange(2)],:));
   refw = mstdgap(data.wmeas([reflrange(1):reflrange(2)],:));
else
   refu = data.umeas(reflrange,:);
   refv = data.vmeas(reflrange,:);
   refw = data.wmeas(reflrange,:);
end


data.dr_umeas = data.umeas - ones(length(data.bins),1)*refu;
data.dr_vmeas = data.vmeas - ones(length(data.bins),1)*refv;
data.dr_wmeas = data.wmeas - ones(length(data.bins),1)*refw;



%plot velocities
clg;whitebg('w')
config.comment = 'DE-REFERENCED U';config.var_range = [-1.5, 1.5];
cfg =aplotit(data, config, 'cur_ax', subplot(numplots,1,1), 'fn', 'dr_umeas');
config.comment = 'DE-REFERENCED V';config.var_range = [-1.5, 1.5];
cfg =aplotit(data, config, 'cur_ax', subplot(numplots,1,2), 'fn', 'dr_vmeas');
config.comment = 'DE-REFERENCED W';config.var_range = [-1, 1];
cfg =aplotit(data, config, 'cur_ax', subplot(numplots,1,3), 'fn', 'dr_wmeas');
config.comment = 'E';
cfg =aplotit(data, config, 'cur_ax', subplot(numplots,1,4), 'fn', 'emeas');


ax = subplot(numplots, 1, 5);
h = plot(data.mins, refu, 'r', 'linewidth', 1);hold on
h = plot(data.mins, refv, 'g', 'linewidth', 1);
h = plot(data.mins, refw, 'b', 'linewidth', 1);
matchbox(gca, cfg.box_ax, 'width')
xlabel('minutes')
ylabel('meas vel (m/s)')
xlim(config.xlim)
yl = [min(min(refu), min(refv))-.2   max(max(refu), max(refv))+.2];
ylim(yl);
xtext = config.xlim(1) + .02*diff(config.xlim);
ytext_w = yl(1) + .21*diff(yl);
ytext_v = yl(1) + .14*diff(yl);
ytext_u = yl(1) + .07*diff(yl);
text(xtext, ytext_u, sprintf('u refl'),...
     'color','r','fontweight','bold', 'fontsize',8)
text(xtext, ytext_v, sprintf('v refl'), ...
     'color','g','fontweight','bold', 'fontsize',8)
text(xtext, ytext_w, sprintf('w refl'), ...
     'color','b','fontweight','bold', 'fontsize',8)


date_it

if (length(reflrange) > 1)
   reflstr = sprintf('refl bins = [%d - %d]', reflrange(1), reflrange(2));
else
   reflstr = sprintf('refl bin = %d', reflrange(1));
end


subtitle_comment = ...
    sprintf('MEASURED VELOCITIES, raw data, %s, (dday %3.3f - %3.3f)',...
            reflstr, min(data.dday), max(data.dday));
subtitle(subtitle_comment)
