Archive for March, 2010

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(' °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(' °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