function [success] = save()
%SAVE Test function for saving a TRJ4 file.
% Uses a test rfb data file from the data folder. Uses only dummy fields
% for saving, because the actual algorithm for creating the data is not yet
% implemented.

[currentDirectory, ~, ~] = fileparts(mfilename('fullpath'));
dataFileName = fullfile(currentDirectory, '..', 'testdata', 'input', '0272.rfb');

rfb = artoa.load.rfb(dataFileName);

header = "Created in 2019" + newline + "a multiline test header";

data = [];
data(:, 1) = rfb.DATA(1:13, rfb.VARIABLE_LIST.time_of_arrival(1));
data(:, 2) = rfb.SAT_DATA(1:13, rfb.SAT_FORMAT.lat_sat);
data(:, 3) = rfb.SAT_DATA(1:13, rfb.SAT_FORMAT.lon_sat);
data(:, 4) = rfb.DATA(1:13, rfb.VARIABLE_LIST.temperature);
data(:, 5) = rfb.DATA(1:13, rfb.VARIABLE_LIST.pressure);
data(:, 6) = rfb.DATA(1:13, rfb.VARIABLE_LIST.pressure);
data(:, 7) = rfb.DATA(1:13, rfb.VARIABLE_LIST.temperature);


saveToFilename = fullfile(currentDirectory, '..', 'testdata', 'output', 'testOutput.trj4');

success = artoa.save.trj4(saveToFilename, header, data);

end

