function mbiwe_pres
%
%   Function to create the plot of hourly-averaged bottom pressure from
%   Sites B and C of the MBIWE.

%Soupy Alexander, 1/14/04

%This Matlab m-file was used to create portions of U.S. Geological Survey 
%Data Series 85. Although this program has been used by the USGS, no 
%warranty, expressed or implied, is made by the USGS or the United States 
%Government as to the accuracy and functioning of the program and related 
%program material nor shall the fact of distribution constitute any such 
%warranty, and no responsibility is assumed by the USGS in connection 
%therewith.

%Citation:  Butman, Bradford, Alexander, P. Soupy, Anderson, S.P., 
%Lightsom, F.L., Scotti, Alberto, and Beardsley, R.C., 2004, The 
%Massachusetts Bay Internal Wave Experiment, August 1998:  Data Report:  
%U.S. Geological Survey Data Series 85, 1 DVD-ROM.

%Full Record
theTimeFrame = [datenum(1998, 07, 29, 00, 00, 00) datenum(1998, 09, 03, 00, 00, 00)];
theTicks = min(theTimeFrame):5:max(theTimeFrame);
theCode = 6;
theExt = '-a1h';

dataDir = 'C:\SCHTUFF\MASS_BAY\MBAY_IWAVE\REPORT\DATAFILES';
presFiles = {'5371tcp-a1h.nc'; '5351tcp-a1h.nc'};

figure, orient landscape

siteList = {'B'; 'C'};

for indexFile = 1:length(presFiles)
    ncID = netcdf(fullfile(dataDir, presFiles{indexFile}), 'nowrite');
    theTime = singlejd(ncID{'time'}(:), ncID{'time2'}(:));
    thePres = ncID{'P_4023'}(:);
    
    thePres(find(thePres > 1e4 | thePres < -1e4)) = NaN;
    
    thePres = thePres - nanmean(thePres);
    
    subplot(2,1,indexFile)
    plot(julian2datenum(theTime), thePres)
    
    ylim([-200 200])
    xlim(theTimeFrame)
    set(gca, 'xtick', theTicks)
    datetick('x', theCode, 'keepticks', 'keeplimits')
    box('on')
    ylabel('mbar')
    
    title(['Site ' siteList{indexFile}])
end

suptitle('Hourly Averaged Pressure Data')
    
    
