CDAT Developers Supporting To My Project

#24camp

On 12 th & 13 th feb 2010,

In chennai ,” serendio ” company conducted one day hack event namely called 24camp.   Link : http://24camp.org/

In that , nearly 15 people are participated in that camp.

And I too joined with them through #24camp at freenode irc channel.

In that , i posted my project about cdat map and correcting india map . The goal to all is , with in 24 hours have to complete all of their projects.

The camp was started at 8pm on 12 th to 8 pm on 13 th.

http://24camp.org/Camp/CorrectingIndiaMapInCDAT

In the above link ,i uploaded my project status on 13 th.

I tried to completed the editing work of india map in cdat before deadline time. even though , i couldnt complete it. But around 10 pm on 13 th feb , i completed the india map editing project.  🙂

அருளாளன் . த

Nomograph

Hi to all,

While googled i got Nomography and PyNomo .

It will help me out to understand about nomography to draw the contour lines which i specified in my project goal map.

Links:

http://myreckonings.com/wordpress/2008/01/09/the-art-of-nomography-i-geometric-design/#more-23

http://myreckonings.com/wordpress/2008/01/09/the-art-of-nomography-ii-designing-with-determinants/

http://myreckonings.com/wordpress/2008/01/09/the-art-of-nomography-iii-transformations/

pdf link : http://www.slideshare.net/arulalan/Nomography

My Project Goal

Hi,

The below figure is my goal in my project.

I have to produce one engine that should draw the following kind of contour lines which will be draw on VCS and Over on CDAT Map.

While googled contour images, i got this below image.

The above image links :

http://weatherfaqs.org.uk/files/u1/exmap.gif
http://weatherfaqs.org.uk/node/144

I explored Connecting isopleth by contour lines using nomograms as shown in the figure.

why Not ?

Contour Lines On CDAT Map

Hi,

I did some basic concept of my project output.

As we seen earlier post, in My project I did contour over map.

code.

save the following code as”mapcontour4.py”

http://pastebin.com/f4075bd44

save the following code as “mycontourmap.py”

http://pastebin.com/f61c834db

To run this program, do the following steps.

$ cd /usr/local/cdat-5.2/bin

$ ./cdat ~/mycontourmap.py

If we run the above program , we will get the output as below.

More over, this contour plot is not at all satisfied to me and my guide Mr.Thyagarajan Shanmugam.

So we planned to build a fresh contour module which will satisfies for heat ,pressure , wind and etc., contours.

அருளாளன் . த

Map plotting using cdat

Hi ,

The following code will produce world map outline with orwithout continents .

we can zoom or place the specific country map using scaleof latitude and longitude.
<br>import vcs, cdms2, cdutil, time, os, sys<br><br># Open data file:<br>filepath = os.path.join(sys.prefix, 'sample_data/clt.nc')<br>cdmsfile = cdms2.open( filepath )<br><br># Extract a 3 dimensional data set and get a subset of the time dimension<br>#data = cdmsfile('clt', longitude=(-180, 180), latitude = (-180., 180.))<br>data = cdmsfile('clt', longitude=(60, 100), latitude = (5., 40.))&nbsp;&nbsp; # for india long(60,100) and lat(5,30) (5,40)&nbsp;&nbsp; , (60,94)&amp;(0,30) to hide black<br><br># Initial VCS.<br>v = vcs.init()<br><br># Assign the variable "cf_asd" to the persistent 'ASD' isofill graphics methods.<br>cf_asd = v.getboxfill( 'ASD' )<br><br># Generate a log10 boxfill graphics method plot<br>#cf_asd.boxfill_type='log10'&nbsp; # change the boxfill type to log10<br>cf_asd.datawc(1e20,1e20,1e20,1e20) # change to default region<br>#cf_asd.datawc(0,0,80,80)<br>cf_asd.level_1=1e20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # change to default minimum level<br>cf_asd.level_2=1e20&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # change to default maximum level<br>cf_asd.color_1=240&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; # change 1st color index value<br>cf_asd.color_2=240&nbsp;&nbsp; # change 2nd color index value<br><br>v.plot( data, cf_asd,continents=4 )# continents=4 for political region map&nbsp; , 0 for geographical region<br><br>print "Press the Return key to close."<br>sys.stdin.readline()<br>

Our India Map :

Our World Map :

Interactive Contour -3d plot example program in matplotlib

Interactive contour  in matplotib , eg 1:

#begin of code
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
import time

plt.ion()  #interactive on

fig = plt.figure()
ax = axes3d.Axes3D(fig)
X, Y, Z = axes3d.get_test_data(0.05)
cset = ax.contourf(X, Y, Z)
ax.clabel(cset, fontsize=9, inline=1)
plt.draw()

ans=''
while ans != 'q':

 ax = axes3d.Axes3D(fig)
 X, Y, Z = axes3d.get_test_data(0.05)
 cset = ax.contourf(X, Y, Z)
 ans=raw_input('enter level values or 'q' to quit : ')
 #for eg : cset.level=[-45,-30,-20,-10,0,10,15,30,45,60]

 cset = ax.contourf(X, Y, Z,cset.levels)
 ax.clabel(cset, fontsize=9, inline=1)
 plt.draw()

 time.sleep(3)
 plt.clf()

plt.ioff()    #interactive off
plt.close()

#End of code

The above python program will run the contour 3D view using matplotlib.

And we can give the input at run time to change the contour levels.

while running the above program , in prompt says like “enter level values or ‘q’ to quit:”

Enter the following
[-45,-30,-20,-10,0,10,15,30,45,60] and press Enter .

Now u can see the changes of contour levels in the same figure.

so u can give the various levles of contour. ( upto 10 levels ‘default’)

Enter ‘q’ to quit the interaction mode.

Interactive in matplotib , eg 2: Using file

save the following contour levels values in list manner and save it as “contour.txt”
contour.txt

[-45,-30,-20,-10,0,10,15,30]
[-55,-25,-15,2,8,40,50,78]
[-40,-15,-10,1,20,49,60]
[-35,-28,-15,0,10,20,40]

matplotlib.py


#begin of code
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
import numpy as np
import time

plt.ion()
f1 = open(r'contour.txt')
fig = plt.figure()
ax = axes3d.Axes3D(fig)
X, Y, Z = axes3d.get_test_data(0.05)
cset = ax.contourf(X, Y, Z)
ax.clabel(cset, fontsize=9, inline=1)
#ax.view_init(90, 0)
#(0,30) side view
#(90,0) top view

ans=''

plt.draw()
raw_input('enter')
plt.ion()
for ans in f1.readlines():

 ax = axes3d.Axes3D(fig)
 #ax.view_init(90, 0)
 X, Y, Z = axes3d.get_test_data(0.05)
 cset = ax.contourf(X, Y, Z)

 cset.levels=eval(ans.strip())
 print cset.levels
 cset = ax.contourf(X, Y, Z,cset.levels)
 ax.clabel(cset, fontsize=9, inline=1)
 plt.draw()

 time.sleep(3)
 raw_input('enter')
 plt.clf()
plt.close()
f1.close()

#end of code

Run the above python coding. It will take the input contour levels from the file “contour.txt” and the output shows like movie of 3d contour changes in its levels.

Outputs :

Initial levels in 3D contour : [ fill ]

code :

ax.contourf(X, Y, Z,cset.levels)

Changes in contour levels :

Contour in Line Drawing :

code :

ax.contour(X, Y, Z,cset.levels)


Changes in Line contour levels :

Contour in Top View :

code :

ax.view_init(90, 0)

Contour level changes in top view :

Contour in side view :

code :

ax.view_init(0, 30)

Contour changes in side view :

you can download theabove documentation in pdf format from here .,

Link : http://www.slideshare.net/arulalan/matplotlibinstallatininteractivecontourexampleguide

அருளாளன் . த