clear all
addpaths
fid	= fopen('spectraSAC_depl_eleo.inp');
stname	= fscanf(fid,'%s',1);
yr	= fscanf(fid,'%d',1);
chname	= fscanf(fid,'%s',1);
nPZfiles = fscanf(fid,'%d',1);
for i=1:nPZfiles
    PZfiles(i)	= cellstr(fscanf(fid,'%s',1))
end
 fclose(fid);

if (nPZfiles>1)
    for i=1:nPZfiles
        PZfile=char(PZfiles(i));
        idots=strfind(PZfile,'.');
        yearpz0(i)=str2num(PZfile(idots(1)-4:idots(1)-1));
        daypz0(i)=str2num(PZfile(idots(1)+1:idots(1)+3));
        yearpz1(i)=str2num(PZfile(idots(6)-4:idots(6)-1));
        daypz1(i)=str2num(PZfile(idots(6)+1:idots(6)+3));
    end
    ii=find(yearpz1==yr);
    daypz=[daypz1(ii) 365];
else
    daypz=[365];
end


fid=fopen('daypz.check','w+');
fprintf(fid,'%d ',daypz);
fclose(fid);

spectraSAC_depl_v3(stname,chname,3,yr,daypz,PZfiles)
spectraSAC_depl_v3(stname,chname,24,yr,daypz,PZfiles)


