filename=dir(['C:\Documents and Settings\lorsolo\Desktop\alex\*.swp']); 
fid=fopen(['C:\Documents and Settings\lorsolo\Desktop\alex\',filename(79).name],'r','b')
eofstat=feof(fid);
fseek(fid,0,'eof');
size=ftell(fid)
fseek(fid,0,'bof');
%-----------------------------------------HEADERS------------------------%
fseek(fid,4,'bof');
type_of_data=fread(fid,4,'char');
type_of_data=char(type_of_data');
disp(type_of_data);
flight=fread(fid,8,'char');
flight=char(flight');
disp(flight);
storm=fread(fid,12,'char');
storm=char(storm');
disp(storm);
radar_id=fread(fid,4,'char');
radar_id=char(radar_id');
disp(radar_id);
track_file=fread(fid,32,'char');
track_file=char(track_file');
disp(track_file);
created_time=fread(fid,32,'char');
created_time=char(created_time');
disp(created_time);
flight_level=fread(fid,28,'char');
flight_level=char(flight_level');
disp(flight_level);



xdim=fread(fid,1,'int32')
ydim=fread(fid,1,'int32')
zdim=fread(fid,1,'int32')
nsweeps=fread(fid,1,'int32')
center=fread(fid,1,'int32')
unfold=fread(fid,1,'int32')
internven_att=fread(fid,1,'int32')
flag_dop=fread(fid,1,'int32')
fread(fid,1,'int32')
fread(fid,1,'float32')

stime1=(fread(fid,1,'float32'))
hr1=fix(stime1/3600)
mn1=(stime1-hr1*3600)/60
sec1=stime1-(hr1*3600+mn1*60)
stime2=fread(fid,1,'float32')
hr2=fix(stime2/3600)
mn2=(stime2-hr2*3600)/60
sec2=stime2-(hr2*3600+mn2*60)


lat=fread(fid,1,'float32')
lon=fread(fid,1,'float32')
sxt=fread(fid,1,'float32')
syt=fread(fid,1,'float32')
syt=fread(fid,1,'float32')
xz=fread(fid,1,'float32')
yz=fread(fid,1,'float32')
zz=fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')
fread(fid,1,'float32')

position=ftell(fid)
fseek(fid,4,'cof');
 position=ftell(fid)
 
  fread(fid,1,'int16');
    fread(fid,1,'int16');
for j=1:240
   
    for i=1:2:240
        
dbz_comp=fread(fid,1,'uint16');

     
            temp(i,j) = bitand(dbz_comp, 255);
            temp(i+1,j) = bitshift(dbz_comp, -8);

      end
      fread(fid,1,'int16');
   fread(fid,1,'int16');
    fread(fid,1,'int16');
     fread(fid,1,'int16');
  end
        

      dbz = (temp - 64)/2;
    

dbz=rot90(dbz);
fread(fid,1,'int16');
   fread(fid,1,'int16');
position=ftell(fid)

fclose(fid)
x_fill=(-sxt*1000*xdim/2):sxt*1000:sxt*1000*xdim/2 - sxt*1000;
y_fill=(-sxt*1000*xdim/2):sxt*1000:(sxt*1000*xdim/2) - sxt*1000;
