%% soldis.m displays the 3-hourly Kp, F10.7 and 81 day averaged
%% F10.7 flux.
%%

clear all
close all

year=input('Year to display? ');
dno1=input('Starting day number? ');
dno2=input('Finishing day number? ');

nop=dno2-dno1+1;
sv=ones(1,nop);
timmat=(0:3:21)'*sv;
dnov=(dno1:dno2);
dno=ones(8,1)*dnov;
timmat=timmat(:);
dno=dno(:);
year=year*ones(size(dno));
timv=1:length(timmat);

[kp,kpmin,apday,f107,f107p,f107a]=solarval(timmat,dno,year);

 xv=1:8:length(kp);

if length(dnov)>15
 xv(2:2:length(dnov))=[];
 dnov(2:2:length(dnov))=[];
end

figure(1)
subplot(2,1,1)
bar(kp)
set(gca,'xtick',xv)
set(gca,'xticklabel',dnov')
grid
set(gca,'fontweight','bold','fontsize',12)
xlabel(['Day Number ',int2str(year(1))],'fontweight','bold','fontsize',14)
ylabel('Kp','fontweight','bold','fontsize',14)
%title('3-Hourly Kp','fontweight','bold','fontsize',12)
axis([0 (max(xv)+8) 0 max(ceil(kp))]);

subplot(2,1,2)
h2=plot(timv,f107,'ob',timv,f107a,'r^',timv,f107p,'sg');
set(h2(1),'markerfacecolor','b')
set(h2(2),'markerfacecolor','r')
set(h2(3),'markerfacecolor','g')
set(gca,'xtick',xv)
set(gca,'xticklabel',dnov')
grid
set(gca,'fontweight','bold','fontsize',12)
xlabel(['Day Number ',int2str(year(1))],'fontweight','bold','fontsize',14)
ylabel('F10.7','fontweight','bold','fontsize',14)
%title('Solar Flux Variation','fontweight','bold','fontsize',12)
axis([0 (max(xv)+8) 5*floor(min(f107)/5) 5*ceil(max(f107)/5)]);
legend(h2,'Daily F_{10.7}','81 Day F_{10.7}','Previous day F_{10.7}',2)


