Archive for February, 2010

How To Edit World Map In CDAT – Documentation

Hi to all,

Here i am going to explain about , ‘ how to edit world map in cdat ‘. Here i am going to share my experience about how to edit world map and create & adjust the Indian political map . While doing contour  and isolines plotting on India map in cdat , My guide Mr.Thyagarajan Shanmugham and myself felt that  our Indian Political Map wrongly depicted in CDAT as below.

Our first step in the long time goal :
Redrawing correct political map of india –

1) Correcting the PoK part , which belongs to India
2) Correcting the part of the land which is occupied by the Chinese in the state of jammu and kashmir

While asking help from Mr.Charles Doutriaux [ CDAT Developer ] regarding edit map in cdat, he gave the source data of cdat world map.

Here i edited india , partially

This Our India map , [ edited from cdat ]

I referred the India map from the link :

code to convert the WORLD_COUNTRIES.shp binary data into text format and to view the world
map from this binary data.
In the following code i used “/home/arul/ “ . Instead of this , you have to use your user name to set the correct path.

#Begin code
import vcs, cdms2, cdutil, time, os, sys
import vcsaddons
import vcsaddons
v = vcs.init()'/sample_data/')
world_continents = vcsaddons.continents.Guc(x=v)
data = world_continents.load_shapefile('/home/arul/Desktop/WORLD_COUNTRIES.shp')
#wrting the data into out.txt file
print >> fileiter, data[:]
#End of code

Run the above program from the cdat environment. It will generate the world map data and saved
into “out.txt” file. It contains nearly 109300 lines.
In the out.txt file , we can see approximately 51950 data. These data only plotting the world in vcs.

Before going to below , please just go through the above link.
argument to continent in plot method
0: “0 signifies – No Continents”,
1: “1 signifies – Fine Continents”,
2: “2 signifies – Coarse # Continents”,
3: “3 signifies – United States Continents”,
4: “4 signifies – Political Borders Continents”,
5: “5 signifies – North American Rivers Continents”,
6: “6 signifies – User continent file data_continent_other7”,
7: “7 signifies – User continent file data_continent_other8”,
8: “8 signifies – User continent file data_continent_other9”,
9: “9 signifies – User continent file data_continent_other10”,
10: “10 signifies – User continent file data_continent_other11”,
11: “11 signifies – User continent file data_continent_other12”
Now copy the out.txt into data_continent_other7
$ cp out.txt data_continent_other7
and paste into PCMDI_GRAPHICS folder
$ cp    data_continent_other7       ~/ PCMDI_GRAPHICS/
PCMDI_GRAPHICS folder was generated in our home folder by automatically.
Already we found the longitude=(60, 100), latitude = (5., 40.)) for India map from the world map in
Now we are going to plot the world map and india map from “ data_continent_other7 “.

# Import the modules needed for the tutorial
import vcs, cdms2, cdutil, time, os, sys
# Open data file:
filepath = os.path.join(sys.prefix, 'sample_data/')
cdmsfile = filepath )
# Extract a 3 dimensional data set and get a subset of the time dimension
data = cdmsfile('clt', longitude=(-180, 180), latitude = (-180., 180.))
#data = cdmsfile('clt', longitude=(60, 100), latitude = (5., 40.)) # for india long(60,100) and
lat(5,30) (5,40)
# Initial VCS.
v = vcs.init()
# Assign the variable "cf_asd" to the persistent 'ASD' isofill graphics methods.
cf_asd = v.getboxfill( 'ASD' )
cf_asd.datawc(1e20,1e20,1e20,1e20) # change to default region
cf_asd.level_1=1e20          # change to default minimum level
cf_asd.level_2=1e20          # change to default maximum level
cf_asd.color_1=240          # change 1st color index value
cf_asd.color_2=240 # change 2nd color index value
# Plot the data using the above boxfill graphics method.
v.plot( data, cf_asd,continents=6)# continents=6 for data_continent_other7 map
print "Press the Return key to see next plot."
data = cdmsfile('clt', longitude=(60, 100), latitude = (5., 40.))
v.plot( data, cf_asd,continents=6)
#End of code

Now we will Try to understand out.txt or data_continent_other7 data allocation method.
The first line specifies the connection of six points of (latitude, longitude) coodinates in the upper
left corner of the plot.
From the second line they are represented the Y axis and X axis point. For eg:
24 1 49.955277 58.660553 -8.171667 1.749445
54.113052 -7.330279
54.126938 -7.559446
54.163674 -7.624862
54.202500 -7.699723
54.200272 -7.747778
54.212219 -7.851389
54.253052 -7.869445
54.294167 -7.900279
54.299439 -7.941390
54.357216 -8.030280
54.372772 -8.065556
54.463879 -8.171667
-99 -99
The entry ” -99 -99″ indicate that no more data are to be read in (i.e., denotes end-of-file).
Note the total number of points for any given line should not exceed 200 points.
By this way , the whole world data are split into many no of data sets. So from this , we have to
find out which region data is india map data and edited it.
Hack Methods :
I hacked this out.txt source file by two method.

In the following pdf , i explained more detailed about the cdat map editing  with world data.

Download Link :

Download this pdf, where i elaborated the data handling methods of boundary of india, then merging the modified data with the world data set

I Love My India



CDAT Developers Supporting To My Project


On 12 th & 13 th feb 2010,

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

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.

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.  🙂

அருளாளன் . த


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.


pdf link :

My Project Goal


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 :

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

why Not ?

Contour Lines On CDAT Map


I did some basic concept of my project output.

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


save the following code as””

save the following code as “”

To run this program, do the following steps.

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

$ ./cdat ~/

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/')<br>cdmsfile = 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 :