contour program using contour module and cdat 5.2

Hi to all.  

Here i pasted example program to draw contour using 
"contour.py" module.

Download the corrected "contour.py" module from the previous
post of mine.

Link : https://tuxworld.wordpress.com/2010/01/15/setting-up-contour-module-in-cdat-5-2/

save the contour.py in /home/[user-name]/example/     location.

copy the below example program and save it as 
"sample.py" and pasted in that same folder.


import numpy as n
import numpy.ma as N
from contour import contour

x = N.arange(15) * 15.0 - 180.0
y = N.arange(15) * 15.0 - 360.0
data = N.outerproduct(n.sin(y*n.pi/360.), n.cos(x*n.pi/360.))

a=contour(data, x, y, title='Example')

a=raw_input('press enter to view levels in contour')
levs = [-0.4,-0.2,0,1.6,2.7,2.1,2.3,2.5]
#levs = [-0.8,-0.2,0,0.5,0.7,0.9]
contour(data, x, y, c_levels=levs)
b=raw_input('press enter to close ')

Run the program :

$ cd /usr/local/cdat5.2/bin

$ ./cdat /home/[user-name]/example/sample.py

Output :

[ In 2 Dimensional view ]

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: