Skip to content
Snippets Groups Projects
Commit ced74e3f authored by Yves Gouriou's avatar Yves Gouriou
Browse files

In progress

Function that manages IO and concatenation of TSG files
parent 381109ad
No related branches found
No related tags found
No related merge requests found
function [errTsg, errSpl] = TEST_READ( hMainFig, filterIndex, fullFileName)
errTsg = -2;
errSpl = -2;
% Retrieve named application data
% -------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
switch filterIndex
% Water Sample : Lecture de donnes discrtes autres que les mesures TSG
% ----------------------------------------------------------------------
case {1, 3, 8}
% Test si un fichier a dj t charg en mmoire. Ceci est obligatoire
% avant tout chargement d'un fichier bouteille
% ---------------------------------------------------------------------
if isempty( tsg.SSPS )
msgbox('Load a TSG file before a Water sample file', 'Read Bucket');
return;
elseif filterIndex == 1
% Read Argo file *.arg (G. Reverdin format)
errSpl = readArgoLocean( hMainFig, fullFileName );
elseif filterIndex == 3 || filterIndex == 8
% Read sample file *.spl
errSpl = readAsciiSample( hMainFig, fullFileName, 'SPL');
end
% TSG : lecture de donnes TSG
% ----------------------------
case {2, 4, 5, 6, 7, 9, 10, 11}
% Test si un fichier a dj t charg en mmoire.
% Offre la possibilit de concatner les fichiers ASCII et NETCDF
% ---------------------------------------------------------------
button = 'Replace';
if ~isempty( tsg.SSPS )
if filterIndex == 5 || filterIndex == 10
qstring = {'TSG data have already been uploaded in TSGQC '; ' '; ...
'Do you want to Replace or to Concatenate them?'};
title = 'Read TSG Data';
button = questdlg(qstring, title,'Replace','Concatenate','Cancel', 'Cancel');
end
end
switch button
case 'Replace'
% Initialisation de la structure TSG
% ----------------------------------
tsg_initialisation(hMainFig);
switch filterIndex
case 2 % read TSG Astrolabe text file *.ast
errTsg = readTsgDataAstrolabe( hMainFig, fullFileName);
case 4 % read TSG labview file *.lbv
errTsg = readTsgDataLabview( hMainFig, fullFileName );
case 5 % read TSG netcdf file *.nc
errTsg = readTsgDataNetCDF( hMainFig, fullFileName );
case 6 % read TSG Oracle text file *.ora
errTsg = readTsgDataOracle( hMainFig, fullFileName);
case 7 % read TSG SDF file *.sdf
errTsg = readTsgDataSDF( hMainFig, fullFileName );
case 9 % read TSG Nuka transmit file *.transmit*
errTsg = readTsgDataNuka( hMainFig, fullFileName);
case 10 % read TSG text file *.tsgqc
errTsg = readAsciiTsg( hMainFig, fullFileName);
case 11 % read TSG XML file *.xml
errTsg = readTsgDataXML( hMainFig, fullFileName );
end
case 'Concatenate'
% Gestion de la mmoire vive disponible
% -------------------------------------
% [userview systemview] = memory
% Sauvegarde la structure tsg
% ---------------------------
tsg_old = getappdata( hMainFig, 'tsg_data');
% Initailisation d'une nouvelle structure TSG.
tsg_initialisation(hMainFig);
% tsg = getappdata( hMainFig, 'tsg_data');
if filterIndex == 10
errTsg = readAsciiTsg( hMainFig, fullFileName);
elseif filterIndex == 5
errTsg = readTsgDataNetCDF( hMainFig, fullFileName );
end
error = concatStructTSG( hMainFig, tsg_old );
% Rcupre la structure tsg qui vient d'tre lue
% ----------------------------------------------
tsg = getappdata( hMainFig, 'tsg_data');
case 'Cancel'
return;
otherwise
return;
end
otherwise
% Reset pointer to arrow
% ----------------------
set( hMainFig, 'Pointer', 'arrow' );
% diplay warning msgbox
% ---------------------
msgbox( {['Invalid TSG file: ' fileName],...
'Please select another file'},...
'Warning open file', 'warn', 'modal' );
return;
end % switch filterIndex
end
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