%-----------------------------------------------------------------------
% $Id: plotIono.m,v 1.3 2005/04/18 19:46:46 vnadkar Exp $
% Copyright Trimble 2001
%
% Takes the double difference ionosphere created by PiLineMex and
% produces a plot of all the double-difference ionospheric residuals on
% the same plot.
% 
% Stuart Riley
% 12/12/01
%-----------------------------------------------------------------------

function plotIono(ionoDDiff,PlotPNG,timeStr);

% Definitions
TRUE = 1 ;
 
% Get a colour map
colour_LUT = setColourCodes;


% Convert to mm
% As per Timo's E-mail Piline provides the ionospheric double difference
% in the same units as range (ie 1/10's of mm's).
ionoDDiff(:,2:33) = ionoDDiff(:,2:33) / 10;
  
%
% Remove outliers out side of +/- 50 cm
% 
j = find( abs(ionoDDiff(:,2:33)) > 500 );
ionoDiff(j + length(ionoDDiff) ) = ones(size(j)).*NaN;
  
figure('Visible','off');
hold on
colour = 0;
  
for SV=2:33
  i = sum(isfinite(ionoDDiff(:,SV)));
  if(i > 0)
    colour = colour + 1;
    plot(ionoDDiff(:,1), ionoDDiff(:,SV),'color',colour_LUT(colour,:));
    SVArray(colour) = SV-1;
  end
end
  
xlabel(['Time [GPS Sec]   ',timeStr],'Interpreter','none');
ylabel('Double Difference Ionosphere [mm]');
grid;
title('Ionospheric Double Difference');

% Create the legend string
for i=1:colour
  StringMatrix(i) = {['PRN ',int2str(SVArray(i))]};
end

legend(StringMatrix,0);
  
labelAxes([],[],[],[],1);
if(PlotPNG == TRUE)
  print('-dpng',['DDIono.png']);
  disp('Double Difference Iono Plot created ...');
end


