function [error] = tsg_readTsgDataNetCDF( hTsgGUI, filename) % Function to read the TSG data. Should be a NetCDF file % % Input % ----- % hTsgGUI ............ Handel to the main user interface % filename ........... Data filename % % Output % ------ % error .............. 1: OK - -1 : an error occured % % The data are store using setappdata - Variable name : 'tsg_data' % % Function not yet implemented % Caution : replace the fill-value with NaN % $Id$ % Open the file % ------------- fid = fopen( filename, 'r' ); error = -1; if fid ~= -1 disp('Read NetCDF file, not yet implemeted ...'); % % % Read the file % % ------------- % tsgData = fscanf(fid, '%d/%d/%d %d:%d:%d %f %f %f %f %d %f %f', ... % [13 Inf])'; % % % Every variable are put in a structure % % ------------------------------------- % tsg.TIME = datenum(tsgData(:,3), tsgData(:,2),tsgData(:,1), ... % tsgData(:,4),tsgData(:,5),tsgData(:,6)); % tsg.LATITUDE = tsgData(:,7); % tsg.LONGITUDE = tsgData(:,8); % tsg.TEMP_TSG = tsgData(:,9); % tsg.PSAL = tsgData(:,10); % tsg.PSAL_QC = tsgData(:,11); % tsg.PSAL_ADJ = tsgData(:,12); % tsg.PSAL_ERR = tsgData(:,13); % % % Bucket % % ------ % bucketNETCDF.LATITUDE_WS = tsgData(:,7); % bucketNETCDF.LONGITUDE_WS = tsgData(:,8); % bucketNETCDF.TEMP_TSG_WS = tsgData(:,9); % bucketNETCDF.PSAL_WS = tsgData(:,10); % bucketNETCDF.PSAL_QC_WS = tsgData(:,11); % bucketNETCDF.PSAL_ADJ_WS = tsgData(:,12); % bucketNETCDF.PSAL_ERR_WS = tsgData(:,13); % % % Save the data in the application GUI % % ------------------------------------ % setappdata( hTsgGUI, 'tsg_data', tsg ); % setappdata( hTsgGUI, 'bucketNETCDF', bucketNETCDF ); % % Clear the Workspace % ------------------- % clear tsgdata % Close the file % -------------- fclose( fid ); % Everything not OK % ------------- error = -1; end