% --------------------------------------------------------------------
function save_modis_index(handles)

%handles.colloc.data
airs_ind = [handles.colloc.data.apixel];
%airs_ind = [data.apixel];
ind = find(airs_ind == handles.airs.index);
data = handles.colloc.data(ind);
%data
if (data.apixel ~= handles.airs.index)
  disp(['Error in selecting AIRS footprint: ' num2str(handles.airs.index) '  ' num2str(data.apixel)])
end

[fileName, dataPath]=uiputfile('*.asc','Save selected MODIS index File ');

fid = fopen([dataPath fileName], 'w');

fprintf(fid, '%8d %10.2f %10.2f\n', data.apixel, data.alat, data.alon);
fprintf(fid, '%8d\n', data.mpixels);

for n = 1:data.mpixels
  fprintf(fid, '%16.0f %10.2f %10.2f %8.4f %8.2f\n', ...
          data.index(n), data.lat(n), data.lon(n), data.weight(n), data.dist(n));
end

fclose(fid);
