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

propose le nom du fichier d'origine avec l'extension .nc lors de la sauvegarde

parent 61ef25d6
No related branches found
No related tags found
No related merge requests found
...@@ -38,9 +38,13 @@ end ...@@ -38,9 +38,13 @@ end
% -------------------------------------------- % --------------------------------------------
fprintf('...reading %s : ', filename); fprintf('...reading %s : ', filename);
% populate tsg.file structure
% ---------------------------
tsg.file.name = filename;
tsg.file.type = 'NETCDF';
% Read global attributes: meta data % Read global attributes: meta data
% ---------------------------------- % ----------------------------------
tsg.PLATFORM_NAME = nc.PLATFORM_NAME(:); tsg.PLATFORM_NAME = nc.PLATFORM_NAME(:);
tsg.SHIP_CALL_SIGN = nc.SHIP_CALL_SIGN(:); tsg.SHIP_CALL_SIGN = nc.SHIP_CALL_SIGN(:);
tsg.SHIP_MMSI = nc.SHIP_MMSI(:); tsg.SHIP_MMSI = nc.SHIP_MMSI(:);
......
...@@ -55,12 +55,6 @@ tsg.DAYD = datenum(tsgData(:,3), tsgData(:,2),tsgData(:,1), ... ...@@ -55,12 +55,6 @@ tsg.DAYD = datenum(tsgData(:,3), tsgData(:,2),tsgData(:,1), ...
% save original date % save original date
% ------------------ % ------------------
tsg.DATE = datestr( tsg.DAYD, 'yyyymmddHHMMSS' ); 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.LATX = tsgData(:,7);
tsg.LONX = tsgData(:,8); tsg.LONX = tsgData(:,8);
tsg.SSJT = tsgData(:,9); tsg.SSJT = tsgData(:,9);
...@@ -83,6 +77,10 @@ if isempty(tsg.SPDC) ...@@ -83,6 +77,10 @@ if isempty(tsg.SPDC)
tsg.SPDC = [tsg.SPDC';0]; tsg.SPDC = [tsg.SPDC';0];
end end
% populate tsg.file structure
% ---------------------------
tsg.file.name = filename;
tsg.file.type = 'ASCII';
% Save the data in the application GUI % Save the data in the application GUI
% ------------------------------------ % ------------------------------------
......
...@@ -39,7 +39,12 @@ if fid ~= -1 ...@@ -39,7 +39,12 @@ if fid ~= -1
% tsg.PSAL_QC = tsgData(:,11); % tsg.PSAL_QC = tsgData(:,11);
% tsg.PSAL_ADJ = tsgData(:,12); % tsg.PSAL_ADJ = tsgData(:,12);
% tsg.PSAL_ERR = tsgData(:,13); % tsg.PSAL_ERR = tsgData(:,13);
%
% % populate tsg.file structure
% % ---------------------------
% tsg.file.name = filename;
% tsg.file.type = 'XML';
%
% % Save the data in the application GUI % % Save the data in the application GUI
% % ------------------------------------ % % ------------------------------------
% setappdata( hTsgGUI, 'tsg_data', tsg ); % setappdata( hTsgGUI, 'tsg_data', tsg );
......
...@@ -443,34 +443,34 @@ tsg_initialisation(hMainFig, hQcCmenu) ...@@ -443,34 +443,34 @@ tsg_initialisation(hMainFig, hQcCmenu)
% ------------------------------------------------ % ------------------------------------------------
set( hMainFig, 'Pointer', 'watch' ); set( hMainFig, 'Pointer', 'watch' );
% Make the filename % Make the fileName
% ATTENTION : function OpenMenuCallback(hObject, eventdata) % ATTENTION : function OpenMenuCallback(hObject, eventdata)
% This has to be made general for UNIX and WINDOWS system % 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'); {'*.txt';'*.xml';'*.nc';'*.btl'}, 'Pick a file');
error1 = -1; error1 = -1;
error2 = -1; error2 = -1;
if ~isequal(filename, 0) if ~isequal(fileName, 0)
% Read the data % Read the data
% ------------- % -------------
switch filterIndex switch filterIndex
case 1 case 1
error1 = readTsgDataTxt( hMainFig, filename ); error1 = readTsgDataTxt( hMainFig, fileName );
case 2 case 2
error1 = readTsgDataXML( hMainFig, filename ); error1 = readTsgDataXML( hMainFig, fileName );
case 3 case 3
error1 = readTsgDataNetCDF( hMainFig, filename ); error1 = readTsgDataNetCDF( hMainFig, fileName );
%# a modifier %# a modifier
if error1 == 1 if error1 == 1
error2 = error1; error2 = error1;
end end
case 4 case 4
error2 = readBucketData(hMainFig, filename ); error2 = readBucketData(hMainFig, fileName );
otherwise otherwise
return; return;
...@@ -488,7 +488,7 @@ tsg_initialisation(hMainFig, hQcCmenu) ...@@ -488,7 +488,7 @@ tsg_initialisation(hMainFig, hQcCmenu)
% update the display % update the display
% ------------------ % ------------------
set( hInfoFileText, 'String', filename); set( hInfoFileText, 'String', fileName);
% The callback to detect the mouse motion can be set to on % The callback to detect the mouse motion can be set to on
% -------------------------------------------------------- % --------------------------------------------------------
...@@ -791,8 +791,8 @@ tsg_initialisation(hMainFig, hQcCmenu) ...@@ -791,8 +791,8 @@ tsg_initialisation(hMainFig, hQcCmenu)
% ----------------------------------------------------------- % -----------------------------------------------------------
[x, y] = gpos(hPlotAxes(1)); [x, y] = gpos(hPlotAxes(1));
% Dynamically diplay data in uicontrol % Dynamically display data in uicontrol
% ------------------------------------ % -------------------------------------
if x > tsg.DAYD(1) && x < tsg.DAYD(end) if x > tsg.DAYD(1) && x < tsg.DAYD(end)
indCursor = find( tsg.DAYD > x); indCursor = find( tsg.DAYD > x);
set( hInfoDateText, 'String',... set( hInfoDateText, 'String',...
...@@ -1060,6 +1060,14 @@ tsg_initialisation(hMainFig, hQcCmenu) ...@@ -1060,6 +1060,14 @@ tsg_initialisation(hMainFig, hQcCmenu)
% ------------------------------------------------------------------- % -------------------------------------------------------------------
function SaveMenuCallback(hObject, eventdata) function SaveMenuCallback(hObject, eventdata)
% Callback function run when the Save menu item is selected % 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 % fill or append header form
% ------------------------- % -------------------------
...@@ -1069,7 +1077,7 @@ tsg_initialisation(hMainFig, hQcCmenu) ...@@ -1069,7 +1077,7 @@ tsg_initialisation(hMainFig, hQcCmenu)
% ------------------------------------------------ % ------------------------------------------------
if error ~= -1 if error ~= -1
[fileName, pathName, filterIndex] = uiputfile('*.nc', ... [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 % if user press cancel button, all var set to zero
% ------------------------------------------------ % ------------------------------------------------
...@@ -1087,8 +1095,7 @@ tsg_initialisation(hMainFig, hQcCmenu) ...@@ -1087,8 +1095,7 @@ tsg_initialisation(hMainFig, hQcCmenu)
% write netcdf file % write netcdf file
% ----------------- % -----------------
fileName = [pathName fileName]; error = writeTSGDataNetCDF( hMainFig, [pathName fileName] );
error = writeTSGDataNetCDF( hMainFig, fileName );
% Pointer reset to arrow % Pointer reset to arrow
% ---------------------- % ----------------------
...@@ -1098,8 +1105,12 @@ tsg_initialisation(hMainFig, hQcCmenu) ...@@ -1098,8 +1105,12 @@ tsg_initialisation(hMainFig, hQcCmenu)
% must to be rewriting % must to be rewriting
% -------------------------------- % --------------------------------
if error == -1 if error == -1
warning(['NetCDF writing error:' fileName]); warning(['NetCDF writing error:' [pathName fileName]]);
end end
% update the display
% ------------------
set( hInfoFileText, 'String', fileName);
end end
end 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