Page 1 of 1

Reading Airport Weather Data

Posted: Mon Mar 28, 2016 11:36 am
by parkview
As I live in a compact urban area, so I haven't bothered putting up a proper rain gauge, or wind sensors. There is a BOM weather station around 2km from my house, so I usually just look up the BOM webpage to see the current wind/rain data. I have been meaning to script up something to automate the data collection so I can store the data in my local weather station MySQL database. The last few days of rain was the final straw, so late one evening (while the rain was drizzling on), with a bit of Googling I fumbled together some a few python json statements to list out the data that I wanted to collect, then later I add on a some MySQL lines to store the data safely away.

Here is the JSON demo part:

Code: Select all

import json
import requests
 
 
# set local variables
count = 0
index = 0
 
 
# go get the BOM weather data, as a json data file
r = requests.get('http://www.bom.gov.au/fwo/IDW60801/IDW60801.95611.json')
#print r.status_code
#print r.text
#print r.headers
#print r.url
 
data = json.loads(r.text)
# count the number of data rows we have downloaded
count = len(data["observations"]["data"])
print "number of current data events", count
 
 
 
# read airport weather
for index in range(0, count):
   url_datetime = data["observations"]["data"][index]["local_date_time_full"]
   wind_gust = data["observations"]["data"][index]["gust_kmh"]     
   wind_speed = data["observations"]["data"][index]["wind_spd_kmh"]     
   wind_dir = data["observations"]["data"][index]["wind_dir"]     
   air_temp = data["observations"]["data"][index]["air_temp"]     
   air_press = data["observations"]["data"][index]["press"]     
   humid = data["observations"]["data"][index]["rel_hum"]     
   rain = data["observations"]["data"][index]["rain_trace"]     
   # read out the data
   print url_datetime, air_temp, wind_dir, wind_speed, wind_gust, humid, rain
 
 
print 'end'
exit()


Some useful URL's:


Re: Reading Airport Weather Data

Posted: Tue Mar 29, 2016 3:52 pm
by Jubbp
Its quite amazing what information you can get when you have a good look around

Re: Reading Airport Weather Data

Posted: Tue Mar 29, 2016 8:17 pm
by parkview
Yes, thanks you BoM! :)

Re: Reading Airport Weather Data

Posted: Fri Apr 01, 2016 10:30 pm
by BeJay
I like to be my own BOM :) Funny enough my dodgy Chinese weather station external unit has died last week. Now more than ever, it's time to make an open source arduino / raspberrypi weather station. 8-)

Re: Reading Airport Weather Data

Posted: Fri Apr 01, 2016 10:39 pm
by parkview
Yes, I would like the full kit too, but in my urban location, I doubt that the rain and wind data would be very accurate due to fences and houses close by :cry:

Stephens designed and built some low power WiFi temperature sensors.

Re: Reading Airport Weather Data

Posted: Fri Apr 01, 2016 10:56 pm
by BeJay
Hey Paul,

It's surprising that your urban location is worse off than mine... I've had good data results from a 1.2m (standard) high weather station with approx 4m2 clear view. Way more accurate that my nearest airport (jandakot) :)

Re: Reading Airport Weather Data

Posted: Fri Apr 01, 2016 11:03 pm
by parkview
I haven't measured it, but the only area would be in the middle of a concrete walk way. The house kind of takes up most of the block. Things you have to do to get a shed squeezed in as well. :)