fmi-weather-client
Simple client library for fetching weather information from Finnish Meteorological Institute.
https://github.com/saaste/fmi-weather-client
Category: Atmosphere
Sub Category: Meteorological Observation and Forecast
Last synced: about 20 hours ago
JSON representation
Repository metadata
Simple client library for fetching weather information from Finnish Meteorological Institute (FMI)
- Host: GitHub
- URL: https://github.com/saaste/fmi-weather-client
- Owner: saaste
- License: gpl-3.0
- Created: 2020-01-29T16:44:25.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2025-04-08T14:24:35.000Z (19 days ago)
- Last Synced: 2025-04-10T07:03:52.136Z (17 days ago)
- Language: Python
- Homepage:
- Size: 159 KB
- Stars: 32
- Watchers: 3
- Forks: 16
- Open Issues: 0
- Releases: 24
-
Metadata Files:
- Readme: README.md
- License: LICENSE
README.md
Finnish Meteorological Institute Weather
Library for fetching weather information from
Finnish Meteorological Institute (FMI).
If you want to know how FMI API works, you can check out their WFS Examples and Guidelines page.
For the current weather information, this library requests observations from the past 10
minutes using timestep 10
. Based on my tests this gave pretty reliable results from different weather stations.
Originally, I created this for myself to get FMI weather data to Home Assistant. I am not a meteorologist so if you are more weather-savvy, feel free to contribute and provide improvements! 💖
FYI: I don't use Home Assistant or this library anymore, so I may not know if things are broken or need updating. However, I'm more than happy to maintain this library, so if you find a bug or a need to update a dependency, feel free to file an issue. Even better, file a pull request that fixes the issues! 😉 💖
How to use
Working example can be found in example.py.
Install
$ pip install fmi-weather-client
Get weather, forecasts, and observations
You can get the weather using the following functions:
weather_by_place_name(place_name)
weather_by_coordinates(latitude, longitude)
observation_by_station_id(fmi_station_id)
Example:
import fmi_weather_client as fmi
from fmi_weather_client.errors import ClientError, ServerError
try:
weather = fmi.weather_by_place_name("Jäppilä, Pieksämäki")
if weather is not None:
print(f"Temperature in {weather.place} is {weather.data.temperature}")
except ClientError as err:
print(f"Client error with status {err.status_code}: {err.message}")
except ServerError as err:
print(f"Server error with status {err.status_code}: {err.body}")
You can get the forecasts using the following functions:
forecast_by_place_name(place_name, [timestep_hours=24], [forecast_points = 4])
forecast_by_coordinates(latitude, longitude, [timestep_hours=24], [forecast_points = 4])
Example:
import fmi_weather_client as fmi
from fmi_weather_client.errors import ClientError, ServerError
try:
forecast = fmi.forecast_by_coordinates(60.170998, 24.941325)
for weather_data in forecast.forecasts:
print(f"Temperature at {weather_data.time}: {weather_data.temperature}")
except ClientError as err:
print(f"Client error with status {err.status_code}: {err.message}")
except ServerError as err:
print(f"Server error with status {err.status_code}: {err.body}")
You can get the observation data from a station using the following functions:
observation_by_station_id(fmi_sid)
To get a weather observation from a station, you must provide a station ID. IDs can be found on FMI's station list. Note that weather observations are available only from weather stations. These are the ones with sää
in the Ryhmä
column.
Example:
import fmi_weather_client as fmi
from fmi_weather_client.errors import ClientError, ServerError
try:
weather = fmi.observation_by_station_id(101794)
if weather is not None:
print(f"Temperature at {weather.place} is {weather.data.temperature}")
except ClientError as err:
print(f"Client error with status {err.status_code}: {err.message}")
except ServerError as err:
print(f"Server error with status {err.status_code}: {err.body}")
All functions have asynchronous versions available with async_
prefix.
Errors
ClientError
Happens if FMI service returns 400-499
. This can happens for example if:
- Provided coordinates are invalid
- Provided place is not recognized
- Weather data is not available
Error object contains status code and human-readable error message from FMI service.
ServerError
Happens if FMI service returns any other error.
Error object contains status code and raw response body from FMI service
Weather data
FMI provides the following commonly used information:
- Temperature (°C)
- Pressure (hPa)
- Humidity (%)
- Wind direction (°)
- Wind speed (m/s)
- Wind gust (m/s)
- Dew point (°)
- Cloud coverage (%)
- Precipitation intensity (mm/h)
- Symbol Documentation in Finnish
- Feels like temperature (°C), calculated from weather data Documentation in Finnish
There are also other information available. Check models.py and FMI documentation for
more info.
Development
Setup
Create and activate a virtual environment
$ python -m venv venv
$ source venv/bin/activate
Install required packages
$ make setup
Deactivate virtual environment when you are done
$ deactivate
Run tests
This will run unit tests and code quality checks
$ make test
Owner metadata
- Name: Mika H
- Login: saaste
- Email:
- Kind: user
- Description:
- Website:
- Location:
- Twitter:
- Company:
- Icon url: https://avatars.githubusercontent.com/u/14893875?u=e67d908274f521d70bb5e4ff447575c47bbf9f3d&v=4
- Repositories: 36
- Last ynced at: 2024-04-17T21:08:03.574Z
- Profile URL: https://github.com/saaste
GitHub Events
Total
- Create event: 4
- Release event: 3
- Issues event: 2
- Watch event: 21
- Issue comment event: 2
- Push event: 5
- Pull request review event: 11
- Pull request review comment event: 11
- Pull request event: 5
- Fork event: 5
Last Year
- Create event: 4
- Release event: 3
- Issues event: 2
- Watch event: 21
- Issue comment event: 2
- Push event: 5
- Pull request review event: 11
- Pull request review comment event: 11
- Pull request event: 5
- Fork event: 5
Committers metadata
Last synced: 6 days ago
Total Commits: 69
Total Committers: 5
Avg Commits per committer: 13.8
Development Distribution Score (DDS): 0.072
Commits in past year: 13
Committers in past year: 3
Avg Commits per committer in past year: 4.333
Development Distribution Score (DDS) in past year: 0.231
Name | Commits | |
---|---|---|
Mika Hiltunen | m****a@h****o | 64 |
Cederic Nijssen | 6****N | 2 |
jaenis | s****n@h****m | 1 |
Dmitry Fursov | d****v@g****m | 1 |
Anand Radhakrishnan | 3****r | 1 |
Committer domains:
Issue and Pull Request metadata
Last synced: 2 days ago
Total issues: 12
Total pull requests: 55
Average time to close issues: 13 days
Average time to close pull requests: 6 days
Total issue authors: 8
Total pull request authors: 7
Average comments per issue: 1.08
Average comments per pull request: 0.36
Merged pull request: 52
Bot issues: 0
Bot pull requests: 2
Past year issues: 5
Past year pull requests: 10
Past year average time to close issues: about 13 hours
Past year average time to close pull requests: 2 days
Past year issue authors: 5
Past year pull request authors: 4
Past year average comments per issue: 1.8
Past year average comments per pull request: 0.4
Past year merged pull request: 9
Past year bot issues: 0
Past year bot pull requests: 1
Top Issue Authors
- paapu88 (4)
- saaste (2)
- tk-314 (1)
- kallere (1)
- T3m3z (1)
- jasunen (1)
- fursov (1)
- devjv (1)
Top Pull Request Authors
- saaste (47)
- dependabot[bot] (2)
- CedericN (2)
- anand-p-r (1)
- T3m3z (1)
- jaenis (1)
- fursov (1)
Top Issue Labels
- bug (1)
- dependencies (1)
Top Pull Request Labels
- dependencies (2)
Package metadata
- Total packages: 1
-
Total downloads:
- pypi: 5,428 last-month
- Total dependent packages: 0
- Total dependent repositories: 1
- Total versions: 24
- Total maintainers: 1
pypi.org: fmi-weather-client
Library for fetching weather information from Finnish Meteorological Institute (FMI)
- Homepage: https://github.com/saaste/fmi-weather-client
- Documentation: https://fmi-weather-client.readthedocs.io/
- Licenses: GNU General Public License v3 (GPLv3)
- Latest release: 0.6.0 (published 19 days ago)
- Last Synced: 2025-04-08T14:31:49.194Z (19 days ago)
- Versions: 24
- Dependent Packages: 0
- Dependent Repositories: 1
- Downloads: 5,428 Last month
-
Rankings:
- Downloads: 6.466%
- Dependent packages count: 10.038%
- Forks count: 12.549%
- Average: 13.554%
- Stargazers count: 17.061%
- Dependent repos count: 21.657%
- Maintainers (1)
Dependencies
- actions/checkout v2 composite
- actions/setup-python v2 composite
- coverage * development
- flake8 * development
- pylint * development
- pytest * development
- requests ==2.23.0
- xmltodict ==0.12.0
- requests >=2.23.0
- xmltodict >=0.12.0
Score: 13.674868228161808