function muse_microcat(inDir, outFile) % MUSE_MICROCAT - concatenate microcat data files into a single file % % Use as: muse_microcat(inDir, outFile) % % Inputs: inDir = name of the directory containing only daily oasis % microcat files created using extract % outFile = name of file to create. This file will contain % the following columns: 1) time: epic seconds, % 2) temperature, and 3) salinity % % Brian Schlining % 08 Aug 2000 % Check input arguments if nargin < 2 fprintf(1, 'Error: Incorrect usage\n\n') help muse_microcat return end if ~isdir(inDir) error([inDir ' is not a directory']); end %======================== % Set defualt parameters %======================== R = 4.2914; % Conductivity ratio denominator depth = 1.5; % Depth of microcat in dbar % Get a list of all files in the input directory fileList = getfname(inDir); numFiles = size(fileList, 1); % open the outFile for writing the data to fid = fopen(outFile, 'wt'); if fid < 0 error(['Unable to write to ' outFile]) end % Add a header hdr = {'#',... '# Microcat data header', ... '# For Microcat CT (no D) sensors', ... '#',... '# Microcat data records in this file contain 3 values for 1 sensor', ... '# The overall format is:', ... '#', ... '# time temp sal cond', ... '#', ... '# time: GMT time. Format is epic seconds (since Jan 01 1070 00:00:00)', ... '# temp: Temperature in degrees Celsius', ... ['# sal: Salinity for C = cond, T = temp, D = ' num2str(depth) 'm'], ... '# cond: Conductivity in Siemens per meter', ... '#'}; for i = 1:length(hdr) fprintf(fid, '%s\n', hdr{i}); end % Process each data file for i = 1:numFiles try filename = deblank(fileList(i,:)); fprintf(1, 'Processing %s\n', filename); OK = 0; x = readoasismicrocat([inDir filesep filename]); s = salin_(x(:,3)./R, x(:,2), depth); t = sdn2utc(x(:,1)); OK = 1; catch warning(['Unable to process ' inDir filesep filename]); end if OK data = [t x(:,2) s x(:,3)]; fprintf(fid, '%10.0f\t%7.4f\t%8.5f\t%8.5f\n', data'); end end fclose(fid);