PRO read_rico_winds ; reads in the name winds, puts them in an idlsave file fdir='/Users/pz/rico/leg2/sondes/' filenames=strarr(400) p2=fltarr(400,8000) & u=p2 & v=p2 & z=p2 speed=p2 & dir=p2 & dates=strarr(400) header=strarr(36) sonde_string='' usefiles=findfile(fdir+'*.wnd') usefiles=usefiles(sort(usefiles)) nsonde=n_elements(usefiles) FOR i=0,n_elements(usefiles)-1 DO begin openr,4,usefiles[i] ;dates[i]=strmid(usefiles[i],27,8) dates[i]=strmid(usefiles[i],27,8) ;leg 2 print,dates[i] readf,4,header j=0 WHILE not(eof(4)) DO begin readf,4,sonde_string sped=float(strmid(sonde_string,31,5)) on_ioerror,next_line press=float(strmid(sonde_string,9,7)) on_ioerror,next_line alt=float(strmid(sonde_string,19,5)) d=float(strmid(sonde_string,40,3)) p2[i,j]=press & z[i,j]=alt speed[i,j]=sped & dir[i,j]=d ; below is the right conversion for IDL.... u[i,j]= -sped*sin(d*!pi/180.) v[i,j]= -sped*cos(d*!pi/180.) j=j+1 if j gt 7999 then goto,nextfile next_line: ENDWHILE nextfile: close,4 ENDFOR p2=p2[0:nsonde-1,*] & z=z[0:nsonde-1,*] u=u[0:nsonde-1,*] & v=v[0:nsonde-1,*] speed=speed[0:nsonde-1,*] & dir=dir[0:nsonde-1,*] SAVE,filename='rico_wind_leg2.idlsave', $ p2,z,dates,u,v,speed,dir print,'nymber of soundings',nsonde print,'dun' END