Change-Chart-Map

India-Base Map

CDAT-India

Change-chart

How to share snippet to launchpad

Hi,

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.

mail.py

( 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 your-snippet.py

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

i.e

$ bzr add mail.py

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 id_rsa.pub

id_rsa.pub

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 (mail.py) 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>

i.e

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

Thanks,

Arulalan.T

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 .

http://picasaweb.google.com/tarulalan/IsolinesOverIndiaOn17032010For24Hours#

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 http://www.timeanddate.com/weather/india to all the cities. Also getting values from china , pakistan , miyanmar, sri lankha, Nepal ,etc.,

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

3. Generate the Isothermal_over_india.png using “iso.nc” 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 .

Arulalan.T

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 : http://www.slideshare.net/arulalan/contour-ilugc-demo-presentation-3554540

Arulalan.T

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

http://www.timeanddate.com/weather/

For India : Current Temperature

http://www.timeanddate.com/weather/india

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.


Webscrap_current_temperature.py


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('http://www.timeanddate.com/weather/india').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
f=open('temp.txt','w')
s=str(soupcontent)
f.write(s)
f.close()

#find and write the long string which contaning all the cities temperature values inside table from temp.txt into content.txt
file1=open('temp.txt','r')
for line in file1:
 loc=line.find("agra")
 if loc is not -1:
 content=line
file1.close()

file2=open('content.txt','w')
file2.write(content)
file2.close()

file3=open('content.txt','r')
file4=open('cities_and_its_temperatures_in_degree.txt','w')

# 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
 time_col=line.find('img')
 date_and_time=''
 time_col=time_col-21
 date_and_time=date_and_time+line[time_col]
 flag0=1
 while flag0:
 time_col=time_col-1
 date_and_time=date_and_time+line[time_col]
 if line[time_col-1]==">":
 flag0=0
 date_and_time = date_and_time[::-1]
 first_line="current temperature in all cities of india at this moment "+date_and_time
 file4.write(first_line)
 file4.write('\n')
 #To find degree of temp
 found=line.find('&nbsp;&deg;C')
 while found > -1:
 flag=1
 column=found
 deg=''
 while flag:
 column=column-1
 if line[column-1]==">":
 flag=0

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

 city=''

 flag1=1
 while flag1:
 column=column-1
 if line[column-1]==">":
 if line[column-2]=="a":
 column=column-5
 while flag1:
 city=city+line[column]
 column=column-1
 if line[column]==">":
 flag1=0

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

 city_and_temp=''
 city_and_temp=city+'        '+deg+'\n'
 file4.write(city_and_temp)

 #print city
 #print deg

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

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

os.remove('temp.txt')
os.remove('content.txt')
print date_and_time

PasteBin :

http://pastebin.com/WxYfapXC

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.

http://pastebin.com/dv92bDuB

I hope this may help to some one. :-)

By

Arulalan.T

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 :

http://www.fallingrain.com/world/index.html

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 :

http://www.fallingrain.com/world/IN/

Here is my work :

Andaman :

http://pastebin.com/XTm7tmgN

Andra :

http://pastebin.com/1KPG3iz0

Arunachal-Pradesh :

http://pastebin.com/fzMvENJK

Assam :

http://pastebin.com/zKL8hrvM

Bihar :

http://pastebin.com/CAnFrhqz

Chandigarh :

http://pastebin.com/0SGCg0Bf

Dadra & Nagarhaveli :

http://pastebin.com/yG7uMWpc

Delhi :

http://pastebin.com/REArV6eL

Diu-Daman :

http://pastebin.com/10DipKWV

Gujarat :

http://pastebin.com/cr07Wsa5

Haryana :

http://pastebin.com/VUHFVb8t

Jharkhand :

http://pastebin.com/YuAzwvWr

Jammu & Kashmir :

http://pastebin.com/ScxqgFpT

Karnataka :

http://pastebin.com/S0Be62H2

Kerala :

http://pastebin.com/LD7XMDf8

Madhya-Pradesh :

http://pastebin.com/eUNXqjpQ

Maharashtra :

http://pastebin.com/m4kR1nEu

Manipur :

http://pastebin.com/VeHesmj5

Meghalaya :

http://pastebin.com/3M7YJkic

Mizoram :

http://pastebin.com/wRprRVmp

Nagaland :

http://pastebin.com/c1i6fvkD

Orissa :

http://pastebin.com/C8aYFw9u

Pudhucherry :

http://pastebin.com/Njq5bKfS

Punjab :

http://pastebin.com/kjA65u6S

Rajasthan :

http://pastebin.com/AbpZ4x6v

Tamil Nadu :

http://pastebin.com/7zMuET6e

Tripura :

http://pastebin.com/T4KNS7df

Uttarakhand :

http://pastebin.com/dN7k1Wiy

Uttarpradesh :

http://pastebin.com/hLQ3EjK3

West-Bengal :

http://pastebin.com/QGRNEhz5

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

http://pastebin.com/VzQYg9cS

I simply copied all the table content from the http://www.fallingrain.com/world/IN/ 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

Arulalan.T

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 :  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 :

http://www.slideshare.net/arulalan/editcorrect-india-map-in-cdat-documentation-with-edited-world-map-data

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

Follow

Get every new post delivered to your Inbox.