%% plasivw2.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.
%% plasivw2.m is different from plasivw.m in that it specifically
%% plots hourly results for the given day only.

clear all
close all

dno=input('Day number? ');
year=input('Year? ');
vo=menu('View what?','equatorial H+ densities','H+ tube content');

%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
eval(['load d',yrs,'d',dns])

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));
hemin=1e6;
hemax=max(max(hyeq));


timi=0;
for i=1:nof
 figure(i)
 for j=1:4
  timi=timi+1;
  if vo==1
   hyed=hyeq(:,timi);
   hyt=hytot(:,timi);
   hc=hyed==-1;
   if any(hc)
    hyed(hc)=hyt(hc)./fltpr(LSHV(hc));
   end
   hyed(1)=hemin;
   hyed(2)=hemax;
   subplot(2,2,j)
   pcolor(mlt,lsh,reshape(log10(hyed),length(lsh),length(mlt)))
  else
   hyt=hytot(:,timi);
   hyt(1)=htmin;
   hyt(2)=htmax;
   subplot(2,2,j)
   pcolor(mlt,lsh,reshape(log10(hyt),length(lsh),length(mlt)))
  end 
  title(['UT=',num2str(timv(timi)),' kp=',num2str(kp(timi))])
  xlabel('MLT')
  ylabel('L-shell')
 end
end 
