function output = edf_read(infile)
% edf_read:     takes the name of an XBT EDF (export data file), loads that
%               file, despikes it and regrids it to 5-m intervals, plots the
%               file, saves the processed file with a ".dat" extension, and
%               returns the processed data.  Whew!
%
% Daniel Torres, Jason Goodman, WHOI, 12/96

unix(['awk ''/^	/ {print}'' ',infile,' > edf_beheaded.tmp']);
load edf_beheaded.tmp;
max_depth = max(edf_beheaded(:,1));
output = despike(edf_beheaded,max_depth);
plot(output(:,2),output(:,1));
axis('ij');
xlabel('Temperature (C)');
ylabel('Pressure (dbar)');
title(['Station ',infile(6:8)]);
grid on
delete 'edf_beheaded.tmp';
outfile = [infile(1:9),'dat'];
save(outfile,'output','-ascii');
