A Python module for accessing UK weather data via the Met Office's open data API known as Datapoint.
Python
Clone or download
jacobtomlinson Merge pull request #33 from viogp/master
Addition of forecast.future(in_days=#,in_hours=#, in_minutes=#, in _seconds=#)
Latest commit 1ac4b74 Aug 31, 2017
Permalink
Failed to load latest commit information.
datapoint Clean up an empty line in Day.py and add the removed lin nearest=Fals… Jun 27, 2017
docs
examples
tests Update test for python3 compatibility Jan 4, 2017
.gitignore
.travis.yml
LICENSE Updated license, readme and version constant Jun 6, 2016
MANIFEST Change to env var method Jan 18, 2017
README.md Updated license, readme and version constant Jun 6, 2016
mkdocs.yml Changed theme Oct 23, 2014
requirements.txt Converted dates and times returned from DataPoint into Python datetim… Oct 26, 2014
setup.py Test and support Python 3.6 Jan 20, 2017

README.md

DataPoint for Python

PyPi version Supported Python versions Build Status Documentation Status

A Python module for accessing weather data via the Met Office's open data API known as DataPoint.

Disclaimer: This module is in no way part of the DataPoint project/service. This module is intended to simplify the use of DataPoint for small Python projects (e.g school projects). No support for this module is provided by the Met Office and may break as the DataPoint service grows/evolves. The author will make reasonable efforts to keep it up to date and fully featured.

Features

  • List forecast sites
  • Get nearest forecast site from longitude and latitiude
  • Get the following 5 day forecast types for any site
  • Daily (Two timesteps, midday and midnight UTC)
  • 3 hourly (Eight timesteps, every 3 hours starting at midnight UTC)

Installation

$ pip install DataPoint

You will also require a DataPoint API key.

For more installation methods see the installation guide.

Documentation

Detailed documentation for this project is available on Read the Docs.

Example Usage

import datapoint

# Create connection to DataPoint with your API key
conn = datapoint.connection(api_key="aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee")

# Get the nearest site for my longitude and latitude
site = conn.get_nearest_site(-0.124626, 51.500728)

# Get a forecast for my nearest site with 3 hourly timesteps
forecast = conn.get_forecast_for_site(site.id, "3hourly")

# Get the current timestep from the forecast
current_timestep = forecast.now()

# Print out the site and current weather
print site.name, "-", current_timestep.weather.text

Example output

London - Heavy rain

See examples directory for more in depth examples.

Contributing changes

Please feel free to submit issues and pull requests.

License

GPLv3