Skip to main content

Python interface to the Met Office's Datapoint API

Project description

DataPoint for Python

PyPi version Supported Python versions 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 latitiude and longitude
  • 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. This project uses semantic versioning as defined at semver.org.

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 latitude and longitude
site = conn.get_nearest_forecast_site(51.500728, -0.124626)

# Get a forecast for my nearest site with 3 hourly timesteps
forecast = conn.get_forecast_for_site(site.location_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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datapoint-0.10.0.tar.gz (39.5 kB view details)

Uploaded Source

Built Distribution

datapoint-0.10.0-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file datapoint-0.10.0.tar.gz.

File metadata

  • Download URL: datapoint-0.10.0.tar.gz
  • Upload date:
  • Size: 39.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for datapoint-0.10.0.tar.gz
Algorithm Hash digest
SHA256 9123deb3427d6e4bc0c14c57e68123a23d3b938747880abb03cbc062f8e6992a
MD5 36225ada2ebd2a1f16a8afe85ebe63e7
BLAKE2b-256 5df931014bf040030e886e188c9b4426b3ad024fe6da12763cce22aca9657ffc

See more details on using hashes here.

Provenance

The following attestation bundles were made for datapoint-0.10.0.tar.gz:

Publisher: publish-to-pypi.yml on EJEP/datapoint-python

Attestations:

File details

Details for the file datapoint-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: datapoint-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for datapoint-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e9d35fe39be4ee2d6afbfc1ff158966171ec77003c0e8d5fae12d597882458ae
MD5 9fcdcd46a2677ca12a6b4899bd5d615c
BLAKE2b-256 6767e18e81165146ef7dd902adbf3c41eb514825ad37ea513375186319cfce26

See more details on using hashes here.

Provenance

The following attestation bundles were made for datapoint-0.10.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on EJEP/datapoint-python

Attestations:

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page