🌬 AirBase
An easy downloader for air quality data provided by the European Environment Agency (EEA).
The data is available for download at the portal, but the interface makes it a bit time consuming to do bulk downloads. Hence, an easy Python-based interface.
Read the full documentation at https://airbase.readthedocs.io.
🔌 Installation
To install airbase, simply run
$ pip install airbase
🚀 Getting Started
🗺 Get info about available countries and pollutants:
>>> import airbase
>>> client = airbase.AirbaseClient()
>>> client.countries
frozenset({'LI', 'CY', 'IE', 'LV', 'BE', 'EE', ...})
>>> client.pollutants
frozenset({'Co', 'sum-PCB', 'PCB-26', 'HNO3', ...})
>>> client.search_pollutant("O3")
[{'poll': 'O3', 'id': 7}, {'poll': 'NO3', 'id': 46}, ...]
🗂 Request download links from the server and save the resulting Parquet files into a directory:
>>> r = client.request("Verified", "NL", "DE", poll=["NO3", "NO3- in PM2.5", "NO3- in PM10"])
>>> r.download(dir="data", skip_existing=True)
summary : 100%|█████| 2/2 [00:00<00:00, 4.48requests/s]
URLs : 100%|█████| 29.0/29.0 [00:00<00:00, 490URL/s]
download: 386kb [00:00, 570kb/s]
📦 Download the entire dataset (not for the faint of heart):
>>> r = client.request()
>>> r.download_to_directory("data")
summary : 100%|█████| 39/39 [00:15<00:00, 2.54requests/s]
URLs : 100%|█████| 47.0k/47.0k [00:00<00:00, 77.7kURL/s]
download: 20.6Gb [54:36, 6.74Mb/s]
🌡 Don't forget to get the metadata about the measurement stations:
>>> client.download_metadata("data/metadata.csv")
Writing metadata to data/metadata.csv...
🚆 Command line interface
Air quality data in in CSV format
$ airbase download --help
Usage: airbase download [OPTIONS]
Air quality data in in CSV format. **End of life 2024**.
The service providing air quality data in CSV format will cease operations by the end of 2024.
Until then it will provide only **unverified** data (E2a) for 2024.
Use -c/--country and -p/--pollutant to restrict the download specific countries and pollutants, e.g.
- download only Norwegian, Danish and Finish sites
airbase download -c NO -c DK -c FI
- download only SO2, PM10 and PM2.5 observations
airbase download -p SO2 -p PM10 -p PM2.5
Use -C/--city to further restrict the download to specific cities, e.g.
- download only PM10 and PM2.5 from Valletta, the Capital of Malta
airbase download -C Valletta -c MT -p PM10 -p PM2.5
Options:
-c, --country [AD|AL|AT|...]
-p, --pollutant [k|V|TI|...]
-C, --city TEXT only from selected <cities>
-M, --metadata download station metadata
--path PATH [default: data]
--year INTEGER RANGE The service providing air quality data in CSV format will cease operations by the end of 2024.
Until then it will provide only **unverified** data (E2a) for 2024. [default: 2024; 2024<=x<=2024]
-O, --overwrite Re-download existing files.
-q, --quiet No progress-bar.
--help Show this message and exit.
Historical data delivered between 2002 and 2012
$ airbase historical --help
Usage: airbase historical [OPTIONS]
Historical Airbase data delivered between 2002 and 2012 before Air Quality
Directive 2008/50/EC entered into force.
Use -c/--country and -p/--pollutant to restrict the download specific countries and pollutants, e.g.
- download only Norwegian, Danish and Finish sites
airbase download -c NO -c DK -c FI
- download only SO2, PM10 and PM2.5 observations
airbase download -p SO2 -p PM10 -p PM2.5
Use -C/--city to further restrict the download to specific cities, e.g.
- download only PM10 and PM2.5 from Valletta, the Capital of Malta
airbase download -C Valletta -c MT -p PM10 -p PM2.5
Options:
-c, --country [AD|AL|AT|...]
-p, --pollutant [k|V|NT|...]
-C, --city TEXT only from selected <cities>
-F, --aggregation-type, --frequency [hourly|daily|other]
only hourly data, daily data or other
aggregation frequency
-M, --metadata download station metadata
--path PATH [default: data/historical]
-n, --dry-run, --summary Total download files/size, nothing will be
downloaded.
-O, --overwrite Re-download existing files.
-q, --quiet No progress-bar.
--help Show this message and exit.
Verified data from 2013 to 2023
$ airbase verified --help
Usage: airbase verified [OPTIONS]
Verified data (E1a) from 2013 to 2023 reported by countries by 30 September
each year for the previous year.
Use -c/--country and -p/--pollutant to restrict the download specific countries and pollutants, e.g.
- download only Norwegian, Danish and Finish sites
airbase download -c NO -c DK -c FI
- download only SO2, PM10 and PM2.5 observations
airbase download -p SO2 -p PM10 -p PM2.5
Use -C/--city to further restrict the download to specific cities, e.g.
- download only PM10 and PM2.5 from Valletta, the Capital of Malta
airbase download -C Valletta -c MT -p PM10 -p PM2.5
Options:
-c, --country [AD|AL|AT|...]
-p, --pollutant [k|V|NT|...]
-C, --city TEXT only from selected <cities>
-F, --aggregation-type, --frequency [hourly|daily|other]
only hourly data, daily data or other
aggregation frequency
-M, --metadata download station metadata
--path PATH [default: data/verified]
-n, --dry-run, --summary Total download files/size, nothing will be
downloaded.
-O, --overwrite Re-download existing files.
-q, --quiet No progress-bar.
--help Show this message and exit.
Unverified data from the beginning of 2024
$ airbase unverified --help
Usage: airbase unverified [OPTIONS]
Unverified data transmitted continuously (Up-To-Date/UTD/E2a) data from the
beginning of 2024.
Use -c/--country and -p/--pollutant to restrict the download specific countries and pollutants, e.g.
- download only Norwegian, Danish and Finish sites
airbase download -c NO -c DK -c FI
- download only SO2, PM10 and PM2.5 observations
airbase download -p SO2 -p PM10 -p PM2.5
Use -C/--city to further restrict the download to specific cities, e.g.
- download only PM10 and PM2.5 from Valletta, the Capital of Malta
airbase download -C Valletta -c MT -p PM10 -p PM2.5
Options:
-c, --country [AD|AL|AT|...]
-p, --pollutant [k|V|NT|...]
-C, --city TEXT only from selected <cities>
-F, --aggregation-type, --frequency [hourly|daily|other]
only hourly data, daily data or other
aggregation frequency
-M, --metadata download station metadata
--path PATH [default: data/unverified]
-n, --dry-run, --summary Total download files/size, nothing will be
downloaded.
-O, --overwrite Re-download existing files.
-q, --quiet No progress-bar.
--help Show this message and exit.
🛣 Roadmap
Parallel CSV downloadsContributed by @avaldebeCLI to avoid using Python all togetherContributed by @avaldebe- Data wrangling module for AirBase output data
Metadata
Release files for airbase 1.0.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 |
|---|---|---|---|---|
| airbase-1.0.0.tar.gz | 1.2 MB | Without provenance | Details for airbase-1.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| airbase-1.0.0-py3-none-any.whl | Python 3 | none | any | Details for airbase-1.0.0-py3-none-any.whl |
Total release size: 1.3 MB
Release files / airbase-1.0.0.tar.gz
| Download URL | airbase-1.0.0.tar.gz |
|---|---|
| Size | 1.2 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fbcf7ebfee4b4351353c24bafd9713c48fe7700f2244f2a24edc72db7d9c2cde
|
|
BLAKE2b-256 checksum How to use checksums |
a92a50c6cd4c224c7e8206a706ec53128587d890020af8703844febebc29f799
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Release files / airbase-1.0.0-py3-none-any.whl
| Download URL | airbase-1.0.0-py3-none-any.whl |
|---|---|
| Size | 64.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
65be400349c168782a3da96b97c22ef021be7bfd1afb7017e4a0e96954818e5b
|
|
BLAKE2b-256 checksum How to use checksums |
4b5eab0fa0993d20cf691955207993b1a774c4a5368e378e832e76e9dea403de
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.7
|
Security for airbase 1.0.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.