Archive for the ‘Linux’ Category


India-Base Map




How to share snippet to launchpad


Now we are going to see , how one developer going to share their snippet to launchpad domain.

( Here take screenshots when I shared one snippet to launchpad/python-snippets domain )

1. Import Snippets :

We will first need to grab the Python Snippets library from Launchpad

$ bzr branch lp:python-snippets

This command will grab all the python-snippet from launchpad and download in to current directory.

2. Share Snippet :

Assume we created our own snippet . Now its ready to share.

( This is gedit 2.30.0. )

Now we are going to share this snippet to launchpad via the following commands.

We now need to add our file in our branch using the add cmd:

Add :

$ bzr add

Change the current working directory into correct path in python-snippets directory


$ bzr add

Now, commit our changes to our local branch with the following cmd:

$ bzr commit

Now nano editor is opened to save the information about commit changes.

Here we need to type our commit log message .

And then Press “Ctrl+O” for write and “Ctrl+M” to append and fianlly “Ctrl+x” to exit the nano editor.

In the above image , we can see the committed revision number after added our file.

The following 3 steps for initial setup to share our file to launchpad.

Step 1:

Now we are going to generate our own Public RSA Key to share our program in launchpad. It will help to download other user.

$ ssh-keygen -t rsa

Now it asks the file name and password to pulic key. we need to enter our public key. Here i entered simply as “Enter” button as public key.

Step 2:

Now we need to copy the our Public RSA Key from ~/.ssh folder.

$ cd ~

$ cd .ssh

$ gedit

Copy the above content fully.

Step 3 :

Now we need to paste the copied content ( public key ) in our launchpad ssh key.

Login to our launchpad account and grab the create/edit ssh key .

That should be like below image.

Paste the copied content in “public key line” in our launchpad ssh key page as shown below.

Now press the “Import Key”.

Now SSH Public Key is successfully added.

Here after we can upload many times our snippets into our launchpad account.  The past 3 steps for one/first time process. Then lauchpad will remember our home folder and its .ssh public key. So no need to do the above 3 steps while doing next snippet upload/share from this system.

2. Share Snippet : ( continued … )

Propose it for merging

With our new snippet ready, it is time to propose it for inclusion in the main python-snippets library.sharing snippet)

Already we add our snippet ( and committed to our local bazzar.

Now push it to our own branch on Launchpad:

$ bzr push lp:~<your launchpad username>/python-snippets/<name of your branch>


$ bzr push lp:~tarulalan/python-snippets/webkit

Now its pushed into lauchpad and opeing the launchpad with our account in web browser.

This launchpad page will be automatically open. Here we will see our pushed file link and its status.

Here highlighted by within black boxes.

Now the status is “ This branch has not been scanned yet “.

So , we need to clcik “Propose For Merging”

Here we can write small description about our sharing snippet to understand by others.

We have “Extra Options” also. In that we can write Commit Message and extra informations.

Finally , Click ” Propose Merge

Finished . we done proposal for merge our snippet with the public snippet library.

Now we can see the status has been changed into our description message.

At the end , we will receive the mail from launchpad about the shared snippet and its status and its reviewers.

By this way any one can share their own snippets in launchpad.



24Hour Study on Isotherm Lines Over India using cdat

Hi to all,

Here i attached 51 images which is taken the output by automatted script using crontab in ubuntu .

see the time stamp on the top most right corner. Use slide show in picasa to view .!.

These output “isotherm_india” are generated by

1. webscraping the current temperature and barometer from the site to all the cities. Also getting values from china , pakistan , miyanmar, sri lankha, Nepal ,etc.,

2. Generate which is plotting the current temperature over India map

3. Generate the Isothermal_over_india.png using “” file

4. Send this “output image” and “to its source text file which contains ” latitude,longitude,temperature,barometer”  to my mail id and  ten of  my friends mail id.

5. I automatted all the 4 steps for nearly 2 days for every half an hour.

I have the text source file , so i can regenerate the same output as same in the above image link .


My First Talk in ILUGC – My Project Demo On Isothermal

Hi to all,

On 13 th March 2010, afternoon 3.30 pm i started to present my project deomo on “Creating Current Isotherm Lines on Over Cdat-India Map”.

In front of My guide Mr.Thyagarajan Shanmugham and other ilugc active members like Mr.Raman, Mr.Bharathi , Mr.Shrinivasan i was presented about cdat , contour lines and dynamic creation on contour demo using Reliance Net Card.

Also few of my friend Nandha kumar , Dhasthageer , Selvamai , Rajkumar were came to attend my project demo in ilugc.

Like wise more than 20 people were attend the ilugc meeting on that day.

Thanks to my guide and ilugc members to gave me a wonderful oppurtunity to present my project demo.

Download link :


WebScraping Program to get Current Temperature of all over India Cities

Hi to all,

While doing my project , i have to get current temperature for over all india cities.

For World : Current Temperature

For India : Current Temperature

I wrote one webscrap program to get all india cities current temperature from the above link.

And after running this python program then it will create “cities_and_its_temperatures_in_degree.txt” in your working directory.

To run this program , we need to install BeautifulSoup package.

$ sudo apt-get install python-setuptools

$ sudo easy_install BeautifulSoup

or  install from the BeautifulSoup Source Package.

from BeautifulSoup import BeautifulSoup
import re
import urllib
import unicodedata
import os

#open the url
print("Start Reading the website- this may take some time - approx 2 mins ")
filecontent= urllib.urlopen('').read()
#convert it into beautiful soup content
soupcontent = BeautifulSoup(filecontent)

print("Printing the values, which have been parsed")

#write the whole parsed soupcontent into temp.txt file

#find and write the long string which contaning all the cities temperature values inside table from temp.txt into content.txt
for line in file1:
 if loc is not -1:



# find the temperature degree value from this line array by reverse finding method and writes into deg,city variable. then reverse those string variable value and write into cities_and_its_temperatures_in_degree.txt file
for line in file3:

 #To find and Current time from the web link
 while flag0:
 if line[time_col-1]==">":
 date_and_time = date_and_time[::-1]
 first_line="current temperature in all cities of india at this moment "+date_and_time
 #To find degree of temp
 while found > -1:
 while flag:
 if line[column-1]==">":

 deg = deg[::-1]# reverse the string value


 while flag1:
 if line[column-1]==">":
 if line[column-2]=="a":
 while flag1:
 if line[column]==">":

 city = city[::-1]# reverse the string value

 city_and_temp=city+'        '+deg+'\n'

 #print city
 #print deg

 found=line.find('&nbsp;&deg;C', found+1)

print "cities_and_its_temperatures_in_degree.txt has successfully created\n please open this file to view all cities current temperature in degree"

print date_and_time

PasteBin :

Please use pastebin site to download the above program.

Output on 23/03/2010 at 08.01 am.  Its getting current  temperature for around 404 cities in India.

I hope this may help to some one. 🙂



Latitiude-Longitude-Altitude Of All Over India-Cities

Hi to all,

while doing my contour project , i feel the latitude longitude altitude for all over cities in India is essential thing to continue next step in my project.

So i collected all over cities lat lon alt_in_feet & alt_in_meter and converted in terms of csv ( comma Separated Value ).

This may help to some one.

For World :

Using this link i got all the data. While googling i got this link. I feel this is a good link among over other few links.

For India :

Here is my work :

Andaman :

Andra :

Arunachal-Pradesh :

Assam :

Bihar :

Chandigarh :

Dadra & Nagarhaveli :

Delhi :

Diu-Daman :

Gujarat :

Haryana :

Jharkhand :

Jammu & Kashmir :

Karnataka :

Kerala :

Madhya-Pradesh :

Maharashtra :

Manipur :

Meghalaya :

Mizoram :

Nagaland :

Orissa :

Pudhucherry :

Punjab :

Rajasthan :

Tamil Nadu :

Tripura :

Uttarakhand :

Uttarpradesh :

West-Bengal :

All Over Cities in India ( Combined all the above states ) :

I simply copied all the table content from the link and saved as .txt file.

Then i wrote simple Ruby Script to customize in terms of csv.

Finally i done.

🙂 I hope , this work may help to any one of the Indian. 🙂

I Love India


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