diff --git a/tsg_io/readTsgDataNetCDF.m b/tsg_io/readTsgDataNetCDF.m index 475fbdc6f8dd2798da32a8df40f1c34e1e16cc37..48f56c8e124a853850fd6b6c8668bd20ce3c0285 100644 --- a/tsg_io/readTsgDataNetCDF.m +++ b/tsg_io/readTsgDataNetCDF.m @@ -38,9 +38,13 @@ end % -------------------------------------------- fprintf('...reading %s : ', filename); +% populate tsg.file structure +% --------------------------- +tsg.file.name = filename; +tsg.file.type = 'NETCDF'; + % Read global attributes: meta data % ---------------------------------- - tsg.PLATFORM_NAME = nc.PLATFORM_NAME(:); tsg.SHIP_CALL_SIGN = nc.SHIP_CALL_SIGN(:); tsg.SHIP_MMSI = nc.SHIP_MMSI(:); diff --git a/tsg_io/readTsgDataTxt.m b/tsg_io/readTsgDataTxt.m index f57c38c7745021f9c4465879db4943bd7afa380b..c90503a52599304f1c25b1d82b5f4ce4dc55aa11 100644 --- a/tsg_io/readTsgDataTxt.m +++ b/tsg_io/readTsgDataTxt.m @@ -55,12 +55,6 @@ tsg.DAYD = datenum(tsgData(:,3), tsgData(:,2),tsgData(:,1), ... % save original date % ------------------ tsg.DATE = datestr( tsg.DAYD, 'yyyymmddHHMMSS' ); - -% convert with julian day with origin 1950 -% ----------------------------------------- -%% a supprimer !!!!!!! -% tsg.TIME_TSG = datenumToJulian(tsg.TIME_TSG); - tsg.LATX = tsgData(:,7); tsg.LONX = tsgData(:,8); tsg.SSJT = tsgData(:,9); @@ -83,6 +77,10 @@ if isempty(tsg.SPDC) tsg.SPDC = [tsg.SPDC';0]; end +% populate tsg.file structure +% --------------------------- +tsg.file.name = filename; +tsg.file.type = 'ASCII'; % Save the data in the application GUI % ------------------------------------ diff --git a/tsg_io/readTsgDataXML.m b/tsg_io/readTsgDataXML.m index 8f2b79df2bc8761d86a50480a9d412d97fb8c685..1fa406a6a57aa66e1afb6705169351fe3538f253 100644 --- a/tsg_io/readTsgDataXML.m +++ b/tsg_io/readTsgDataXML.m @@ -39,7 +39,12 @@ if fid ~= -1 % tsg.PSAL_QC = tsgData(:,11); % tsg.PSAL_ADJ = tsgData(:,12); % tsg.PSAL_ERR = tsgData(:,13); -% + +% % populate tsg.file structure +% % --------------------------- +% tsg.file.name = filename; +% tsg.file.type = 'XML'; +% % % Save the data in the application GUI % % ------------------------------------ % setappdata( hTsgGUI, 'tsg_data', tsg ); diff --git a/tsgqc_GUI.m b/tsgqc_GUI.m index dcd11d358dd56cfeeb906245f0703275483e53ea..351dacf71f9b2b081287d4530ee2cff54b9502ef 100644 --- a/tsgqc_GUI.m +++ b/tsgqc_GUI.m @@ -443,34 +443,34 @@ tsg_initialisation(hMainFig, hQcCmenu) % ------------------------------------------------ set( hMainFig, 'Pointer', 'watch' ); - % Make the filename + % Make the fileName % ATTENTION : function OpenMenuCallback(hObject, eventdata) % This has to be made general for UNIX and WINDOWS system % --------------------------------------------------------- - [filename, pathname, filterIndex] = uigetfile( ... + [fileName, pathname, filterIndex] = uigetfile( ... {'*.txt';'*.xml';'*.nc';'*.btl'}, 'Pick a file'); error1 = -1; error2 = -1; - if ~isequal(filename, 0) + if ~isequal(fileName, 0) % Read the data % ------------- switch filterIndex case 1 - error1 = readTsgDataTxt( hMainFig, filename ); + error1 = readTsgDataTxt( hMainFig, fileName ); case 2 - error1 = readTsgDataXML( hMainFig, filename ); + error1 = readTsgDataXML( hMainFig, fileName ); case 3 - error1 = readTsgDataNetCDF( hMainFig, filename ); + error1 = readTsgDataNetCDF( hMainFig, fileName ); %# a modifier if error1 == 1 error2 = error1; end case 4 - error2 = readBucketData(hMainFig, filename ); + error2 = readBucketData(hMainFig, fileName ); otherwise return; @@ -488,7 +488,7 @@ tsg_initialisation(hMainFig, hQcCmenu) % update the display % ------------------ - set( hInfoFileText, 'String', filename); + set( hInfoFileText, 'String', fileName); % The callback to detect the mouse motion can be set to on % -------------------------------------------------------- @@ -791,8 +791,8 @@ tsg_initialisation(hMainFig, hQcCmenu) % ----------------------------------------------------------- [x, y] = gpos(hPlotAxes(1)); - % Dynamically diplay data in uicontrol - % ------------------------------------ + % Dynamically display data in uicontrol + % ------------------------------------- if x > tsg.DAYD(1) && x < tsg.DAYD(end) indCursor = find( tsg.DAYD > x); set( hInfoDateText, 'String',... @@ -1060,6 +1060,14 @@ tsg_initialisation(hMainFig, hQcCmenu) % ------------------------------------------------------------------- function SaveMenuCallback(hObject, eventdata) % Callback function run when the Save menu item is selected + + % Retrieve named application data + % ------------------------------- + tsg = getappdata( hMainFig, 'tsg_data'); + + % get fileName without extension in cell + % -------------------------------------- + file = textscan( tsg.file.name,'%s','delimiter','.'); % fill or append header form % ------------------------- @@ -1069,7 +1077,7 @@ tsg_initialisation(hMainFig, hQcCmenu) % ------------------------------------------------ if error ~= -1 [fileName, pathName, filterIndex] = uiputfile('*.nc', ... - 'Save file name'); + 'Save file name', [file{1}{1} '.nc']); % if user press cancel button, all var set to zero % ------------------------------------------------ @@ -1087,8 +1095,7 @@ tsg_initialisation(hMainFig, hQcCmenu) % write netcdf file % ----------------- - fileName = [pathName fileName]; - error = writeTSGDataNetCDF( hMainFig, fileName ); + error = writeTSGDataNetCDF( hMainFig, [pathName fileName] ); % Pointer reset to arrow % ---------------------- @@ -1098,8 +1105,12 @@ tsg_initialisation(hMainFig, hQcCmenu) % must to be rewriting % -------------------------------- if error == -1 - warning(['NetCDF writing error:' fileName]); + warning(['NetCDF writing error:' [pathName fileName]]); end + + % update the display + % ------------------ + set( hInfoFileText, 'String', fileName); end end