function weath_plot(theYears, dataDirectory, plotDirectory)
%
%   weath_plot(theYears, dataDirectory, plotDirectory)
%
%   Function to plot the weather measurements from NOAA Buoy 44013 for the
%   MBLT Report (for theYears).  Output as wplot_YYYY.

%Soupy Alexander, 10/29/03

fileNames = {'lt_t_air.nc'; 'lt_barop.nc'; 'lt_wind.nc'; 'lt_wave.nc'};
hitVars = {'AT_21'; 'BP_915'; 'WS_400'; 'wh_4061'};
plotTitles = {'Air Temperature'; 'Barometric Pressure'; 'Wind Speed'; ...
        'Significant Wave Height'};
yLabel = {'^oC'; 'mb'; 'm/s'; 'm'};
yLimits = {[-20 40]; [960 1060]; [0 30]; [0 10]};
yTicks = {[-20:10:40]; [960:40:1060]; [0:10:30]; [0:2:10]};


for indexYear = 1:length(theYears)
    targetYear = theYears(indexYear);
    figure, orient landscape
    
    xTick = [];
    for indexMonth = 1:12
        xTick = [xTick(:); datenum(targetYear, indexMonth, 1)];
    end
    
    for indexVar = 1:length(hitVars)
        theFile = netcdf(fullfile(dataDirectory, fileNames{indexVar}), 'nowrite');
        theTime = singlejd(theFile{'time'}(:), theFile{'time2'}(:));
        theData = theFile{hitVars{indexVar}}(:);
        
        gregTime = gregorian(theTime);
        inYear = find(gregTime(:,1) == targetYear);
        
        [plotX, plotY] = nanfill_2(theTime, theData);
        
        subplot(4,1,indexVar)
        plot(julian2datenum(plotX), plotY)
        ylim(yLimits{indexVar})
        set(gca, 'xtick', xTick, 'ytick', yTicks{indexVar})
        xlim([datenum(targetYear, 1, 1, 00, 00, 00) ...
                datenum(targetYear, 12, 31, 23, 59, 59)])
        datetick('x', 3, 'keeplimits', 'keepticks')
        ylabel(yLabel{indexVar})
        title(plotTitles{indexVar})
        l = line([datenum(targetYear, 1, 1, 00, 00, 00) ...
                datenum(targetYear, 12, 31, 23, 59, 59)], [0 0]);
        set(l, 'color', 'k')
        box('on')
    end
    
        suptitle({'Meteorological Observations from NOAA Buoy 44013'; ...
        num2str(targetYear, '%.0f')})
    
    print(fullfile(plotDirectory, ['wplot_' num2str(targetYear, '%.0f')]), ...
        '-dpdf')

    close
end