Skip to main content

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).

Metadata

Release files for open-irceline 3.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for open-irceline 3.0.2
File Size Uploaded
open_irceline-3.0.2.tar.gz 19.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for open-irceline 3.0.2
File Interpreter ABI Platform
open_irceline-3.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 36.5 kB

Release files / open_irceline-3.0.2.tar.gz

Download URL open_irceline-3.0.2.tar.gz
Size 19.5 kB
Tags Source
SHA-256 checksum
How to use checksums
20d2defb1e6281f02f3afc436ad9229880abeb0c824f09646ea741e61af5bb1e
BLAKE2b-256 checksum
How to use checksums
fbcca43826fef92c371ab41fa02dc9fa8fbea514f168fdc59bd8cf5fa9a381eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release files / open_irceline-3.0.2-py3-none-any.whl

Download URL open_irceline-3.0.2-py3-none-any.whl
Size 16.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5ea22c5cab5c17d63c6d3b4f7f7b22b643d8d7d83dd84865cb4936896928f630
BLAKE2b-256 checksum
How to use checksums
fa07771d3c3001b0ebb8965ece168937f4e6ad4933b7e6565375a2ed52204b64
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release history Release notifications | RSS feed

This release

3.0.2 This release

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.0

2 release files

1.0.0

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page