Hong Kong Open Weather Data

Select_weather_data_to_change_Django_site_admin_-_2014-05-11_02.53.29

In Hong Kong, weather data is not ready for open, only 7 RSS feeds of latest news/updates from different weather reports are available on Data.One. which I presented at BarCampHK 2013, and announced my open source project hk0weather to be an interim solution of Hong Kong Open Weather Data.

hk0weather provides few open source web scrapers and parsers to scrap Hong Kong Observatory web pages, and parse data into useful machine readable data format.

Last week, I made parsed weather data stored to Django, so we can read data on Django web admin. And Hong Kong rainfall data is added to hk0weather early this week.

You are welcome to contact with me to look at demonstrations and develop your own front-end to use data produced by my software.

開放源碼香港天氣計劃 hk0weather

昨晚半夜終於第一次放 source code 上 github,hk0weather 是其中一個我打算拿出來 open source 的 projects。把 hk0weather 開放源碼的其中一個原因是,希望幫助打造香港的 Open Data 之類,實在忍不了香港某方那些所謂 (很爛的) Open Data 的格式。同時我也欣賞台灣的 g0v.tw 的工作,一直我也對一些政府或公共資料該如何公開 (open data) 有些意見 (提議),而由民間或社群來進行也是其中一個可取的方法,來帶動香港的 open data 發展。

第一個版本是把香港天文台的天氣報告,把各氣象站的溫度,以及香港天文台錄得的相對濕度,轉化以 json 資料或其他格式。基本上已足夠一般網站,從輸出 json 資料中取得香港氣溫來顯示。

hk0weather 是以 python 來編寫,利用 scrapy 作 web crawling 的 framework。以下是未經測試的使用例子。

$ virtualenv hk0weatherenv
$ source hk0weatherenv/bin/activate
$ pip install scrapy
$ git clone https://github.com/sammyfung/hk0weather.git
$ cd hk0weather
$ scrapy crawl currwx -t json -o testresult

Continue reading 開放源碼香港天氣計劃 hk0weather

設定 github 帳號的 git ssh key

我們可以使用 git 的 https:// protocol 來透過 HTTP auth 來存取 github 的 git repos 外﹐也可以使用 git 的 ssh:// protocol 來存取 github。

先在 command line,使用 ssh command 來產生和加入自己的 ssh key (RSA v2)。

$ ssh -t rsa -C “[email protected]
$ ssh-add

然後登入 github.com,在 Account Setting 的 SSH Keys 加入自己的 SSH Keys (Add SSH Keys),再把 ~/.ssh/id_rsa.pub 的內容貼在 Key 的一欄內﹐完成後進行一次測試。

$ ssh -T [email protected]
Hi sammyfung! You’ve successfully authenticated, but GitHub does not provide shell access.

這樣便成功了。