diff --git a/tsg_io/readTsgDataNetCDF.m b/tsg_io/readTsgDataNetCDF.m index 5da4b816d3dcab91ae316a21da3dc2b11d0348a8..53c92ef6fdf0d7695deca7301bcdaadf9bd514b4 100644 --- a/tsg_io/readTsgDataNetCDF.m +++ b/tsg_io/readTsgDataNetCDF.m @@ -1,11 +1,11 @@ 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 diff --git a/tsg_io/writeTSGDataNetCDF.m b/tsg_io/writeTSGDataNetCDF.m index 9430bc04e09c3f2aeee5600123cc0be34c666abc..2b862d4de1253272d6c352cbe36425933f2dac43 100644 --- a/tsg_io/writeTSGDataNetCDF.m +++ b/tsg_io/writeTSGDataNetCDF.m @@ -1,6 +1,6 @@ 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