% This is a stripped down version of setup.m suitable for coupling with 
% zap editing from autoedit as a gui tool only.  All thresholds (except 
% amplitude)are disabled.  Please look at setup.m.demo to start wiht the
% original setup.m.

%2001/09/14 - JH
%>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>


%% must have a file that is in the matlab adcp directory (where edit/ sits)
%% 97/09/10 - was harmcrv before this: since we moved it, I chose smoothr (jh)
test_file = 'smoothr';

if (exist('shipedit') ~= 2)
   base_path = which(test_file);            %find path to dir_edit_base
   if (isempty(base_path))
      fprintf('you do not have the adcp editing programs on your path.\n')
      return
   end
   bl = length(base_path);                  %length of total path
   base_path((bl-(length(test_file)+1)):bl) = [];  %strip the file off
   path([base_path 'edit'], path);          %add edit to path
end
clear test_file

% editglob
global ABS_U ABS_V AMP AMP_OFFSET BADACC BADBIN BADBIN_BAK
global BADPRF BADPRF_BAK BMAX BMIN BOTM_EDIT BOTTOM BOTTOM_BAK
global CURRX DAYS DBNAME DEFAULT_NBINS DEFAULT_NPRFS DEFAULT_SEQ_FLAG
global DEPTH DISP E EDIT_MODE E_OFFSET IBLKPRF IKEY INITed
global LASTCOMM LASTPLOT LAT LISTED LON LONLAT NBINS NPRFS
global PFLAG PGOOD PLOTBAD PMAX PMIN REFLAYER_ENDBIN REFLAYER_STARTBIN
global TIME U UV_OFFSET U_ROTATE V V_ROTATE W W_OFFSET YAXIS
global PLOTBAD_ORIGINAL
global PGOOD_THRESHOLD D2W_THRESHOLD D2UV_THRESHOLD ...
       WVAR_THRESHOLD AMP_THRESHOLD EV_THRESHOLD
global USE_LGB PLOTNAV start_bin verbose PLOTUV
global PGOOD_OFFSET LGB MAB


LISTED                      =   1;
INITed                      =   0;

% >>>>>>>>>>>>>>>>>>>>>> Retrieval Parameters >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
DBNAME                      =   '../adcpdb/oc407'; 
DEFAULT_SEQ_FLAG            =   1; 
DEFAULT_NPRFS               =   40;   
DEFAULT_NBINS               =   60;  
REFLAYER_STARTBIN           =   2;
REFLAYER_ENDBIN             =   20; 

% >>>>>>>>>>>>>>>>>>>>> Editing Parameters >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
% To disable any of the editing criteria below, set it to []
EDIT_MODE                   =   1;
PGOOD_THRESHOLD             =   50; 
USE_LGB                     =   1;          
D2W_THRESHOLD               =   [];
D2UV_THRESHOLD              =   [];
EV_THRESHOLD                =   []; 
WVAR_THRESHOLD              =   [];
start_bin                   =   3;      
AMP_THRESHOLD               =   15; 
BOTM_EDIT                   =  1;       
verbose                     =   1;        
% >>>>>>>>>>>>>>>>>>>>>> Plotting Parameters >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
UV_OFFSET                   =   0.1;
W_OFFSET                    =   0.02;
E_OFFSET                    =   0.02;
AMP_OFFSET                  =   10;
PGOOD_OFFSET                =   10;
PLOTBAD                     =   1;    
PLOTUV                      =   1;    

editpdef
