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



5 responses to this post.

  1. Posted by Mak on December 22, 2010 at 9:42 pm

    Excellent job Arulalan.


  2. Posted by muthu kumar on December 28, 2010 at 10:41 pm

    how i am add my village in world map…. shown to all people


  3. how to edit a district of


Leave a Reply

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

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

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s

%d bloggers like this: