Newer
Older
function [bucketASCII, error] = tsg_readBucket( filename)
% Function to read the Bucket data. Should be in 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 : 'bucket_data'
%
% Function to be rewritten when the NetCDF format will be in use
% Caution : replace the fill-value with NaN
%
% Open the file
% -------------
fid = fopen( filename, 'r' );
error = -1;
if fid ~= -1
% Read the file - skip 2 lines
% ----------------------------
fgetl( fid ); fgetl( fid );
bucketData = fscanf(fid,'%d %d %d %d %d %d %f %f %f', [9 Inf])';
% Every variable are put in a structure
% -------------------------------------
bucketASCII.TIME = datenum(bucketData(:,1), bucketData(:,2), ...
bucketData(:,3), bucketData(:,4), ...
bucketData(:,5), bucketData(:,6));
bucketASCII.LATITUDE = bucketData(:,7);
bucketASCII.LONGITUDE = bucketData(:,8);
bucketASCII.PSAL = bucketData(:,9);
bucketASCII.PSAL_QC = zeros(size(bucketASCII.PSAL));