Skip to content
Snippets Groups Projects
Commit 85fd6870 authored by jacques.grelet_ird.fr's avatar jacques.grelet_ird.fr
Browse files

add progress bar on .tsgqc file reading

use repmat instead of for loop to define format
add GOSUD version in menu help/about
parent 6c0a578c
No related branches found
No related tags found
No related merge requests found
...@@ -14,6 +14,21 @@ function [error] = readAsciiTsg( hMainFig, filename ) ...@@ -14,6 +14,21 @@ function [error] = readAsciiTsg( hMainFig, filename )
% %
% $Id$ % $Id$
% use waitbar per default
% ----------------------
wbool = true;
% update waitbar title with Tex mode disable
% ------------------------------------------
if wbool
%set(0,'DefaulttextInterpreter','none')
msg = sprintf('Loading file %s. Please wait...', filename);
wb = waitbar(0, msg);
hchild = get(wb,'children');
htitle = get(hchild,'title');
set(htitle,'Interpreter','None');
end
% Get the data from the application GUI % Get the data from the application GUI
% ------------------------------------- % -------------------------------------
tsg = getappdata( hMainFig, 'tsg_data'); tsg = getappdata( hMainFig, 'tsg_data');
...@@ -96,15 +111,12 @@ while ~OK ...@@ -96,15 +111,12 @@ while ~OK
end end
end end
% Builld the format depending on the header parameters % Build the format depending on the header parameters
% 1 - Decimate the HEADER - The 7th first parameters are always % 1 - Decimate the HEADER - The 7th first parameters are always
% %HEADER YEAR MNTH DAYX hh mm ss % %HEADER YEAR MNTH DAYX hh mm ss
% 2 - The 6 Date and time parametes are read in %d % 2 - The 6 Date and time parametes are read in %d
% ------------------------------------------------------------- % -------------------------------------------------------------
format = '%d %d %d %d %d %d'; format = strcat('%d %d %d %d %d %d', repmat(' %f', 1, nHeader - 6));
for i = 7 : nHeader
format = [format ' %f'];
end
% Read the data in a cell % Read the data in a cell
% ----------------------- % -----------------------
...@@ -114,6 +126,18 @@ cellData = textscan( fid, format ); ...@@ -114,6 +126,18 @@ cellData = textscan( fid, format );
% --------------------------- % ---------------------------
s = cell2struct(cellData, header, 2); s = cell2struct(cellData, header, 2);
% get the number of line read
% ----------------------------
nlines = length(s.YEAR);
% moves the waitbar cursor
% ------------------------
for i=1 : nlines
if wbool && (mod(i, 100) == 0)
waitbar( i/nlines, wb);
end
end
clear cellData clear cellData
% Date (y m d h m s) in the first 6 elements in data % Date (y m d h m s) in the first 6 elements in data
...@@ -142,7 +166,7 @@ for i = 7 : nHeader ...@@ -142,7 +166,7 @@ for i = 7 : nHeader
else else
tsg.(char(header(i))) = s.(char(header(i))); tsg.(char(header(i))) = s.(char(header(i)));
end end
end end
% populate tsg.file structure % populate tsg.file structure
...@@ -168,7 +192,7 @@ if (file_ini_id ~= -1) ...@@ -168,7 +192,7 @@ if (file_ini_id ~= -1)
% display information on command window % display information on command window
% -------------------------------------- % --------------------------------------
fprintf('\n...reading %s : ', file_ini); fprintf('\n...reading %s : %s lines', file_ini, nlines - 1);
% Save the data in the application GUI % Save the data in the application GUI
% ------------------------------------ % ------------------------------------
...@@ -197,6 +221,12 @@ fclose( fid ); ...@@ -197,6 +221,12 @@ fclose( fid );
% ------------------------------------ % ------------------------------------
t = toc; fprintf('...done (%6.2f sec).\n\n',t); t = toc; fprintf('...done (%6.2f sec).\n\n',t);
% Close waitbar
% -------------
if wbool
close(wb)
end
% Everything OK % Everything OK
% ------------- % -------------
error = 1; error = 1;
......
...@@ -65,13 +65,15 @@ hRightPanel = uipanel( ... ...@@ -65,13 +65,15 @@ hRightPanel = uipanel( ...
'ButtonDownFcn', @quitAboutCallback); 'ButtonDownFcn', @quitAboutCallback);
% display info in botom panel % display info in botom panel
msg = sprintf( 'TSGQC Version : %s - GOSUD format: %s', ...
tsg.preference.char_version, tsg.FORMAT_VERSION)
uicontrol('Parent', hBottomPanel, ... uicontrol('Parent', hBottomPanel, ...
'Style','text',... 'Style','text',...
'FontSize', 14, ... 'FontSize', 14, ...
'Units','normalized',... 'Units','normalized',...
'Position',[.1 .1 .9 .5],... 'Position',[.1 .1 .9 .5],...
'FontWeight','bold',... 'FontWeight','bold',...
'String',strcat('TSGQC Version : ', ' ', tsg.preference.char_version),... 'String', msg,...
'HorizontalAlignment','center'); 'HorizontalAlignment','center');
% display info in right panel % display info in right panel
......
...@@ -37,8 +37,8 @@ global GOSUD_FORMAT_VERSION ...@@ -37,8 +37,8 @@ global GOSUD_FORMAT_VERSION
% version number, may be used to initialize some files when it change % version number, may be used to initialize some files when it change
% 0.90x -> 1.0RCx % 0.90x -> 1.0RCx
% ------------------------------------------------------------------- % -------------------------------------------------------------------
VERSION = 1.3; % -> 1.3 VERSION = 1.301; % -> 1.3
CHAR_VERSION = '1.3'; CHAR_VERSION = '1.301';
% netcdf file version, see DATA FORMAT TSG document: % netcdf file version, see DATA FORMAT TSG document:
% CORTSG_format_gosud.doc % CORTSG_format_gosud.doc
......
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