comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » contour plot of scattered data
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
contour plot of scattered data [message #92847] Thu, 10 March 2016 16:14 Go to next message
kgharib02 is currently offline  kgharib02
Messages: 3
Registered: March 2016
Junior Member
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
Re: contour plot of scattered data [message #92850 is a reply to message #92847] Fri, 11 March 2016 09:11 Go to previous message
Craig Markwardt is currently offline  Craig Markwardt
Messages: 1869
Registered: November 1996
Senior Member
On Thursday, March 10, 2016 at 7:14:57 PM UTC-5, kgha...@gmail.com wrote:
> 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.
> -----------------
...
> ----------------------------------
> the outcome contour lines are very bad. I need a help to improve my code

More likely, you need to improve your data. With such a sparse data set, the contours will be poor.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: plotting
Next Topic: solving non linear equation

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 07:16:31 PDT 2025

Total time taken to generate the page: 0.00503 seconds