Skip to main content

Access to air quality data from the European Environment Agency.

Project description

aqeea

DOI

Access to air quality data from the European Environment Agency:

  • Data validated by experts from 2013 up to 2 years before the ongoing year.
  • up-to-date data without any validation.
  • the last 48h.

You can get the main pollutants (i.e NO, NO2, PM2.5, PM10, SO2, O3, CO,C6H6).

The packages aims at:

i) retrieving the datasets from EEA download sources.

ii) filtering the data of your choice once downloaded.

install from Pypi

pip install aqeea

install from source

mkdir tmp
cd /tmp
git clone https://github.com/j-m-l-e-u/aqeea_pkg.git
cd aqeea_pkg
pip3 install .

Usage

The package aqeea helps you first to download the datasets, and then to read and to filter them.

Downloading functions can be run both on python and bash.

Reading functions are only available in python.

For help:

python3 aqeea -h

usage: aqeea [-h] {l_pol,l_city,d_meta,d_hist,d_last} ...

Access to air quality data from the European Environment Agency.

positional arguments:
  {l_pol,l_city,d_meta,d_hist,d_last}
                        sub-command help
    l_pol               Get the list of pollutants measured in the country
    l_city              Get the list of the cities with measurements in the country
    d_meta              Download the metadata of the reference stations
    d_hist              Download historical data up to 2013
    d_last              Download the last 48h non-validated data

optional arguments:
  -h, --help            show this help message and exit

Download the data of your choice:

Downloading can be done either in bash command or in python command.

All the files are saved in a folder (called blob). Bash command requires the path of the blob to be given. Python command gets a default path if this one is missing.

You need to download the metadata and the files from the sources of interest before reading the files.

> The metadata

#bash
python3 aqeea d_metadata -b "/path/to/existing/folder"
#python
from aqeea.download import d_metadata
d_metadata()

> Validated PM10 data for year 2021 in France

#bash
python3 aqeea d_historical -s validated -c France -p PM10 -yf 2021 -yt 2021 -b "/path/to/existing/folder"
#python
from aqeea.download import d_historical
d_historical(source='validated',country='France',pollutant='PM10',year_from=2021,year_to=2021)

> Validated data of all the pollutants for the whole period in Albania

#bash
python3 aqeea d_historical -s validated -c Albania --pollutants --years -b "/path/to/existing/folder"
#python
from aqeea.download import d_historical
d_historical(source='validated',country='Albania',POLLUTANTS=True,YEARS=True)

> Up-to-date PM10 data for year 2023 in Estonia

#bash
python3 aqeea d_historical -s uptodate -c Estonia -p PM10 -yf 2023 -yt 2023 -b "/path/to/existing/folder"
#python
from aqeea.download import d_historical
d_historical(source='uptodate',country='Estonia',pollutant='PM10',year_from=2023,year_to=2023)

> Up-to-date data of all the pollutants for the whole period in Slovenia

#bash
python3 aqeea d_historical -s uptodate -c Slovenia --pollutants --years -b "/path/to/existing/folder"
#python
from aqeea.download import d_historical
d_historical(source='uptodate',country='Slovenia',POLLUTANTS=True,YEARS=True)

> Latest 48h of PM10 in Serbia

#bash
python3 aqeea d_latest -c Serbia -p PM10 -b "/path/to/existing/folder"
#python
from aqeea.download import d_latest
d_latest('Serbia','PM10')

> Latest 48h of PM10 in all countries registered at EEA

#bash
python3 aqeea d_latest -p PM10 --countries -b "/path/to/existing/folder"
#python
from aqeea.download import d_latest
d_latest('PM10',COUNTRIES=True)

> Latest 48h dataset of all the pollutants in Poland

#bash
python3 aqeea d_latest -c Poland --pollutants -b "/path/to/existing/folder"
#python
from aqeea.download import d_latest
d_latest('Poland',POLLUTANTS=True)

> Latest 48h dataset of all the pollutants in all countries registered at EEA

#bash
python3 aqeea d_latest --countries --pollutants -b "/path/to/existing/folder"
#python
from aqeea.download import d_latest
d_latest(COUNTRIES=True, POLLUTANTS=True)

Read and filter the downloaded datasets:

The chosen sampling points providing the measurements are filtered by their measurement date and the lat/lon's of the boundary box of your choice. Open-street Map through the package osmnx helps you getting this information.

To install osmnx, just type:

#bash
pip install osmnx

> Get the validated PM10 data in Paris, France from 2021-01-01 00:00:00 UTC to 2021-01-01 12:00:00 UTC

#python
import osmnx as ox
from aqeea.read import historical

# define the place query
query = {'city': 'Paris'}

# get the boundaries of the place
gdf = ox.geocode_to_gdf(query)
bbox = gdf.total_bounds

lat_min, lat_max = bbox[1],bbox[3]
lon_min, lon_max = bbox[0],bbox[2]

res = historical(source='validated',pollutant='PM10',datetime_from='2021-01-01 00:00:00',datetime_to='2021-01-01 12:00:00',lat_min=lat_min, lat_max=lat_max,lon_min=lon_min, lon_max=lon_max)

> Get the up-to-date PM10 data in Tallinn, Estonia from 2023-01-01 00:00:00 UTC to 2023-01-12 00:00:00 UTC

#python
import osmnx as ox
from aqeea.read import historical

# define the place query
query = {'city': 'Tallinn'}

# get the boundaries of the place
gdf = ox.geocode_to_gdf(query)
bbox = gdf.total_bounds

lat_min, lat_max = bbox[1],bbox[3]
lon_min, lon_max = bbox[0],bbox[2]

res = historical(source='uptodate',pollutant='PM10',datetime_from='2023-01-01 00:00:00',datetime_to='2023-01-12 00:00:00',lat_min=lat_min, lat_max=lat_max,lon_min=lon_min, lon_max=lon_max)

> Get the last 48h PM10 data in Paris,France

#python
from aqeea.read import main_read_latest
res = latest(pollutant='PM10',lat_min=48.8155755, lat_max=48.902156,lon_min=2.224122, lon_max=2.4697602)

> Get the metadata of PM10 concentration in Paris,France

#python
from aqeea.read import main_read_metadata
res = metadata(pollutant='PM10',lat_min=48.8155755, lat_max=48.902156,lon_min=2.224122, lon_max=2.4697602)

Notebook examples

See folder examples

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

aqeea-0.1b0.tar.gz (23.4 kB view details)

Uploaded Source

Built Distribution

aqeea-0.1b0-py3-none-any.whl (22.7 kB view details)

Uploaded Python 3

File details

Details for the file aqeea-0.1b0.tar.gz.

File metadata

  • Download URL: aqeea-0.1b0.tar.gz
  • Upload date:
  • Size: 23.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for aqeea-0.1b0.tar.gz
Algorithm Hash digest
SHA256 74f40083675d96a09729a9eb4690c7b635e56eb909dbfb78a885ffef43d7c62c
MD5 074d3f6e1b4219e74503c0b9ccca197b
BLAKE2b-256 ad84ef6d3f587e547f1a8d404ca731d787ed45aabeeb2aa48928edf38c9cf6c0

See more details on using hashes here.

File details

Details for the file aqeea-0.1b0-py3-none-any.whl.

File metadata

  • Download URL: aqeea-0.1b0-py3-none-any.whl
  • Upload date:
  • Size: 22.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.16

File hashes

Hashes for aqeea-0.1b0-py3-none-any.whl
Algorithm Hash digest
SHA256 1ecee91e5c1e05adf89c2b7a6707aab2f9b63b502b9759394a66d8301e6164db
MD5 ea11d42821fb5ae999f76bace6a4091a
BLAKE2b-256 97b9502870e36c201c678f8b78174df149a49d120d37759419832bfa72bd96de

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page