next up previous contents
Next: A filled contour plot Up: Section 4: More reading Previous: Section 4: More reading   Contents

A first two 2D line contour plot

Use the code below to read in some ECMWF analysis data from the region of West Africa.

Create read_eg_ecmwf.pro

pro read_eg_ecmwf,lat,lon,t,q

;Code to read example binary ECMWF fields

;Create arrays to read data into 
lat=fltarr(161)
lon=fltarr(281)
q=fltarr(281,161,21,4);21 levels, 4 times
t=fltarr(281,161,21,4)

;Read ECMWF data (readu is read binary) 
; Temperature, Kelvin 
openr,12,'~lecjm/public_html/Teaching/IDL_course/Data/ECMWF/20070626_t.dat'
readu,12,t
close,12
;kg/kg water vapour mixing ratio 
openr,12,'~lecjm/public_html/Teaching/IDL_course/Data/ECMWF/20070626_q.dat'
readu,12,q
close,12
openr,12,'~lecjm/public_html/Teaching/IDL_course/Data/ECMWF/20070626_lat.dat'
readu,12,lat
close,12
openr,12,'~lecjm/public_html/Teaching/IDL_course/Data/ECMWF/20070626_lon.dat'
readu,12,lon
close,12
end

You can use this by,

read_eg_ecmwf,lat,lon,t,q

We want to contour the WVMR at the lowest level (level 20) at the first time (0th time, IDL counts from zero)

contour,q(*,*,20,0)

Data is only avaiable over a part of the world (West Africa) so try,

contour,q(*,*,20,0),lon,lat,xrange=[-30,40],yrange=[0,40]

It still plots for longitudes less than -30. Try

contour,q(*,*,20,0),lon,lat,xrange=[-30,40],yrange=[0,40],xstyle=1

Now we want to specify the levels and label them in g/kg,

contour,q(*,*,20,0)*1000.,lon,lat,xrange=[-30,40],yrange=[0,40],xstyle=1,levels=indgen(25)*2.,c_labels=intarr(25)+1

Now label the contour axes and add a title



John Marsham 2009-12-07