function plot_compact_2(filename,sat_type)

% PLOT_COMPACT_2                        *
%	Plots data from compact2 files. Requires read_compact2 to be in the
%   same directory.
%
%   Version: 1.0 07/11/2011
%   Contact: berglund@unavco.org
%
%	Usage: plot_compact_2('IRID1210.sn2','gps')                    
%	Input: filename - name of compact2 file e.g.('filename.azi')   
%          sat_type - controls which GNSS system is plotted        
%                    'gps' - Global Positioning System            
%                    'glo' - GLONASS                              
%                    'sbs' - SBAS - not supported by teqc yet     
%                    'gal' - Galieo - not supported by teqc yet   
 

if nargin < 2
    error('Function requires two arguments')
end

[data,dec_hr,mjd,t_sample] = read_compact_2(filename);

figure; box on; hold on
switch sat_type
    case 'gps'
        pcolor(data(1).gps(:,1:32)');
    case 'glo'
        pcolor(data(1).glo(:,1:32)');
    case 'gal'
        pcolor(data(1).gal(:,1:32)');
    case 'sbs'
        pcolor(data(1).sbs(:,1:32)');
end
set(gcf,'renderer','zbuffer');
shading flat
colormap(flipud(jet));
colorbar
set(gca,'ylim',[1 33])
set(gca,'ytick',1.5:1:32.5)
set(gca,'yticklabel',['G01';'G02';'G03';'G04';'G05';'G06';...
        'G07';'G08';'G09';'G10';'G11';'G12';...
        'G13';'G14';'G15';'G16';'G17';'G18';...
        'G19';'G20';'G21';'G22';'G23';'G24';...
        'G25';'G26';'G27';'G28';'G29';'G30';...
        'G31';'G32']);

[path,name,ext]=fileparts(filename);
switch ext
    case '.sn1'
        out='Signal to noise ratio S/N L1';
        maxy=60;
        miny=0;
        title('SN1')
    case '.sn2'
        out='Signal to noise ratio S/N L2';
        maxy=60;
        miny=0;
        title('SN2')
    case '.mp1'
        out='Multipath L1';
        maxy=1;
        miny=-1;
        title('MP1')
    case '.mp2'
        out='Multipath L2';
        maxy=1;
        miny=-1;
        title('MP2')
    case '.m51'
        out='Multipath L5';
        maxy=1;
        miny=-1;
        title('M51')
    case '.m15'
        out='Multipath L5';
        maxy=1;
        miny=-1;
        title('M15')
    case '.i15'
        out='Ion L5';
        maxy=5;
        miny=-5;
        title('I15')     
    case '.d15'
        out='Iod L5';
        maxy=5;
        miny=-5;
        title('D15')        
    case '.iod'
        out='Derivative of ionospheric delay observable (m/s)';
        maxy=1;
        miny=-1;
        title('IOD')
    case '.ion'
        maxy=5;
        miny=-5;
        out='Ionospheric delay observable (m)';
        title('ION')
    case '.ele'
        maxy=90;
        miny=0;
        out='Satellite elevation data';
        title('Elevation')
    case '.azi'
        maxy=180;
        miny=-180;
        out='Satellite azimuthal data';
        title('Azimuth')
    otherwise
        disp('Somethings wrong..!')
end
caxis([miny maxy]);
dec_hr=[0 dec_hr];
set(gca,'xtick',1:(60*60/t_sample{1}):length(dec_hr))
set(gca,'xticklabel',dec_hr(1:floor(60*60/t_sample{1}):end))