Coder Social home page Coder Social logo

rugaard / dmi-open-data Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lasseregin/dmi-open-data

0.0 1.0 0.0 20 KB

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

License: MIT License

Python 100.00%

dmi-open-data's Introduction

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

dmi-open-data's People

Contributors

lasseregin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.