%% plasivw3.m is viewing program designed to load in selected results 
%% from plasimod.m and plot them using pcolor. Four plots per
%% figure are plotted using subplot.
%% plasivw3.m is different from plasivw2.m in that it plots both tube
%% content plots and equatorial densitiy

clear all
close all

dno=input('Day number? ');
year=input('Year? ');
vo=menu('View what?','Morning Results','Afternoon Results');
iricf=menu('IRI coefficents used','CCIR (denoted by c)','URSI (denoted by u)');

%Load in current days data set
yrs=int2str(year);
dns=int2str(dno);
if dno<10
 dns=['00',dns];
elseif dno>=10 & dno<100
 dns=['0',dns];
end
if iricf==1
 eval(['load d',yrs,'d',dns,'c'])
else 
 eval(['load d',yrs,'d',dns,'u'])
end

timv=0:tint:(24-tint);
nop=24/tint;
nof=ceil(nop/4);

sv=ones(size(timv));
kp=solarval(timv,dno*sv,year*sv);

htmin=min(min(hytot));
htmax=max(max(hytot));

htmin=min(min(hytot));
htmax=max(max(hytot));
hemin=1e6;
hemax=max(max(hyeq));

if vo==1
 timi=0;
else
 timi=nop/2-1;
end

for i=1:nof
 figure(i)
 for j=1:2:3
  timi=timi+1;
  
  hyed=hyeq(:,timi);
  hydt=hytot(:,timi);

  hc=hyed==-1;
  if any(hc)
   hyed(hc)=hydt(hc)./fltpr(LSHV(hc));
  end

  hyed(1)=hemin;
  hyed(2)=hemax; 

  hydt(1)=htmin;
  hydt(2)=htmax; 
  
  subplot(2,2,j)
  pcolor(mlt,lsh,reshape(log10(hydt),length(lsh),length(mlt)))
  title(['Tube Content UT=',num2str(timv(timi)),' kp=',num2str(kp(timi))])
  xlabel('MLT')
  ylabel('L-shell')
  
  subplot(2,2,j+1)
  pcolor(mlt,lsh,reshape(log10(hyed),length(lsh),length(mlt)))
  title(['H+ Density UT=',num2str(timv(timi)),' kp=',num2str(kp(timi))])
  xlabel('MLT')
  ylabel('L-shell')

 end
end 
