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

ajout de commentaires et nettoyage de code

parent 8f54a485
No related branches found
No related tags found
No related merge requests found
function [error] = readTsgDataNetCDF( hMainFig, filename)
% Function to read the TSG data. Should be a NetCDF file
% GOSUD data format TSG V1.4
% GOSUD data format TSG V1.6
%
% Input
% -----
% hMainFig ............ Handel to the main user interface
% filename ........... Data filename
% hMainFig ............ Handle to the main user interface
% filename ............ Data filename
%
% Output
% ------
......@@ -13,6 +13,9 @@ function [error] = readTsgDataNetCDF( hMainFig, filename)
%
% The data are store using setappdata - Variable name : 'tsg_data'
%
% DAYD, DAYD_WS and DAYD_EXT in tsg structure use Matlab datenum, they
% should be converted from julian days using 1950 reference in NetCDF file
%
% $Id$
%% Check Netcdf library version
......@@ -173,8 +176,9 @@ automaticQC( hMainFig )
var = char(key);
tsg.(var) = nc.VARIABLES.(var).data__;
% transforme julian days variables to Matlab datenum
% --------------------------------------------------
% when variable is julian days from 1950 reference, transform to
% Matlab datenum
% --------------------------------------------------------------
if strmatch('DAYD', var)
tsg.(var) = julianToDatenum(tsg.(var));
end
......
function [error] = writeTSGDataNetCDF( hTsgGUI, filename)
% [error] = writeTSGDataNetCDF( hTsgGUI, filename)
% Function to write TSG data in NetCDF file.
% Function to write TSG data in NetCDF file to GOSUD format 1.6.
%
% Input
% -----
......@@ -14,9 +14,8 @@ function [error] = writeTSGDataNetCDF( hTsgGUI, filename)
%
% The data are store using setappdata - Variable name : 'tsg_data'
%
% Actually, with DAYD, DAYD_WS and DAT_EXT dimensions defined: 61 variables
% DAYD, DAYD_WS dimensions defined: 57 variables
% DAYD only dimension defined: 53 variables
% DAYD, DAYD_WS and DAYD_EXT in tsg structure use Matlab datenum, they
% should be converted to julian days using 1950 reference in NetCDF file
%
% $Id$
......@@ -323,7 +322,7 @@ end
end
end
end % end of loop over variables keys
% Close waitbar
% -------------
......@@ -360,24 +359,17 @@ end
% -----------------------------------------------------------------
for key = keys(nc.VARIABLES)
var = char(key);
% Convert Matlab julian days (datenum) to 1950 reference
% ------------------------------------------------------
if strmatch('DAYD', var)
nc.VARIABLES.(var).data__ = datenumToJulian(tsg.(var));
else
nc.VARIABLES.(var).data__ = tsg.(var);
end
end
% % Convert Matlab julian days (datenum) to 1950 reference
% % ------------------------------------------------------
% ncv_keys = keys(nc.VARIABLES);
% d = strmatch('DAYD', ncv_keys);
% for i=1:numel(d)
% tsg.(ncv_keys{d(i)}) = datenumToJulian(tsg.(ncv_keys{d(i)}));
% end
% loop over all global attributes and get associated value in tsg
% loop over all global attributes and get associated value in tsg
% structure
% -----------------------------------------------------------------
for key = keys(nc.ATTRIBUTES)
......@@ -385,8 +377,6 @@ end
nc.ATTRIBUTES.(att).data__ = tsg.(att);
end
% try
% write netcdf file with and display waibar (boolean)
% ---------------------------------------------------
write( nc, filename, 'NC_CLOBBER', true );
......@@ -394,9 +384,6 @@ end
% Everything OK
% -------------
error = 1;
% catch
% error = -1;
% 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