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 –
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 : http://www.fmisonline.org/Map/India/Outline.gif
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.
map_source.py
#Begin code
import vcs, cdms2, cdutil, time, os, sys
import vcsaddons
import vcsaddons
v = vcs.init()
filehandler=cdms2.open(sys.prefix+'/sample_data/clt.nc')
mapregion=filehandler("clt",longitude=(60,100),latitude=(5,40))
world_continents = vcsaddons.continents.Guc(x=v)
world_continents.types=[2]
world_continents.colors=[241]
world_continents.sources=['/home/arul/Desktop/WORLD_COUNTRIES.shp',]
world_continents.list()
v.plot(mapregion,world_continents,ratio='autot')
v.png("india")
data = world_continents.load_shapefile('/home/arul/Desktop/WORLD_COUNTRIES.shp')
#wrting the data into out.txt file
fileiter=open("/home/arul/Desktop/out.txt","w")
print >> fileiter, data[:]
fileiter.close()
#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.
http://www2-pcmdi.llnl.gov/cdat/tutorials/cdatbasics/plotting-basics/creating-continents/?
searchterm=continents
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
cdat.
Now we are going to plot the world map and india map from “ data_continent_other7 “.
mymap.py
# 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/clt.nc')
cdmsfile = cdms2.open( 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."
sys.stdin.readline()
data = cdmsfile('clt', longitude=(60, 100), latitude = (5., 40.))
v.plot( data, cf_asd,continents=6)
sys.stdin.readline()
#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
Arulalan.T
![our-india [ half edited ]](https://tuxworld.files.wordpress.com/2010/02/construct-india7.png?w=570&h=464)




Posted by My Talk Proposal to PyConfIndia 2010 | Tux Coder on July 29, 2010 at 1:07 am
[…] My Corrections in Our CDAT India Map : https://tuxworld.wordpress.com/2010/02/13/how-to-edit-world-map-in-cdat-documentation/ […]
Posted by Mak on December 22, 2010 at 9:42 pm
Excellent job Arulalan.
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
Posted by indian on October 19, 2011 at 9:34 pm
how to edit a district of
Posted by アウトレット coach on September 13, 2013 at 8:31 am
prada バッグ