Skip to content
/ fmi Public
forked from kipe/fmi

FMI weather observation and forecast fetcher

License

Notifications You must be signed in to change notification settings

photonix/fmi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FMI weather observation and forecast fetcher

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 git+https://github.com/kipe/fmi.git

Usage

The library requires a valid FMI API key. You can get one from the website (only in Finnish).

After acquiring the API key, the library usage is fairly simple:

from fmi import FMI
f = FMI('a-very-made-up-api-key', 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_APIKEY and FMI_PLACE. I know this is a bit unconventional, but works great with Docker. 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 Observation -objects (sorry, confusing, I know :P) for the next 36 hours
print(f.forecast())

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 (again, a bit unconventional, but helped me :P ).

About

FMI weather observation and forecast fetcher

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%