%% the H2004 files for all gases, done around Nov2010 using H2004
%% copy from 
%%   /strowdata1/s1/sergio/OLD_RUN8_NIRDATABASE/FIR80_150/fbin/h2o.ieee-le/
%% to
%%   /asl/data/kcarta/H2004_otherbands.ieee-le/FIR80_150/h2o.ieee-le
%%
%% Sergio Machado 7/15/2011

%% make basedir
cd /asl/data/kcarta
basedir = 'H2004_otherbands.ieee-le';
ee = exist(basedir);
if ee == 0
  mker = ['!mkdir ' basedir]; 
  fprintf(1,'mker = %s \n',mker);
  eval(mker)
  end
disp('  ')

%% make subdirs
bandsA = [ 80   140   300   500  2830  3550  5550   8250 12000 25000];
bandsB = [150   310   510   605  3330  5550  8200  12250 25000 45000];
names = {'FIR','FIR','FIR','FIR','NIR','NIR','NIR','NIR','VIS','UV'};

for ii = 1 : length(bandsA)
  disp(' ')
  gah = names{ii};
  dirname=[basedir '/' gah  num2str(bandsA(ii)) '_'  num2str(bandsB(ii)) '/'];
  for jj = 1 : 2
    if jj == 1
      namex = 'h2o';
    else
      namex = 'etc';
      end
    dadir = [dirname namex '.ieee-le/'];
    ee = exist(dadir);
    if ee == 0
      mker = ['!mkdir -p ' dadir]; 
      fprintf(1,'mker = %s \n',mker);
      eval(mker)
      end
    end
  end

%% copy from orig place to copyplace
origdir = '/strowdata1/s1/sergio/OLD_RUN8_NIRDATABASE/';
for ii = 1 : length(bandsA)
  disp(' ')
  gah = names{ii};
  dirname=[basedir '/' gah  num2str(bandsA(ii)) '_'  num2str(bandsB(ii)) '/'];
  origname=[origdir '/' gah  num2str(bandsA(ii)) '_'  num2str(bandsB(ii)) '/'];
  for jj = 1 : 2
    if jj == 1
      namex = 'h2o';
    else
      namex = 'etc';
      end
    dadir = [dirname namex '.ieee-le/'];
    odir  = [origname '/fbin/' namex '.ieee-le/'];
    ee1 = exist(dadir);
    ee2 = exist(odir);
    if ee1 == 0
      fprintf(1,'%s \n',dadir)
      error('hmmm did not make dir to copy to')
    elseif ee2 == 0
      fprintf(1,'%s \n',odir)
      error('hmmm orig dir DNE')
    else
      cper = ['!/bin/cp ' odir '/* ' dadir '/.']; 
      fprintf(1,'cper = %s \n',cper);
      eval(cper)
      end
    end
  end

