function ep2ctdprc % EP2CTDPRC - Opens the files \oasis\eqpac\ep2\temp.0m, calculates salinity and % writes it to a new file \oasis\eqpac\ep2\ctd.0m.brian % % Requires: READEQPAC % Brian Schlining % 28 Jan 1999 % Set the path to the data file depending on what type of machine this function is run from switch computer case 'PCWIN' % Assumes the pwd is /oasis/epqac/brian/ PathS = ['//tsunami.shore.mbari.org/oasis/eqpac/ep2/']; PathB = ['//tsunami.shore.mbari.org/oasis/eqpac/brian/']; %PathS = ['..\ep2\']; %PathB = ['..\brian\']; otherwise % Assigns an absolute path in UNIX PathS = ['/hosts/tsunami/oasis/eqpac/ep2/']; PathB = ['/oasis/eqpac/Brian/']; end FileLoc = [PathS 'temp.0m']; X = readeqpac(FileLoc); S = salin_(X(:,3)/4.2914,X(:,2),0); fidR = fopen(FileLoc,'rt'); fidW = fopen([PathS 'ctd.0m.brian'],'wt'); s = fgetl(fidR); while strcmp(s(1),'#') fprintf(fidW,'%s\n',s); s = fgetl(fidR); end fprintf(fidW,'# The fourth column is salinity - added by Brian Schlining\n#\n'); n = 0; while ~feof(fidR) s = fgetl(fidR); n = n + 1; fprintf(fidW,'%s %7.4f\n',s,S(n)); end fclose(fidR); fclose(fidW);