clf
fpath = '/hao/aim2/dmsp/dmsp_idm_4s/';
fname = {[fpath '9601/l139601Boundaries_Bz'],[fpath '9602/l139602Boundaries_Bz'],... %here put all of the names&paths
    [fpath '9603/l139603Boundaries_Bz'],[fpath '9604/l139604Boundaries_Bz'],...      %of the files you want plotted
    [fpath '9605/l139605Boundaries_Bz'],[fpath '9606/l139606Boundaries_Bz'],...
    [fpath '9607/l139607Boundaries_Bz'],[fpath '9608/l139608Boundaries_Bz'],...
    [fpath '9609/l139609Boundaries_Bz'],[fpath '9610/l139610Boundaries_Bz'],...
    [fpath '9611/l139611Boundaries_Bz'],[fpath '9612/l139612Boundaries_Bz']};


colormap(jet)
o=omniBox(1996); %call the omni data object in
    o.setfile
    o.readyear


for k = 1:length(fname)
    dataAr = []; 
    str = char(fname(k));
    filename = strcat( str, '.txt');
    data = dlmread(filename,'');
        
    yr = strcat('19',str(28:29));
    year = str2double(yr);
    
    
    
    for i = 1:length(data)
       
            [t, vsw] = o.inquire(data((i),2),(data((i),3) - 600),'vsw'); %find vsw value for the crossing
            [t, dsw] = o.inquire(data((i),2),(data((i),3) - 600),'dsw'); %''dsw
            dataAr(i,1) = data(i,1);
            dataAr(i,2) = data(i,2);
            dataAr(i,3) = data(i,3);
            dataAr(i,4) = data(i,4);
            dataAr(i,5) = data(i,5);
            dataAr(i,6) = data(i,6);
            dataAr(i,7) = data(i,7);
            dataAr(i,8) = data(i,8);
            dataAr(i,9) = data(i,9);
            dataAr(i,10) = vsw;
            dataAr(i,11) = dsw;
            
            hold on 
             if dataAr(i,10) < 600      
                scatter(dataAr(i,6),dataAr(i,5),20,sqrt((dataAr(i,8).^2) + (dataAr(i,9).^2) ))
             else
                scatter(dataAr(i,6),dataAr(i,5),20,sqrt((dataAr(i,8).^2) + (dataAr(i,9).^2) ),'Marker','+')
             end
            
       
           
           end
           
            dlmwrite(strcat(fpath,'1996Boundaries_sw','.txt'), dataAr,'delimiter',' ','-append'); %write boundaries file
        
          end
        
       

caxis([0 10])
xlabel('MLAT')
ylabel('MLT')
title('Boundaries 1996')
colorbar

hold off

pause
fplot= ['/hao/aim2/dmsp/dmsp_idm_4s/' '1996Boundaries_sw'];
set(gcf,'PaperPositionMode','auto');
print(gcf,'-dtiff',fplot);

    
    

    