Skip to main content

FMI weather data fetcher

Project description

FMI weather observation and forecast fetcher

Test Status

This library provides easy to use methods for fetching both observations and forecast data from Finnish Meteorological Institute (FMI). Currently just a quick hack, as I needed this for a project.

Installation

pip install fmi_weather

Usage

The library usage is fairly simple:

from fmi import FMI
f = FMI(place='Lappeenranta')
# f.observations() returns a list of Observation -objects for the last X hours.
print(f.observations())

Another way to set the API key and place is by setting them in environment variables FMI_PLACE. After setting the environment variables, you can use the library without "any" initialization:

from fmi import FMI
f = FMI()
# f.forecast() returns a list of Forecast -objects
print(f.forecast())

New in 1.1.0

place or coordinates are not longer required, but they are respected if present. This allows the usage of fmisid and wmo for definition of location, allowing better transparency on what location is used.

You can list view a list of locations at: https://www.ilmatieteenlaitos.fi/havaintoasemat

For example:

from fmi import FMI
f = FMI()
# Fetch and print observations from Lappeenranta Airport
print(f.observations(fmisid=101237))

New in 1.2.0

Added a helper FMI.fetch_stations() for fetching the possible stations. For example:

>>> from fmi import FMI
>>> from pprint import pprint
>>> pprint([
...   station
...   for station in FMI.fetch_stations()
...   if station['name'].startswith('Lappeenranta')
... ])

[{'fmisid': 101252,
  'groups': ['sää'],
  'height': 77,
  'latitude': 61.2,
  'longitude': 28.47,
  'name': 'Lappeenranta Hiekkapakka',
  'started': 2009,
  'wmo': 2919},
 {'fmisid': 101237,
  'groups': ['sää'],
  'height': 104,
  'latitude': 61.04,
  'longitude': 28.13,
  'name': 'Lappeenranta lentoasema',
  'started': 1950,
  'wmo': 2958}]

Forecast icons

Thanks to FMI, SVG icons are also provided as part of the library.

The weather symbol information is only available for forecasts unfortunately, so the Observation.icon -property is valid only for them. .icon returns the SVG-file path and .icon_as_svg returns the content itself.

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-1.4.0a1.tar.gz (2.8 MB view details)

Uploaded Source

Built Distribution

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

fmi_weather-1.4.0a1-py3-none-any.whl (2.8 MB view details)

Uploaded Python 3

File details

Details for the file fmi_weather-1.4.0a1.tar.gz.

File metadata

  • Download URL: fmi_weather-1.4.0a1.tar.gz
  • Upload date:
  • Size: 2.8 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fmi_weather-1.4.0a1.tar.gz
Algorithm Hash digest
SHA256 8b84934760fc22868fc1edf13fd6f4108b5a4434522d3b5fe275d331262c42d9
MD5 778037b121b30dd8369bc3a198b6bf9a
BLAKE2b-256 3acacca3469b9a9ef12864a9e2d911be5260f90ebe255f3749e43b290f5ea060

See more details on using hashes here.

File details

Details for the file fmi_weather-1.4.0a1-py3-none-any.whl.

File metadata

  • Download URL: fmi_weather-1.4.0a1-py3-none-any.whl
  • Upload date:
  • Size: 2.8 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.21 {"installer":{"name":"uv","version":"0.11.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for fmi_weather-1.4.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 c4c1e838e7cec59a0a086e67a86ce44989e4d2764ca50a60228f158808271f45
MD5 1ad739c053b5745d66f85b491364c988
BLAKE2b-256 286671b3ed4e9bce30af5883f58686bc0af29a76795ca99df0e775ceef1040bd

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