function [] = copyRfbToWorkspace()
%COPYRFBTOWORKSPACE Copies rfb input data to the workspace.
%   

global artoaDataInput artoaWorkspace;

%% Generate workspace

%% TOA
artoaWorkspace.toaData = struct();
artoaWorkspace.toaData.status = zeros( ...
    size(artoaDataInput.rfb.DATA, 1) * length(artoaDataInput.rfb.VARIABLE_LIST.time_of_arrival), ...
    1 ...
);

artoaWorkspace.toaData.toa = [];
toaColumns = artoaDataInput.rfb.VARIABLE_LIST.time_of_arrival;
for i = 1:length(toaColumns)
    artoaWorkspace.toaData.toa = [ ...
        artoaWorkspace.toaData.toa; ...
        artoaDataInput.rfb.DATA(:, toaColumns(i)) ...
    ];
end

%% EXCLUDE INVALID TOAs
toaToExclude = artoaWorkspace.toaData.toa(:) == 9999;
artoaWorkspace.toaData.status(toaToExclude) = 2;


%% TEMPERATURE
artoaWorkspace.temperature = artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.temperature);
artoaWorkspace.statusTemperature = zeros(size(artoaDataInput.rfb.DATA, 1), 1);

%% PRESSURE
artoaWorkspace.pressure = artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.pressure);
artoaWorkspace.statusPressure = zeros(size(artoaDataInput.rfb.DATA, 1), 1);


%% EXCLUDE LINES CONTAINING 9999
temperatureToExclude = artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.temperature) == 9999;
pressureToExclude = artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.pressure) == 9999;
%pointsToExclude = or(temperatureToExclude, pressureToExclude);
artoaWorkspace.statusTemperature(temperatureToExclude) = 2;
artoaWorkspace.statusPressure(pressureToExclude) = 2;

%% RAFOS DATE
artoaWorkspace.rafosDate = artoa.convert.dmy2rd( ...
    artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.start_listen_day), ...
    artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.start_listen_mon), ...
    artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.start_listen_yr) ...
) ...
+ ...
artoa.convert.hms2rd( ...
    artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.start_listen_hr), ...
    artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.start_listen_min), ...
    artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.start_listen_sec) ...
);

%% FLOAT DETAILS
artoaWorkspace.float = artoaDataInput.rfb.FLOAT;


end

