KNMI-py
Python wrapper to fetch and parse daily and hourly weather observations from KNMI, either as raw text, CSV-like strings, or Pandas DataFrames.
See the official KNMI documentation for more details on data retrieval via scripts: KNMI Kennis- en datacentrum - Data ophalen vanuit een script
Note: This library is not affiliated in any way with KNMI; it only utilizes the KNMI API to request data.
Installation
KNMI-py is available via pip:
python -m pip install knmi-py
Key Functions
The library provides functions to retrieve both daily and hourly weather data:
knmi.get_day_data_raw(stations, start, end, inseason, variables)knmi.get_day_data_dataframe(stations, start, end, inseason, variables)knmi.get_hour_data_raw(stations, start, end, inseason, variables)knmi.get_hour_data_dataframe(stations, start, end, inseason, variables)knmi.get_forecast_dataframe(station, conform_values, variables)(Limited to De Bilt, station 260)
Metadata
Need to find a station number or understand what the weather variable abbreviations mean?
knmi.stations: A dictionary of all available KNMI weather stations.knmi.variables: A dictionary providing explanations for weather variable codes.
Example Usage
import knmi
import pandas as pd
# Get daily data for De Bilt (station 260) for a specific period
daily_df = knmi.get_day_data_dataframe(
stations=,
start='2023-01-01',
end='2023-01-31'
)
print("Daily Data:")
print(daily_df.head())
# Get hourly data for Schiphol (station 240) for a specific day
# Note: start and end for hourly data are strings like "YYYYMMDDHH"
hourly_df = knmi.get_hour_data_dataframe(
stations=,
start="2023032801", # March 28, 2023, 01:00
end="2023032824" # March 28, 2023, 24:00
)
print("\nHourly Data:")
print(hourly_df.head())
Disclaimer
The KNMI-py Python library is not affiliated with, created by, or maintained by KNMI. It merely uses the publicly available KNMI API to request data.
Contributing & Development
Contributions are welcome! Please feel free to open an issue or submit a pull request.
This project uses modern Python development tools:
- Packaging:
pyproject.toml(withhatchlingas the build backend). - Dependency Management & Task Running:
uvis used for fast dependency management. - Linting & Formatting:
Ruff(configured viapyproject.tomlorruff.toml). - Pre-commit Hooks: Used to ensure code quality and consistency before commits.
- Testing:
pytestfor running tests. - Multi-version Testing:
tox(withtox-uv) is used to ensure compatibility across multiple Python versions (currently Python 3.9+). Runtoxto execute tests in all configured environments.
Please ensure pre-commit hooks pass and tests succeed before submitting a pull request.
Metadata
Release files for knmi-py 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| knmi_py-0.2.0.tar.gz | 107.6 kB | Without provenance | Details for knmi_py-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| knmi_py-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for knmi_py-0.2.0-py3-none-any.whl |
Total release size: 118.2 kB
Release files / knmi_py-0.2.0.tar.gz
| Download URL | knmi_py-0.2.0.tar.gz |
|---|---|
| Size | 107.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c659e634dfddf30df369a26e9273b74c3eaedf2043d16eee499687ed0293deb6
|
|
BLAKE2b-256 checksum How to use checksums |
984b624f1690239a8a8bf4588f6bece506929ad2d85e9a199bf46cd08f461d80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.7.3
|
Release files / knmi_py-0.2.0-py3-none-any.whl
| Download URL | knmi_py-0.2.0-py3-none-any.whl |
|---|---|
| Size | 10.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
302994b23c683b6174b077c92d29d793e4eaa16df7a21c2272f2900f53fb15c8
|
|
BLAKE2b-256 checksum How to use checksums |
11d48ab31ec7ad87bc9c38727aad07eae7a9aefa7e64c869aa432ebe0959db1d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.7.3
|
Security for knmi-py 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.