%% plasires2.m is very stripped down version of plasires.m. It is 
%% designed to simply determine the lshcp value for the given 
%% data set, as well as the maximum L-shell. It also returns the
%% L-shell and MLT vectors for the arrays.
%%
%% 5/3/2002 - remove different files name extension for IRI CCIR or URSI parameters (store iricf in arrays).
%% 

function [lshcp,lshmx,lsh,mlt]=plasires2(dno,year)

% dno = day number (scalar)
% year = year (scalar)
%
% lshcp = maximum L-shell for calculation of profiles
% lshmx = maximum L-shell
% lsh = L-shell of arrays
% mlt = MLT of arrys

%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

lshmx=max(lsh);