function out = stordat_combine(lat, lon, FLAG) % STORDAT_COMBINE - Concatenates HF stordat files from a location into a single file % % Use as: x = stordat_combine(lat, lon, type) % % Inputs: lat = latitude of mooring (-S +N) % lon = longitude of mooring (-W +E) % type = Flag to indicate what kind of data should be returned % 0(default): return raw data % 1: return 15min average % 2: return hourly average % 3: return daily average % % Output: x = data array from the mooring % % Requires: STRFIND filePath = '\\tsunami.shore.mbari.org\oasis\eqpac\stordat\'; if nargin < 3 FLAG = 0; end switch FLAG case 0 ext = '.out'; case 1 ext = '.15min'; case 2 ext = '.hourly'; case 3 ext = '.daily'; end f = getfname([filePath 'stor*' ext]); lats = parselat(f); lons = parselon(f); good = find(lat == lats & lon == lons); if ~isempty(good) for i = 1:length(good) fileList(i,:) = [filePath f(good(i),:)]; end out = combine_(fileList); else s = sprintf('No *%s files were found for the location specified.\n',ext); warning(s); out = []; end function lat = parselat(f) lat = str2num(f(:,9:10)); ns = f(:,11); i = strfind(ns,'s'); lat(i) = -lat(i); function lon = parselon(f) lon = str2num(f(:,12:14)); ew = f(:,15); i = strfind(ew,'w'); lon(i) = -lon(i);