%run_aplotscat.m
%
% This program generates a diagnostic plot of dubious use: it plots shear in the top
% 10 bins (velocity of the velocity in the forward direction , relative to bin 20) 
% as a function of amplitude vor various ship speeds (in 1m/s intervals).
%
% instructions: 
%    (go to the location of asetup.m and aflagit_setup.m; edit those first)
% usage:
%  asetup; run_aplotscat

% Jules 2000/11/27

%run asetup.m first

if (~isfield(config, 'prefix'))
   config.prefix = 'a_';
end


% override some for this application
config.nbins = 30;              % override from asetup
config.oscutoff = 1;            % override default of 2m/s

%and set this one
config.ddrange  =  config.end_dd - config.start_dd + 1; %get all the data


%======================================================================
%set some other stuff: 
refbin = 20;
speeds = [1.5:8];
bins = [2:10];
amprange = [20 180];        %abcissa range
shearrange = [-50 50];      %ordinate range


%get the data

[data, config] = agetmat(config);
aflagit_setup

%override so we don't clip anything
pfc.cfg.trimtopbins = 0;         %exclude none
pfc.cfg.amp_cutoff_atbin1 = 0;   %cut off none


[flagged, pfc1] = aflagit(data, config, pfc);

%dot-multiply flag mask
dtfm = ones(size(flagged));    %ones where good
dtfm(find(flagged ~= 0)) = NaN;  %nans where bad


% (1) scatter plot binned in speed and depth, looking for forward bias
%for plotting scatter

figure(gcf);
whitebg(gcf,'w')
aplotscat

orient tall
print -dpsc aplotscat
