Skip to main content

Library for fetching weather information from Finnish Meteorological Institute (FMI)

Project description

Test Last commit

Finnish Meteorological Institute Weather

Library for fetching weather information from Finnish Meteorological Institute (FMI).

Originally build for personal use because I wanted to create a FMI integration for Home Assistant.

Library is not yet available in PyPi.

How to use

Working example can be found in example.py.

Get the weather by place name

Weather station depends on FMI service.

import fmi_weather_client

weather = fmi_weather_client.weather_by_place_name("Mäkkylä, Espoo")

If place name is not known or weather data is not available, the following exception is thrown:

fmi_weather_client.errors.NoWeatherDataError

Get the weather by coordinates

Weather stations is the closest one

import fmi_weather_client

weather = fmi_weather_client.weather_by_coordinates(63.361604, 27.392607)

If there are no stations within 50 km, the following exception is thrown:

fmi_weather_client.errors.NoWeatherDataError

Weather data

Available weather information depends on the weather station. Currently supported fields:

  • Station name
  • Station latitude
  • Station longitude
  • Measurement time
  • Temperature (°C)
  • Humidity (%)
  • Wind speed (m/s)
  • Wind gust (m/s)
    • Maximum gust wind in the past 10 minutes
  • Wind direction (°)
  • Dew point (°C)
  • Precipitation amount (mm)
    • Amount of rain in the past hour
  • Precipitation intensity (mm/h)
  • Pressure (hPa)
  • Visibility (m)
  • Cloud coverage
    • Cloud coverage is indicated as 1/8 sky.
    • 0.0 means no clouds
    • 4.0 means half cloudy
    • 8.0 means overcast

Observation data contains two fields: value and unit. You can also just print the measurement object to get a string representation:

print('Temperature: %s' % weather.temperature)

# Output: Temperature: 1.4 °C

Development

Setup

Create and activate a virtual environment

$ python -m venv venv
$ source venv/bin/activate

Install required packages

$ python -m pip install -r requirements.txt
$ python -m pip install -r requirements-dev.txt

When you stop working, deactivate virtual environment

$ deactivate

Run tests

$ pytest

Run code quality tools

$ flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude venv
$ flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127  --exclude venv

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

fmi-weather-client-0.0.1.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fmi_weather_client-0.0.1-py3-none-any.whl (20.8 kB view details)

Uploaded Python 3

File details

Details for the file fmi-weather-client-0.0.1.tar.gz.

File metadata

  • Download URL: fmi-weather-client-0.0.1.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

File hashes

Hashes for fmi-weather-client-0.0.1.tar.gz
Algorithm Hash digest
SHA256 e2f068d111b039bcb290a6768c533a508bc20f569cac900d3b1203ea82263ab5
MD5 a94de0d6ff12445107c0dd92e2fc830c
BLAKE2b-256 d78e4495a6d5c10d9a8c6eb0c12758672faa0062ba972c9c625d57dee05ac400

See more details on using hashes here.

File details

Details for the file fmi_weather_client-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: fmi_weather_client-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.42.1 CPython/3.7.5

File hashes

Hashes for fmi_weather_client-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 536a3854f257c1594d7b3a98e69c2e2614147e07d945286cebb3ad639b58e5b0
MD5 b0fc7a4255e8e37ae643a1b9ea57d28f
BLAKE2b-256 dfcebb8df1aca3fef84f864edf6c62e7e606cb58ed3ed64691048f58c96d5d18

See more details on using hashes here.

Supported by

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