function plotValues=plotband(channel,currentBand,currentTimeInfo,currentVar,plotValues,displayAxis,doflipud,dofliplr,currentColormap,rectVals)
% Gets data from an AIRS Level 1B infrared data file and plots based on the selected channel
% Input: channel to plot,selected band,radiance data, axis to display, 
% Kevin Baggett
% Tue Jul 16 16:38:36 UTC 2002

colormap(currentColormap);

axes(displayAxis);
cla;

[x,y]=size(plotValues);
if nargin > 9 % if rectangle specified
    plotValues=plotValues(floor(rectVals(2)):floor(rectVals(2))+round(rectVals(4)),floor(rectVals(1)):floor(rectVals(1))+round(rectVals(3)));
end
% flip resulting matrix according to the flip settings
if doflipud
    plotValues=flipud(plotValues);
end
if dofliplr
    plotValues=fliplr(plotValues);
end

imagesc(plotValues);

set(gca,'XTick',[],'YTick',[]);
if nargin > 9
    title(sprintf('Channel %10.4f, %s %s Data',channel,currentBand,currentVar));
else
    currentDate=getDateFromSecsSince1993(currentTimeInfo);
    title(sprintf('Channel %10.4f, %s %s Data, Scan Starting at %s',channel,currentBand,currentVar,currentDate));
end
cmin=min(min(plotValues));
cmax=max(max(plotValues));
%cmin and cmax will not be different if nighttime and visible
if cmin~=cmax
    set(gca,'CLim',[cmin,cmax]);
    c=colorbar;
    set(c,'Units','Pixels');
    label=get(c,'XLabel');
    switch currentVar
    case 'Radiance'
        set(label,'String','Radiance (W/m^2/ster/cm^{-1})');
    case 'Brightness Temperature'
        set(label,'String','Brightness Temperature (K)');
    end
end
