Skip to main content

Simple Python interface to the The Danish Meteorological Institute's (DMI) Open Data API.

Project description

DMI Open Data API

Simple Python interface to the The Danish Meteorological Institute's (DMI) Open Data API.

Weather data from Denmark and Greenland are publicly available through DMI's Open Data API. Fetch raw weather observations from all available weather stations in Denmark and Greenland. Parameters available include temperature, windspeed, humidity, pressure, precipitation_, and many more.

Requirements

Installation

$ pip install dmi-open-data

Example

from datetime import datetime
import os

from dmi_open_data import DMIOpenDataClient, Parameter


# Get 10 stations
client = DMIOpenDataClient(api_key=os.getenv('DMI_API_KEY'))
stations = client.get_stations(limit=10)

# Get all stations
stations = client.get_stations()

# Get DMI station
dmi_station = next(
    station
    for station in stations
    if station['name'].lower() == 'dmi')

# Get closest station
closest_station = client.get_closest_station(
    latitude=55.707722,
    longitude=12.562119)

# Get available parameters
parameters = client.list_parameters()

# Get temperature observations from DMI station in given time period
observations = client.get_observations(
    parameter=Parameter.TempDry,
    station_id=dmi_station['stationId'],
    from_time=datetime(2020, 12, 20),
    to_time=datetime(2020, 12, 24),
    limit=1000)

API Key

API Key can be obtained for free at the DMI Open Data.

Tests

Run tests

$ python -m unittest discover tests

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

dmi-open-data-0.0.7.tar.gz (5.9 kB view details)

Uploaded Source

File details

Details for the file dmi-open-data-0.0.7.tar.gz.

File metadata

  • Download URL: dmi-open-data-0.0.7.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/51.3.3 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.2

File hashes

Hashes for dmi-open-data-0.0.7.tar.gz
Algorithm Hash digest
SHA256 f912d1adee5d2e6e5eb30ec0c253b25e9687f6e7b5f90273f1b855d0066e54e1
MD5 d1b4df5ad6b2dc15f5a2ffb3a2d5e666
BLAKE2b-256 02d2de9efe248b4397f5f6778e8e49020b8ae2850fb294139ffac2ec60271986

See more details on using hashes here.

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