%======================================================================
%                    S E T _ C A S T _ P A R A M S . M 
%                    doc: Mon Apr 20 09:03:09 2015
%                    dlm: Fri Dec 15 12:20:25 2017
%                    (c) 2015 A.M. Thurnherr
%                    uE-Info: 119 25 NIL 0 0 72 2 2 4 NIL ofnI
%======================================================================

% [1:5 7:9 14:250]
%   006     no LADCP data
%   010     no LADCP data
%   011     multiple DL files; no UL data; insufficient data for processing
%   012     no LADCP data
%   013     no LADCP data


close all; figure(100);
more off;

%processing_version = 1;							% BT & GPS constraints
processing_version = 2;								% all constraints

%----------------------------------------------------------------------
% Lots of stations with multiple and/or missing files
%----------------------------------------------------------------------

dlfn = 0; ulfn = 0;									% file numbers

if     (stn ==   5), ulfn = 1;
elseif (stn ==   7), ulfn = 2;
elseif (stn ==   8), ulfn = 1;
elseif (stn ==   9), ulfn = -1;
elseif (stn ==  11), dlfn = 2;
elseif (stn ==  60), ulfn = -1;
elseif (stn == 127), ulfn = 2;
elseif (stn == 139), ulfn = 1;
elseif (stn == 142), ulfn = 1;
elseif (stn == 144), ulfn = 1;
elseif (stn == 148), ulfn = 2;
elseif (stn == 151), ulfn = 1;
elseif (stn == 154), ulfn = 1;
elseif (stn == 174), ulfn = 2;
elseif (stn == 175), ulfn = 2;
elseif (stn == 178), ulfn = 1;
elseif (stn == 181), ulfn = 1;
elseif (stn == 183), dlfn = 1;
elseif (stn == 184), ulfn = 1;
elseif (stn == 190), ulfn = 1;
elseif (stn == 191), ulfn = 1;
elseif (stn == 192), dlfn = 2; ulfn = 2;
elseif (stn == 196), ulfn = 1;
elseif (stn == 197), ulfn = 1;
elseif (stn == 200), dlfn = 1; ulfn = -1;
elseif (stn == 204), ulfn = 1;
elseif (stn == 207), ulfn = 1;
elseif (stn == 219), ulfn = 1;
elseif (stn == 221), dlfn = 3; ulfn = -1;
elseif (stn == 227), ulfn = 1;
elseif (stn == 230), ulfn = 1;
elseif (stn == 233), ulfn = 1;
elseif (stn == 236), ulfn = 1;
elseif (stn == 239), ulfn = 1;
elseif (stn == 240), ulfn = 1;
elseif (stn == 244), ulfn = 1;
elseif (stn == 245), ulfn = 1;
elseif (stn == 248), ulfn = 1;
elseif (stn == 249), ulfn = 2;
elseif (stn == 250), ulfn = 1;
end

%----------------------------------------------------------------------

if dlfn >= 0
	f.ladcpdo = sprintf('../PD0/%03d/%03dDL%03d.000',stn,stn,dlfn);
end
if ulfn >= 0
	f.ladcpup = sprintf('../PD0/%03d/%03dUL%03d.000',stn,stn,ulfn);
end

f.res         = sprintf('V%d/%03d',processing_version,stn);
f.checkpoints = sprintf('checkpoints/%03d',stn);

if stn <= 143
	f.sadcp = '../SADCP/leg1.mat';
elseif stn <= 206
	f.sadcp = '../SADCP/leg2a.mat';
else
	f.sadcp = '../SADCP/leg2b.mat';
end

f.ctd = sprintf('../CTD/%03d.1Hz',stn);
    f.ctd_header_lines      = 35;
    f.ctd_fields_per_line   = 12;
    f.ctd_pressure_field    = 2;
    f.ctd_temperature_field = 3;
    f.ctd_salinity_field    = 6;
    f.ctd_time_field        = 1;
    f.ctd_time_base         = 0;

f.nav = f.ctd;              
    f.nav_header_lines      = f.ctd_header_lines;
    f.nav_fields_per_line   = f.ctd_fields_per_line;
    f.nav_time_field        = f.ctd_time_field;
    f.nav_lat_field         = 11;
    f.nav_lon_field         = 12;
    f.nav_time_base         = f.ctd_time_base;    
    
%----------------------------------------------------------------------

ps.fig3_colormap 	= 1;					% defaults
ps.fig3_err_y_axis 	= 1;
ps.sadcpfac			= 1;
p.saveplot	        = [1:6 9:11 12:14];

if processing_version == 1
	ps.sadcpfac 	= 0;					% disable SADCP constraint for QC
elseif processing_version == 2				% don't do anything special for default processing
	p.saveplot_pdf  = [1:6 9:11 12:14];
	p.saveplot		= [];
end

if stn == 48 || stn == 179
	p.btrk_mode = 2;
end

p.ladcp_station     = stn;
p.checkpoints       = [1]; 

p.cruise_id         = 'P06';
p.whoami            = 'A.M. Thurnherr';
p.name              = sprintf('%s station #%d (V%d)',p.cruise_id,p.ladcp_station,processing_version);

