Hello,
with help Fanning's library, I wrote the following code to visualize a contour lines for scattered rain value as function of latitude and longitude.
-----------------
pro rain
lat=[ 30.0057, 32.0008, 32.0078, 24.0022, 29.0075, 29.0003, 32.0010, 32.0082, 25.0080]
lon=[20.0017, 10.0027, 22.0058, 23.0030, 24.0053, 21.0057, 23.0092, 21.0085, 21.0013]
data_ra=[30.2000, 33.4000, 28.2000, 34.3000, 25.3000, 27.1000, 35.2000, 33.9000, 38.1000]
lat2d = Rebin(lat, 45)
lon2d = Rebin(lon,45)
data_r=Rebin(data_ra,45)
print, data_r
Triangulate, lon2d, lat2d, triangles
gridData = Trigrid(lon2d, lat2d, data_r, $
triangles, NX=45, NY=45, $
XGrid=xgrid, YGrid=ygrid)
nlevels = 12
step = (Max(gridData) - Min(gridData)) / nlevels
levels = IndGen(nlevels) * step + Min(gridData)
LoadCT, 33, NColors=nlevels, Bottom=1
SetDecomposedState, 0, CurrentState=currentState
Contour, gridData, xgrid, ygrid, /Cell_Fill, $
Levels=levels, Background=cgColor('white'), $
Position=[0.125, 0.125, 0.95, 0.80], $
Color=cgColor('black'), XStyle=1, YStyle=1, $
C_Colors=IndGen(nlevels)+1
Contour, gridData, xgrid, ygrid, /Overplot, $
Color=cgColor('black'), Levels=levels, $
C_Labels=everyOther
SetDecomposedState, currentState
cgColorbar, Range=[Min(gridData),Max(gridData)], $
Divisions=12, XTicklen=1, XMinor=0, $
AnnotateColor='black', NColors=12, Bottom=1, $
Position=[0.125, 0.915, 0.955, 0.95], $
Charsize=0.75
end
----------------------------------
the outcome contour lines are very bad. I need a help to improve my code
Cheers
Khaled
|