Skip to content
Snippets Groups Projects
Commit 282a6ada authored by leprob001's avatar leprob001
Browse files

Adjusted reloadRfb function so that it only overwrites the metadata.

The offsets get recalculated.
parent 902e237b
No related branches found
No related tags found
No related merge requests found
254
\ No newline at end of file
255
\ No newline at end of file
function [] = reloadRfb(~, ~)
%LOADRFB Creates a file selection dialog and reads the file into memory.
global artoaDataInput;
global artoaDataInput artoaWorkspace;
%% Check if path is available
if ~isfield(artoaDataInput, 'path_rfb')
error([mfilename ': No rfb file available, please load it manually.']);
end
waitfor( ...
msgbox( ...
[ ...
'You cannot reload the rfb file, because the reference is missing. ' ...
'Please specify the path to the file in the next dialog.' ...
] ...
, 'RFB Path missing' ...
, 'error' ...
) ...
);
[filename, pathname] = uigetfile('*.rfb', 'Specify rfb filename');
if filename == 0
return;
end
%% Initialize variables
artoaDataInput.rfb = false;
artoaDataInput.path_rfb = fullfile(pathname, filename);
end
%% Check if file exists
if ~isfile(artoaDataInput.path_rfb)
error([mfilename ': Selected file ' filepath ' is not a file! Please try again!']);
waitfor(msgbox(['The file ' artoaDataInput.path_rfb ' does not exist!'], 'Error', 'error'));
artoaDataInput = rmfield(artoaDataInput, 'path_rfb');
return;
end
%% Close all windows
artoa.controller.edit.pressure.close();
artoa.controller.edit.temperature.close();
artoa.controller.edit.timeOfArrival.close();
artoa.controller.track.trajectoryOutput.close();
%% Ask for confirmation
answer = questdlg( ...
[ ...
'Reload RFB file "'...
artoaDataInput.path_rfb ...
'"?' ...
], ...
'Reload rfb file?', ...
'Yes', ...
'No', ...
struct('Default', 'Yes', 'Interpreter', 'none') ...
);
if strcmp(answer, 'No')
return;
end
%% Load file into memory
artoaDataInput.rfb = artoa.load.rfb(artoaDataInput.path_rfb);
%% Load rfb file
rfb = artoa.load.rfb(artoaDataInput.path_rfb);
%% Update artoaDataInput variable
artoaDataInput.rfb.FLOAT = rfb.FLOAT;
artoaDataInput.rfb.SAT_FORMAT = rfb.SAT_FORMAT;
artoaDataInput.rfb.SAT_DATA = rfb.SAT_DATA;
artoaDataInput.rfb.VARIABLE_LIST = rfb.VARIABLE_LIST;
%% Update workspace
artoa.controller.initializeArtoa4();
artoa.controller.copyRfbToWorkspace();
artoa.controller.copyRfbToWorkspace(true);
%% Update offset table
artoaWorkspace.editOffsets.offsets = artoa.offsets.generateOffsetTable( ...
artoaWorkspace.float, ...
artoa.controller.getSoundsourcesWithAppliedToa() ...
);
%% Initialize tracking parameter
artoa.controller.track.parameter.initialize(true);
%% Update GUI
artoa.controller.track.parameter.updateGui();
%% Initialize offsets
artoa.controller.edit.offsets.initialize(true);
artoa.controller.edit.offsets.updateGui();
%% Calculate soundspeed
artoa.controller.edit.offsets.updateMeasuredSoundspeed();
%% Update menu buttons
artoa.controller.updateMenuButtons();
%% Update status text in main window
artoa.controller.main.updateLoadedFloatInformation();
......
function [] = copyRfbToWorkspace()
function [] = copyRfbToWorkspace(pIgnoreDataSection)
%COPYRFBTOWORKSPACE Copies rfb input data to the workspace.
% Gets all required data from the artoaDataInput variable, prepares it
% for calculations and operations and stores them in the artoaWorkspace
......@@ -6,9 +6,32 @@ function [] = copyRfbToWorkspace()
global artoaDataInput artoaConfig artoaWorkspace;
%% Generate workspace
%% Parameter check
if ~exist('pIgnoreDataSection', 'var')
pIgnoreDataSection = false;
end
%% FLOAT DETAILS
artoaWorkspace.float = artoaDataInput.rfb.FLOAT;
%% SAT DATA
fnames = fieldnames(artoaDataInput.rfb.SAT_FORMAT);
artoaWorkspace.satData = struct();
for i = 1:length(fnames)
artoaWorkspace.satData.(fnames{i}) = artoaDataInput.rfb.SAT_DATA( ...
:, ...
artoaDataInput.rfb.SAT_FORMAT.(fnames{i}) ...
);
end
%% STOP IF DATA SHOULD BE IGNORED
if pIgnoreDataSection
return;
end
%% 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), ...
......@@ -21,6 +44,7 @@ artoa.convert.hms2rd( ...
artoaDataInput.rfb.DATA(:, artoaDataInput.rfb.VARIABLE_LIST.start_listen_sec) ...
);
%% TOA
artoaWorkspace.toaData = struct();
artoaWorkspace.toaData.status = zeros( ...
......@@ -85,19 +109,6 @@ artoa.data.replaceValuesWithNaN( ...
artoaWorkspace.pressure, artoaConfig.defaults.pressure ...
);
%% FLOAT DETAILS
artoaWorkspace.float = artoaDataInput.rfb.FLOAT;
%% SAT DATA
fnames = fieldnames(artoaDataInput.rfb.SAT_FORMAT);
artoaWorkspace.satData = struct();
for i = 1:length(fnames)
artoaWorkspace.satData.(fnames{i}) = artoaDataInput.rfb.SAT_DATA( ...
:, ...
artoaDataInput.rfb.SAT_FORMAT.(fnames{i}) ...
);
end
%% GET SOUNDSOURCES THAT ARE ALIVE DURING THE FLOAT MISSION
artoaWorkspace.filteredSoundsources = artoa.soundsources.filter( ...
artoaDataInput.soundsources, min(artoaWorkspace.rafosDate), max(artoaWorkspace.rafosDate) ...
......
......@@ -181,7 +181,7 @@ artoaGui.main.menus.fileReloadSoundsourceFile = uimenu( ...
% RFB FILE
artoaGui.main.menus.fileReloadRfbeFile = uimenu( ...
artoaGui.main.menus.fileReload, ...
'Label', 'RFB file', ...
'Label', 'RFB metadata', ...
'Callback', pCallbacks.reloadRfbFile ...
);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment