% Configuration for sir picking code. 
PickerVersion = 3.20;
%% Parameters You Can Change:

% This is the path avove the Flight/Line level (not including the
% Flight/Line dir)
inputpath = 'Z:\trunk\icepod\antarctica\20172018\radar\dice\sar\stack01';
% inputpath = 'Z:\trunk\icepod\antarctica\20162017\radar\sir\fft\stack04';

% Flight/Line to pick
pickLine = 'L100';

pickChan = '3usCh1';    % only applicable for DICE
%

% This is path structure inside the Flight dir
inputSubDir = ['decimated',filesep,'mat'];
% inputSubDir = ['mat'];

% Files to Pick: these are the number tags at the ends of the file names
startfile = 47;
endfile = 50;

% This will be saved in the mat file use a descriptive word or phrase
% e.g. 'bed', '', 'shallow layers', 'deep layers' etc..
pickType = 'bed';

outputRootDir= 'E:\theater\Antarctica\20172018';
outputSubDir = 'Bed_Picks'; % dir to create inside outputRootDir

% your name <FirstInitial><LastName> e.g. PBear for Polar Bear
% If the name is already taken, add middle initial if you have one. 'PWBear' for Polar White Bear,
% If you don't have a middle name, use two letters of your first name. 'PoBear' for Polar Bear that isn't white
% This name is used to organize the data so be consistent!
pickername='ICordero';

if strcmpi(pickername,'PBear')
    err = errordlg({'If only a polar bear could pick the bed!';'Please change the pickername in sirPickConfig.m.'});
    uiwait(err);
    if exist(logFile,'file')
        diary off;
        [~,~,fext] = fileparts(logFile);
        if strcmpi(fext,'.log')     % just making sure file extension is log
            delete(logFile);
        end
    end
    error('sirBedPicker:badPickerName','Picker Name ''%s'' is unacceptable',pickername);
end

%% Parameters less likely to change
outputpath = [outputRootDir,filesep,outputSubDir,filesep];
inputpath = [inputpath,filesep,pickLine,filesep,inputSubDir,filesep];

sirDataFileFilter = '*level1a*SIR*.mat';   % FiterSpec for level1a sir files
sirConfigFileFilter = 'sir*onfig*.mat';    % FilterSpec for configuraion file in the data directory 

diceDataFileFilter = ['*',pickChan,'*level2a*DICE*.mat'];   % FiterSpec for level1a sir files
diceConfigFileFilter = 'diceProcess*onfig*.mat';    % FilterSpec for configuraion file in the data directory 

pickon='rising';  % 'rising', 'falling', or 'peak'. Leave as rising if you don't know.

% Save image Data to the mat file - significanty increases the output file
% size
saveData = false;

% When true, generates stitched mat and text outputs when done picking the
% last file
genStitchedProducts = true;

outputsuffix = 'Picks';
stitchedSuffix = 'StitchedPicks';

%Leave this as 1 unless your input file numbers aren't incremented by 
%one (i.e. 5, 10, 15, 20 or 10, 20, 30, 40)
fileincrement=1;

sirCutOffDepth=-500;  % m (nothing can be picked below this depth)
diceCutOffDepth = -1000;

diceNoiseDepth = -950;  % m
sirNoiseDepth = 125;  % m

% Scrolling Parameters
panfactor=.4;    %fraction of current window
zoomfactor=.5;   %fraction of current window

% Text Display Parameter
sirTextDepth=-500;   %m   This controls where your notes display (value should be negative)
diceTextDepth=-1900;   %m   This controls where your notes display (value should be negative)
textspacing=150;   %m   This controls the spacing between notes

% Color scale:
normcaxis=[-2,5];     % unitless

% For old data:
replacezeros=0;        % logical
zeroreplacement=1e-3;

%% Parameters You Cannot Change:
platform = 'icepod';

% Characteristic Wavelengths:
xwavelength=50;  %m 
ywavelength=5;  %m

% Picking Parameters:
diceBrushwindow=25;      %m  (vertical) 25
diceBrightwindow=50;     %m (vertical) 50
sirBrushwindow=2;      %m  (vertical) 2
sirBrightwindow=4;     %m (vertical) 4
beeline_length=.5;   %km  (horizontal)

% Velocities:
c_air=3e8;     %m/s
c_ice=1.68e8;  %m/s

% Radar parameters:
%breakind=471;       % index 
%samp_int=1/(150e6); % s

% File stuff
fileFieldSep = '_';
CampaignField = 1;
FlightNumField = 2;
dateField = 3;
timeField = 4;
sirLevelField = 5;
sirSensorField = 6;
sirFileNumField = 7;
chanField = 5;
diceLevelField = 6;
diceSensorField = 7;
diceFileNumField = 8;
outFileDateFormat = 'yyyymmdd';
outFileTimeFormat = 'HHMMSS';

%% Create Map Structure:

% Make standard SCAR projection:
mstruct=defaultm('stereo');
mstruct.geoid=almanac('earth','wgs84','m');
mstruct.falseeasting=0;
mstruct.falsenorthing=0;
mstruct.origin=[-90,0,0];
mstruct.maplatlimit=[-90,0];
mstruct.maplonlimit=[-180,180];
mstruct.scalefactor=.9728;
mstruct=defaultm(mstruct); 

% UPS north:
% mstruct=defaultm('ups');
% mstruct.geoid=almanac('earth','wgs84','m');
% mstruct=defaultm(mstruct);