function Aux = at_stordat_combine % Get a list of all 7* files % Loop through and get their locations and store them % Read the data from the files, get their locations % Concatentate the data from the 7* files with the *.out files by location. % only if these files begin after the end of the last data point in the HF files srcPath = '\\tsunami.shore.mbari.org\oasis\eqpac\satpac\'; tmpPath = '\\tsunami.shore.mbari.org\oasis\eqpac\brian\temp\'; outPath = '\\tsunami.shore.mbari.org\oasis\eqpac\stordat\'; f = getfname([srcPath '7*']); [r c] = size(f); %Aux = aaa; % Extract the locations of each satpac/7* file for i = 1:r %while 0 satlan1([srcPath deblank(f(i,:))], tmpPath); Aux(i).filename = deblank(f(i,:)); try A = satlan_loc([tmpPath 'sat_location.txt']); % Get the location and dates of messages Aux(i).startDate = nanmin(A.Date); Aux(i).endDate = nanmax(A.Date); Aux(i).lat = round(nanmedian(A.Lat)); Aux(i).lon = round(nanmedian(A.Lon)); if Aux(i).lon > 180 Aux(i).lon = -(360 - Aux(i).lon); elseif Aux(i).Lon == 180 Aux(i).Lon = -180 end catch Aux(i).startDate = NaN; Aux(i).endDate = NaN; Aux(i).lat = NaN; Aux(i).lon = NaN; end end % Get all the positions lats = [Aux.lat]; i = find(~isnan(lats)); lats = lats(i); lat = unique(lats); lons = [Aux.lon]; i = find(~isnan(lons)); lons = lons(i); lon = unique(lons); outFile = []; for la = lat for lo = lon good = find(lats == la & lons == lo); % Create an array of path names for the valid files for i = 1:length(good) if i == 1 outFile = [outPath Aux(good(i)).filename '.out']; else outFile = strvcat(outFile, [outPath Aux(good(i)).filename '.out']); end end fprintf(1,'%4i Lat:%02i Lon:%03i ',length(good), la, lo) try out = stordat_combine(la, lo, 1); catch out = []; end if ~isempty(out) & ~isempty(outFile) llist = strvcat(outFile,out.Filename); elseif isempty(out) & ~isempty(outFile) llist = outFile; else llist = out; end if ~isempty(llist) fprintf(1,'Reading:\n') [rl cl] = size(llist); for kk = 1:rl fprintf(1,'%s\n',llist(kk,:)); end end if la < 0 m = -1; latS = 's'; elseif la == 0 m = 1; latS = '_'; else m = 1; latS = 'n'; end if lo < 0 n = -1; lonS = 'w'; elseif lo == 0 m = 1; lonS = '_'; else n = 1; lonS = 'e'; end outName = deblank(sprintf('%sTimeSeries_%02i%s%03i%s.out',outPath,la*m,latS,lo*n,lonS)); %fprintf(1,'Writing:\n'); %fprintf(1,'%s\n',outName); if isempty(good) & isempty(out); disp('No files') % Do nothing elseif isempty(good) & ~isempty(out) % Only write out data from the *.ftp files disp('No good files') writeout(out,outName); elseif ~isempty(good) & isempty(out) %only write out data from the 7*.out files disp('Only good files') out = combine_(outFile); %aa = avgout(out,lon(lo)*n); writeout(out,outName); else %outFile = strvcat(outFile, out.Filename); disp('good and out files') out = combine_(outFile, out); %aa = avgout(out,lon(lo)*n); writeout(out,outName); end outFile = []; out = []; end end