%======================================================================
%                    S E T _ C A S T _ P A R A M S . M 
%                    doc: Mon Apr 20 09:03:09 2015
%                    dlm: Tue Oct 30 17:01:49 2018
%                    (c) 2015 A.M. Thurnherr
%                    uE-Info: 102 117 NIL 0 0 72 2 2 4 NIL ofnI
%======================================================================

% V8 processable: [1:3 8 10:103 105:108 110:116 118:120]
%	missing: 4:7 9 104 109 117
% DL: [1:3 6:8 10:103 105:108 110:116 118:120]
% UL: [1:5 8 10:103 105:108 110:120]

close all; figure(100);
more off;

%processing_version = 0;				% BT & GPS constraints; non-IMPed files
%processing_version = 1;				% BT & GPS constraints; IMPed heading
%processing_version = 2;				% BT & GPS; IMPed heading, DL only
%processing_version = 3;				% BT & GPS; IMPed heading, pitch and roll
%processing_version = 4; 				% GPS; IMPed heading, UL only
%processing_version = 5;				% GPS; IMPed heading, pitch and roll
%processing_version = 6;				% GPS; UL IMPed heading, pitch and roll; DL original
%processing_version = 7;				% like 5 but discarding all DL velocities (still using BT)
processing_version = 8;					% FINAL VERSION: UL water velocity, BT from DL, GPS and SADCP (7 with SADCP)

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

if processing_version == 0
	f.ladcpdo = sprintf('../PD0/%03dDL.000',stn);				% non-IMPed files
	f.ladcpup = sprintf('../PD0/%03dUL.000',stn);
elseif processing_version < 3
	f.ladcpdo = sprintf('../PD0/%03dDL.100',stn);				% IMPed heading
	f.ladcpup = sprintf('../PD0/%03dUL.100',stn);
elseif processing_version == 3 || processing_version == 5 || processing_version == 7 || processing_version == 8
	f.ladcpdo = sprintf('../PD0/%03dDL.101',stn);				% IMPed heading, pitch and roll
	f.ladcpup = sprintf('../PD0/%03dUL.101',stn);
elseif processing_version == 3 || processing_version == 6
	f.ladcpdo = sprintf('../PD0/%03dDL.000',stn);				% ADCP  heading, pitch and roll
	f.ladcpup = sprintf('../PD0/%03dUL.101',stn);				% IMPed heading, pitch and roll
elseif processing_version == 4
	f.ladcpdo = sprintf('../PD0/%03dUL.101',stn);				% UL only
end

if stn==6 || stn==7												% DL only
	f.ladcpup = '';
end

if (stn==4 || stn==5 || stn==117) && processing_version~=4		% UL only
	f.ladcpdo = f.ladcpup;
	f.ladcpup = '';
end

f.sadcp = '../SADCP/SADCP.mat';

f.ctd = sprintf('../CTD/%03d.1Hz',stn);
    f.ctd_header_lines      = 40;
    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			= 0;
ps.botfac			= 1;
p.saveplot	        = [1:6 9:11 12:14];

p.btrk_ts			= 20;					% with default 10 false bottom is detected in test profile 901
if stn == 31								% BT not detected correctly (shallow profile)
	p.getdepth		= 1;
	p.btrk_mode		= 2;
end

if processing_version == 2					% DL only
	f.ladcpup = '';
end

if processing_version==5 || processing_version==6	% DL & UL, GPS only
	ps.botfac = 0;
end

if processing_version == 7 || processing_version == 8
	p.edit_mask_dn_bins = [1:25];
end

if processing_version == 8
	ps.sadcpfac = 1;
	p.saveplot_pdf      = [1:6 9:11 13:14 1];	% BUG R2017b: first pdf if messed up (equal to any of the other ones)
	p.saveplot = [];
end

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

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