load in
load Look_up_table
x = dir('c:\data\AIRS\bormin\in\');
[numfiles n] = size(x);
variable = 'COUNTS';
for i=3:numfiles-1
   %filename = substr(x(i).name,0,-4);
   %filename = ['c:\data\AIRS\bormin\in\' x(i).name];
   filename = 'c:\data\AIRS\bormin\in\AIRS.2004.03.02.193.L1A.AIRS_Scene.v3.2.7.0.N04062160757.hdf.mat';
   load(filename);
   COUNTS=COUNTS(in,:);
   [R1, COUNTS(1:264,:)]=GOES_R(12,double(COUNTS(1:264,:)),T_E1(1,:),T_E2(1,:),T_v(1,:),T_e(1,:));
   [R2, COUNTS(265:514,:)]=GOES_R(12,double(COUNTS(265:514,:)),T_E1(2,:),T_E2(2,:),T_v(2,:),T_e(2,:));
   [R3, COUNTS(515:835,:)]=GOES_R(13,double(COUNTS(515:835,:)),T_E1(3,:),T_E2(3,:),T_v(3,:),T_e(3,:));
   [R4, COUNTS(836:1206,:)]=GOES_R(13,double(COUNTS(836:1206,:)),T_E1(4,:),T_E2(4,:),T_v(4,:),T_e(4,:));
   [R5, COUNTS(1207:1502,:)]=GOES_R(14,double(COUNTS(1207:1502,:)),T_E1(5,:),T_E2(5,:),T_v(5,:),T_e(5,:));
   R=(R1*264+R2*length(265:514)+R3*length(515:835)+R4*length(836:1206)+R5*length(1207:1502))/1502
   filename = substr(x(i).name,0,19);
   filename = [filename '.mat'];
   save(filename,variable);
end
clear COUNTS;
clear x;

