Home > robbins > whp_ctd.m

whp_ctd

PURPOSE ^

WHP_CTD Reads in standard WOCE ctd ascii file specified by flname

SYNOPSIS ^

function [p,t,s,o2] = whp_ctd(flname);

DESCRIPTION ^

 WHP_CTD Reads in standard WOCE ctd ascii file specified by flname
         Checks the header record and if the temperature is in ITS-90, 
         if is converted to IPTS-68 before being returned

 Usage: [p,t,s,o2] = whp_ctd(flname); 

 Output : (column vectors)
  p : pressure 
  t : (in situ) temperature
  s : salinity 
  ox: oxygen
  

 Paul E. Robbins copyright 1995

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [p,t,s,o2] = whp_ctd(flname);
0002 
0003 % WHP_CTD Reads in standard WOCE ctd ascii file specified by flname
0004 %         Checks the header record and if the temperature is in ITS-90,
0005 %         if is converted to IPTS-68 before being returned
0006 %
0007 % Usage: [p,t,s,o2] = whp_ctd(flname);
0008 %
0009 % Output : (column vectors)
0010 %  p : pressure
0011 %  t : (in situ) temperature
0012 %  s : salinity
0013 %  ox: oxygen
0014 %
0015 %
0016 % Paul E. Robbins copyright 1995
0017 fid = fopen(flname,'r');
0018 
0019 if fid == -1
0020    %try to find file in matlab_data directory
0021   fid = fopen([getenv('MATLAB_DATA'),flname],'r');
0022   if fid == -1
0023     fid = fopen([getenv('MATLAB_DATA'),'ctd/woce/',flname],'r');
0024     if fid == -1;
0025      disp(['File ',flname,' not found'])
0026      break
0027     end
0028   end    
0029 end
0030 
0031 % read in 6 lines of header data
0032 for l = 1:2
0033   line = fgetl(fid);  disp(line);
0034 end
0035 
0036 for l = 3:5
0037   line = fgetl(fid);  
0038 end
0039 if any(findstr(line,'ITS-90'))
0040   dotemp = 1;
0041   disp(['  Converting temperature from ITS-90 to IPTS-68'])
0042 else
0043   dotemp = 0;
0044 end
0045 
0046 line = fgetl(fid); 
0047 % read in data block
0048 dat = fscanf(fid,'%f',[6 inf]);
0049 
0050 p = dat(1,:);
0051 t = dat(2,:);
0052 s = dat(3,:);
0053 o2 = dat(4,:);
0054 fclose(fid);
0055 
0056 if dotemp
0057   t = 1.00024*t;
0058 end
0059 
0060 p = p(:); t = t(:); s = s(:); o2 = o2(:);

Generated on Wed 30-Nov-2005 15:40:09 by m2html © 2003