Reading Airport Weather Data

Tell us about your projects. Update us regularly.
Post Reply
parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Reading Airport Weather Data

Post by parkview » Mon Mar 28, 2016 11:36 am

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:


User avatar
Jubbp
Master Maker
Posts: 209
Joined: Sun Jun 22, 2014 8:15 pm
Location: Bunbury WA
Contact:

Re: Reading Airport Weather Data

Post by Jubbp » Tue Mar 29, 2016 3:52 pm

Its quite amazing what information you can get when you have a good look around

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Reading Airport Weather Data

Post by parkview » Tue Mar 29, 2016 8:17 pm

Yes, thanks you BoM! :)

User avatar
BeJay
Maker
Posts: 139
Joined: Mon Jun 23, 2014 6:31 pm
Location: Perth
Contact:

Re: Reading Airport Weather Data

Post by BeJay » Fri Apr 01, 2016 10:30 pm

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

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Reading Airport Weather Data

Post by parkview » Fri Apr 01, 2016 10:39 pm

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.

User avatar
BeJay
Maker
Posts: 139
Joined: Mon Jun 23, 2014 6:31 pm
Location: Perth
Contact:

Re: Reading Airport Weather Data

Post by BeJay » Fri Apr 01, 2016 10:56 pm

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

parkview
Guru Maker
Posts: 603
Joined: Tue Jun 24, 2014 8:25 pm
Location: Busselton
Contact:

Re: Reading Airport Weather Data

Post by parkview » Fri Apr 01, 2016 11:03 pm

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

Post Reply