First we read all the data
pro read_all_larkhill_sondes,all_data,all_times ;+ ;Reads in all larkhill sonde data from /nfs/see-fs-02_users/lecjm/public_html/Teaching/IDL_course/New_Course_v1/Data/ and gets times from filenames ;- ;Finds all files that fir the description (* is any or no characters) ;Keyword count allows us to count them files=findfile('/nfs/see-fs-02_users/lecjm/public_html/Teaching/IDL_course/New_Course_v1/Data/larkhill_20050624*.txt',count=nfiles) width=7 ; we know all files have 7 variables max_lines=1000 ; max number of lines in a file (choose a big number) all_data=fltarr(width,max_lines,nfiles) all_times=fltarr(max_lines,nfiles) all_nlines=fltarr(nfiles) for i = 0,nfiles -1 do begin ; for each file read_ascii_cols,files(i),data,width,head_length=5 time_hours=fix(strmid(files(i),7,2,/reverse_offset),type=4);hour from title time_mins =fix(strmid(files(i),9,2,/reverse_offset),type=4) sz_data=size(data); LOOK THIS UP TO SEE WHAT IT DOES! nlines=sz_data(2) all_nlines(i)=nlines all_data(*,0:nlines-1,i)=data times=time_hours+time_mins/60. ; time of data in hours all_times(*,i)=times endfor ;Bin empty part of array maxlines=max(nlines) all_data=all_data(*,0:maxlines-1,*) all_times=all_times(0:maxlines-1,*) end
Then we plot it.
pro plot_all_larkhill_sondes ;+ ;plots example graphs using larkhill sonde data, including a contour plot of irrgularly gridded data. ;- read_all_larkhill_sondes,all_data,all_times ;;;;;;;;;;;E.g. to plot temp vs pressure for the first sonde window,0,retain=2 !p.color=0 !p.background=256*256-1 ;Where 0<press<1200mb AND 0<temp<600 K w=where(all_data(1,*,0) gt 0. and all_data(1,*,0) lt 120000. and all_data(3,*,0) gt 0. and all_data(3,*,0) lt 600.,cw) plot,(all_data(3,*,0))(w),(all_data(1,*,0))(w),$ xtitle='Temp (K)',ytitle='Pressure (hPa)',yrange=[100000,0] ;;;;;;;To contour temp vs pressure for all sondes ;Where 0<press<1200mb AND 0<temp<600 K w=where(all_data(1,*,*) gt 0. and all_data(1,*,*) lt 120000. and all_data(3,*,*) gt 0. and all_data(3,*,*) lt 600.,cw) window,1,retain=2 !p.color=0 !p.background=256*256-1 lev=indgen(50)*2.+210. contour,(all_data(3,*,*))(w),(all_times(*,*))(w),(all_data(1,*,*))(w),/irregular,levels=lev,yrange=[1000,500]*100.,/fill,xtitle='Time (UTC)',ytitle='Pressure (Pa)' contour,(all_data(3,*,*))(w),(all_times(*,*))(w),(all_data(1,*,*))(w),/irregular,levels=lev,/overplot,c_labels=lev*0.+1 ;NOW OVERPLOT VERTICAL DOTTED LINES AT THE TIMES OF THE ACTUAL RADIOSONDES stop end
\keyword_name
sets any named keyword to 1.
So \irregular
sets the irregular keyword of contour to 1.
Contour takes 1D input of data, x and y (see IDL help).