%% the H2008 files for all gases and Hartmann CO2, done around Nov2010
%% also copies the UMBC CO2 linemix files

%% copy from 
%%   /strowdata1/s1/sergio/RUN8_NIRDATABASE/IR_605_2830_H08_WV
%% to
%%   /asl/data/kcarta/H2008_IR.v1.ieee-le/
%%
%% Sergio Machado 7/15/2011

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

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% this is for H2008 WV,HDO and CO2 hartmann
%% orig dir
origdir = '/strowdata1/s1/sergio/RUN8_NIRDATABASE/';
namesORIG{1} = 'IR_605_2830_H08_WV/fbin/h2o_ALLISO.ieee-le/';
namesORIG{2} = 'IR_605_2830_H08_WV/fbin/hDo.ieee-le/';
namesORIG{3} = 'IR_605_2830_H08/fbin/etc.ieee-le/';
namesORIG{4} = 'IR_605_2830_H08_CO2/fbin/etc.ieee-le/'; %% hartmann

%% to be copied to
namesCOPY{1} = 'h2o_ALLISO.ieee-le/';
namesCOPY{2} = 'hDo.ieee-le/';
namesCOPY{3} = 'etc.ieee-le/';
namesCOPY{4} = 'co2_hartmann.ieee-le/';  %% hartmann

iStart = 1; iEnd = -4;
%iStart = 4; iEnd = 4;

%% make subdirs
for ii = iStart : iEnd
  disp(' ')
  gah = namesCOPY{ii};
  dadir = [basedir '/' gah];
  ee = exist(dadir);
  if ee == 0
    mker = ['!mkdir -p ' dadir]; 
    fprintf(1,'mker = %s \n',mker);
    eval(mker)
    end
  end

%% copy from orig place to copyplace
for ii = iStart : iEnd
  disp(' ')
  gah = namesCOPY{ii};
  dadir  = [basedir '/' gah];
  gah = namesORIG{ii};
  odir = [origdir '/' gah  ];
  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


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% this is for UMBC LineMix 370,378 and 385 ppmv
clear namesORIG origdir namesCOPY basedir iStart iEnd
clear all

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

origdir = '/strowdata1/s1/sergio/';
namesORIG{1} = 'CO2database/v20_23.ieee-le/';
namesORIG{2} = 'CO2ppmv378/co2.ieee-le/';
namesORIG{3} = 'CO2ppmv385/co2.ieee-le/';

%% to be copied to
namesCOPY{1} = 'CO2ppmv370.ieee-le/';  
namesCOPY{2} = 'CO2ppmv378.ieee-le/';  
namesCOPY{3} = 'CO2ppmv385.ieee-le/';  

iStart = 1; iEnd = 3;

%% make subdirs
for ii = iStart : iEnd
  disp(' ')
  gah = namesCOPY{ii};
  dadir = [basedir '/' gah];
  ee = exist(dadir);
  if ee == 0
    mker = ['!mkdir -p ' dadir]; 
    fprintf(1,'mker = %s \n',mker);
    eval(mker)
    end
  end

%% copy from orig place to copyplace
for ii = iStart : iEnd
  disp(' ')
  gah = namesCOPY{ii};
  dadir  = [basedir '/' gah];
  gah = namesORIG{ii};
  odir = [origdir '/' gah  ];
  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 '/*.dat ' dadir '/.']; 
    fprintf(1,'cper = %s \n',cper);
    eval(cper)
    end
  end
