%%%% /home/sergio/KCARTADATA/RefProf.For.v107up/refgas2
%%%% see make_lbl2kc_weakco2.m

%clustcmd -s -n 22 32 'matlab -nojvm -nodisplay < /home/sergio/KCARTA/SRC/
%NONLTE2/sergio/NONLTE_MATLAB/loop_background.m  > /airs/s1/sergio/junk 2> 
%/dev/null &' 

path(path,'/home/sergio/KCARTA/SRC/NONLTE2/sergio/NONLTE_MATLAB');
airs_nodes_co2back;

homedir = pwd;

clear topts
%% topts.linemixloop = -1; 
%% we do NLTE for most linemix bands (2350,2351,2352  2320,2321  2310,2311)
topts.band = [2353 2354 2322];   %%so do these here, as "weak" bands
topts.RemoveSomeBands = +1;

iaTemp = -50:10:50;
iaFr = 2205 : 25 : 2505;

iT = iDoJob;    %%%from airs_nodes_co2back

%% make the reference profile
fprintf('doing temperature = %4i \n',iaTemp(iT));
prof = load('refgas2');
prof(:,4) = prof(:,4) + iaTemp(iT);
fname = ['refgas2_' num2str(iT)];
fid = fopen(fname,'w');
fprintf(fid,'%3i  %10.8e %10.8e %7.3f %10.8e \n',prof');  
fclose(fid);

profname = pwd;
profname = [profname '/' fname];

for iF = 1 : length(iaFr)
  %% run run7lbl
  clear fr k
  f1 = iaFr(iF);
  f2 = f1 + 25.0;

  cd /home/sergio/SPECTRA;
  [fr,k] = run7co2(2,f1,f2,profname,topts);

  %% save the data
  outname = ['/carrot/s1/sergio/AIRSCO2/BACKGND_MAY2004/' fname];
  outname = [outname '_' num2str(f1) '.mat'];
  saver = ['save ' outname ' fr k prof f1 f2 topts profname'];
  eval(saver);
  end


  