Skip to main content

Get IRCEL - CELINE air quality data 🍃 🇧🇪

Project description

Simple asynchronous Python client for IRCEL - CELINE open data

Work in progress

Python module to get data from the IRCEL - CELINE open data

Target features:

  • Get data for real time measurements interpolated
  • Get forecast data for PM10, PM2.5 and O3
  • Compute or fetch BelAQI index (observation and forecast)
  • Maybe: also provide data from the stations and not only interpolation

Install

The library is published on PyPI. Install it using pip

pip install open-irceline

Example of use

import aiohttp
import asyncio
from datetime import datetime
from open_irceline import IrcelineRioClient, IrcelineForecastClient, ForecastFeature, RioFeature


async def get_rio_interpolated_data():
    """Get current level of PM2.5 and PM10 at Brussels from the RIO interpolated data"""
    async with aiohttp.ClientSession() as session:
        client = IrcelineRioClient(session)
        result = await client.get_data(
            timestamp=datetime.utcnow(),  # must be timezone aware
            features=[RioFeature.PM25_HMEAN, RioFeature.PM10_HMEAN],
            position=(50.85, 4.35)  # (lat, lon) for Brussels
        )

    print(f"PM2.5  {result[RioFeature.PM25_HMEAN]['value']} µg/m³")
    print(f"PM10   {result[RioFeature.PM10_HMEAN]['value']} µg/m³")


async def get_o3_forecast():
    """Get forecast for O3 concentration for Brussels for the next days"""
    async with aiohttp.ClientSession() as session:
        client = IrcelineForecastClient(session)
        result = await client.get_data(
            features=[ForecastFeature.O3_MAXHMEAN],
            position=(50.85, 4.35)  # (lat, lon) for Brussels
        )

    for (feature, day), v in result.items():
        print(f"{feature} {day} {v['value']} µg/m³")


async def get_belaqi_forecast():
    """Get current BelAQI index from RIO interpolated values"""
    async with aiohttp.ClientSession() as session:
        client = IrcelineForecastClient(session)
        result = await client.get_data(
            features=[ForecastFeature.BELAQI],
            position=(50.85, 4.35)        # (lat, lon) for Brussels
        )

    for (_, day), value in result.items():
        print(day, value['value'])


if __name__ == '__main__':
    print("\nInterpolated data")
    asyncio.run(get_rio_interpolated_data())

    print("\nO3 forecast for Brussels")
    asyncio.run(get_o3_forecast())

    print("\nForecast BelAQI index")
    asyncio.run(get_belaqi_forecast())

Attribution

The data provided by this module is provided by the Belgian Interregional Environment Agency (IRCEL - CELINE). No change to the provided data is made. Their data is made available under the Creative Commons Attribution 4.0 license.

This work is not endorsed by the Belgian Interregional Environment Agency (IRCEL - CELINE).

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

open_irceline-3.0.1.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

open_irceline-3.0.1-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file open_irceline-3.0.1.tar.gz.

File metadata

  • Download URL: open_irceline-3.0.1.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.20

File hashes

Hashes for open_irceline-3.0.1.tar.gz
Algorithm Hash digest
SHA256 ac9b1f7e8a7be2fc56244b63a1d46f8d1587bc428c6561bdaf8125c554240247
MD5 d670a5c9716577ebadf7572b941b2671
BLAKE2b-256 99be1b31cd5a07d225feb33c54962e5df9f6f21e702d789b423b83982bb76d56

See more details on using hashes here.

File details

Details for the file open_irceline-3.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for open_irceline-3.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 9a57f5b67c51a839e87121e46ffae6b2f3a6362154416518c9adcf0541494d4b
MD5 1ca5b59244139265be29a9ce90871d7c
BLAKE2b-256 50d0498582e9d86b4b2290b8d59b797da1eb31c673a48dd875ed7c2932e6a20d

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