pywws.service.metoffice¶
Upload weather data to UK Met Office “WOW”.
The UK Met Office runs a Weather Observations Website (WOW) that displays readings from amateur and official weather stations. This module uploads data to it from pywws. You can upload “logged” or “live” data (or both). The module ensures there is at least 5 minutes between each reading as required by the API.
Create account: https://register.metoffice.gov.uk/WaveRegistrationClient/public/newaccount.do?service=weatherobservations
API: http://wow.metoffice.gov.uk/support/dataformats#automatic
Additional dependency: http://docs.python-requests.org/
Example
weather.ini
configuration:[metoffice] site id = 12345678 aws pin = 987654 [logged] services = ['metoffice', 'underground'] [live] services = ['metoffice', 'underground']
Note that a site id
allocated since June 2016 will probably look
like 6a571450-df53-e611-9401-0003ff5987fd
.
Classes
ToService (context[, check_params]) |
-
class
pywws.service.metoffice.
ToService
(context, check_params=True)[source]¶ Bases:
pywws.service.CatchupDataService
-
config
= {'aws pin': ('', True, 'siteAuthenticationKey'), 'site id': ('', True, 'siteid')}¶
-
fixed_data
= {'softwaretype': 'pywws-21.4.0'}¶
-
interval
= datetime.timedelta(seconds=300)¶
-
logger
= <Logger pywws.service.metoffice (WARNING)>¶
-
service_name
= 'metoffice'¶
-
template
= '\n#live#\n#idx "\'dateutc\' : \'%Y-%m-%d %H:%M:%S\',"#\n#wind_dir "\'winddir\' : \'%.0f\'," "" "winddir_degrees(x)"#\n#wind_ave "\'windspeedmph\': \'%.2f\'," "" "wind_mph(x)"#\n#wind_gust "\'windgustmph\' : \'%.2f\'," "" "wind_mph(x)"#\n#hum_out "\'humidity\' : \'%.d\',"#\n#temp_out "\'tempf\' : \'%.1f\'," "" "temp_f(x)"#\n#rel_pressure "\'baromin\' : \'%.4f\'," "" "pressure_inhg(x)"#\n#calc "rain_inch(self.rain_rate(data))"\n "\'rainin\' : \'%.4f\',"#\n#calc "rain_inch(self.rain_day_local(data))"\n "\'dailyrainin\' : \'%.4f\',"#\n#calc "temp_f(dew_point(data[\'temp_out\'], data[\'hum_out\']))"\n "\'dewptf\' : \'%.1f\',"#\n'¶
-
session
()[source]¶ Context manager factory function for a batch of one or more uploads.
This makes it easy to ensure any resources such as an internet connection are properly closed after a batch of uploads. Use the
contextlib.contextmanager()
decorator when you implement this method.For a typical example, see the source code of the
pywws.service.openweathermap
module. If your upload can’t benefit from a session object yieldNone
, as inpywws.service.copy
.
-
Comments or questions? Please subscribe to the pywws mailing list http://groups.google.com/group/pywws and let us know.