%% plasires4.m is very, very stripped down version of plasires.m. It is 
%% designed to determine whether the IRI2001 geomagnetic storm model was
%% used (set by gms), the IRI coefficents used (set by iricf), and whether
%% He+ was modelled (set by hes), and the version of MSIS used (set by sms).
%%
%% 5/3/2002 - remove different files name extension for IRI CCIR or URSI parameters (store iricf in arrays).
%%

function [gms,iricf,hes,sms]=plasires4(dno,year)

% dno = day number (scalar)
% year = year (scalar)
%
% gms = IRI2001 geomagnetic storm model included (0 = no, 1 = yes) (scalar)
% iricf = IRI2001 FoF2 data set to be used (0 = CCIR, 1 = URSI) (scalar)
% hes = He+ simulated (0 = no, 1 = yes) (scalar)
% sms = switch to determine which version of MSIS to use (0 = MSIS90, 1 = NRLMSIS2000)(scalar)

% Known data sets previously calculated.
datm=plasiresdat;

%Load in plasimod data set for 1st required day
dnoj=dno(1);
yearj=year(1);

yrs=int2str(yearj);
dns=int2str(dnoj);
if dnoj<10
 dns=['00',dns];
elseif dnoj>=10 & dnoj<100
 dns=['0',dns];
end

%Determine if required data set is in GPIDres subdirectory. If it is,
%load file from directory, otherwise assume in current directory.
gpc=find(yearj==datm(:,1) & dnoj>=datm(:,3) & dnoj<=datm(:,4));

if isempty(gpc)
 eval(['load d',yrs,'d',dns])
else
 eval(['load GPIDres\y',int2str(datm(gpc,1)),'\run',int2str(datm(gpc,2)),'\d',yrs,'d',dns])
end

