% Parameter file:  cnt_final_hyIX
%
% Parameter file for HYBRID BB/WH CONFIGURATION: WH = UP, BB = DOWN 
% processed with Andreas version IX.
% For FINAL (third) pass use NAV, CTD, BT, and SADCP data. 
% LMB Sept 2005

% ************ setting paths to data, software, and save directories ******

% put zeroes in front of statnum 
%stnstr = sprintf('%03d',stn);
stnstr = stncaststr(1:3);
caststr = stncaststr(5:6);
stn = sprintf('%03d',str2num(stnstr));

% set run_name, cruise_str, and directory name
run_name = '-final-hyIX-';
cruise_str = 'ab';
cruisedir = 'sept2005';

% path to 'root' directory (with cruise dir and data in)
% NOTE: the path to software is actually set in run*.m now
visdir = '/Mahe/ladcp_processing/mocha';

% paths to BB data
f.ladcpdo = [visdir '/' cruisedir '/ladcp/' cruise_str stncaststr 'm.000'];
% no uplooker
f.ladcpup = [visdir '/' cruisedir '/ladcp/' cruise_str stncaststr 's.000'];
%f.ladcpup = [''];

%path to nav data (global file)
f.nav = [visdir '/' cruisedir '/nav/nav.vis'];
%f.nav = [' '];

% path to processed data and checkpoints directories
p.name = [cruise_str stnstr run_name ];
f.res = ['pro/' cruise_str stnstr '/' p.name ];
f.checkpoints = ['pro/' cruise_str stnstr '/checkpoints/' stnstr];
% LMB 19/3/2002 make directory 'cruise_str stnstr'
if exist(['pro/' cruise_str stnstr],'file') ~= 7
    mkdir('pro',[cruise_str stnstr]) 
end
if exist(['pro/' cruise_str stnstr '/checkpoints'],'file') ~= 7
    mkdir('pro',[cruise_str stnstr '/checkpoints'])
end

% path to CTD data 
f.ctd = [visdir '/' cruisedir '/ctd/AB0509' stnstr '.cnv'];

% path to SADCP data
f.sadcp = [visdir '/' cruisedir '/sadcp/rb0509_adp.mat'];

% ************************* end of path defining *************************

% a couple of bug fixes for matlab figures from Andreas
p.saveplot_png = [];
close all; figure(100)

% ******** CONTROL parameters for processing   ******
% Note that if parameters are not set here then whatever appears
% in default.m is used.

p.cruise_id = cruisedir;
% minimum % good
p.pglim=0.0; 
% maximum error velocity  [m/s]
p.elim=0.2; 
% maximum difference between W per profile [m/s] 
p.wlim=0.08;

% inverse solve parameter = 1 to solve down and up individually
ps.down_up=0;

% Set ps.dz to be resolution of final LADCP profile. Pre-average 
% data to this resolution
ps.dz=20;
p.avdz=ps.dz;

% Disregard first bin on WH300 (uplooker) and use on BB150 (downlooker)
p.edit_mask_up_bins = [1];
p.edit_mask_dn_bins = [1];

% a strong speckle filter (default is only 1) is capable of removing 
% previous ping interference and interference from other instruments
% DISABLE FOR WH300 - Andreas, May2006
p.edit_spike_filter = 0;
%p.edit_spike_filter_max_curv = 5;

% By default low-mode solutions are damped (?). To switch this off
% (recommended) uncomment the following:
ps.smallfac = [1 0];
% to smooth high-mode shear increase smoofac:
ps.smoofac = 0;

% This factor is used to differentiate true and false bottom returns. It
% may need to be increased if instrument interference is mis-interpreted as
% bottom returns.
p.btrk_ts = 10;

% Disable calculations of diffusivity (still unreliable)
clear pk

% rotate down-looking velocities to up-looking heading if 
% BB heading is suspicious
%p.rotup2down = 4;

% try to get bottom track out of water bins (for old RDI systems)
% p.btrk_ts is in dB to detect bottom above bin1 level (for own btm track)
% p.btrk_range gives maximum distance for bottom track
% mode = 1 :   use only RDI bottom track
%        2 :   use only own bottom track
%        3 :   use RDI, if existent, own else (default)
%        0 :   use not bottom track at all
p.btrk_mode = 3;

% fitting CTD data:  
%set p.ctdmaxlag = 0; 
% to disable the automatic lag correlation and force CTD data to be used

% time interval before and after station from which to use SADCP profiles
%p.sadcp_dtok = 0;

% Save Plots 
% Save figure numbers to ps file
%    1 : Summary Plot
%    2 : Engineering Data
%    3 : Data Quality
%    4 : Depth
%    5 : Heading Corrections 
%    6 : Up/Down Differences
%    7 : CTD Position
%    8 : Shear
%    9 : SADCP U, V 
%   10 : U, V Offsets, Tilt Error
%   11 : Processing warnings
%   13 : Bottom track diagnostics
%   14 : Data editing diagnostics

p.saveplot = [1:3,5,11,14];

% RUN 2:  USE CTD, NAV, AND BT 
ps.shear = 1;       % for shear solution (to compare)
ps.barofac = 1;     % for GPS reference
ps.botfac = 1;      % for BT reference
ps.sadcpfac = 10;    % for SADCP reference

