Grid carbon intensity (gCO2eq/kWh), current + forecast, from free public APIs: ENTSO-E (EU, flow-traced), carbonintensity.org.uk (GB), OpenElectricity + AEMO pre-dispatch (AU)
Project description
bio-pype-carbon-intensity
Grid carbon intensity (gCO2eq/kWh); current values and forecasts from
free public APIs. Built for compute.bio /
bio-pype but usable standalone; the Python
import name is carbon_intensity. Not affiliated with carbonintensity.org.uk
or any of the upstream data providers. This package just organises their
great public data. MIT licensed.
| Zones | Source | Forecast | Notes |
|---|---|---|---|
EU bidding zones (FR, DE_LU, …) |
ENTSO-E Transparency (key required) | ✓ | consumption-based via iterative flow tracing |
GB + 17 DNO regions (GB-LONDON, …) |
carbonintensity.org.uk (no key) | ✓ 48h | precomputed by NG ESO; also pinned into the EU solve |
AU-NSW1 … AU-VIC1, AU-WEM |
OpenElectricity (free key) + AEMO NEMWEB (no key) | ✓ ~40h (NEM), climatology (WEM) | production-based |
| anything else | Electricity Maps (personal key) / compute.bio backend | ✓ / – | escape hatch |
The core package has no dependencies (stdlib only). The multi-zone
backend bulk path needs the backend extra:
pip install bio-pype-carbon-intensity # worker / single-zone use
pip install bio-pype-carbon-intensity[backend] # bulk window fetch + EU flow tracing
Usage
from carbon_intensity import get_current, get_forecast, run_window
rec = get_current("GB-LONDON") # one or two HTTP calls
print(rec.intensity_g_per_kwh, rec.kind)
for slot in get_forecast("AU-NSW1"): # AEMO pre-dispatch, ~40h ahead
print(slot.start, slot.intensity_g_per_kwh, slot.extra["method"])
# backend bulk (needs [backend] extra for EU zones):
import datetime as dt
now = dt.datetime.now(dt.timezone.utc)
results = run_window(["FR", "BE", "GB", "AU-NSW1"], now - dt.timedelta(hours=4),
now + dt.timedelta(hours=24))
API keys via env vars: ENTSOE_API_KEY, OPENELECTRICITY_API_KEY,
ELECTRICITY_MAPS_API_KEY, COMPUTE_BIO_API_URL/COMPUTE_BIO_TOKEN — or
pass a ProviderConfig explicitly.
Method caveat for EU zones: get_current() / get_forecast() on an
ENTSO-E zone return production intensity (single-zone fast path, labeled
extra["method"] = "production_only") — they do not account for
imports/exports. Consumption intensity for EU zones requires the flow-traced
run_window() (or the compute_bio provider, which serves a backend's
flow-traced value). Don't compare fast-path numbers against consumption-based
sources such as Electricity Maps.
Forecast caveats: WEM (Western Australia) uses a 7-day hour-of-day
climatology, not a physical forecast; NEM forecasts assume the current
thermal mix holds. The method is labeled in each record's extra["method"].
Run the test suite: python tests/smoke.py (live UK checks need network;
ENTSO-E/AU live checks run when keys are set).
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bio_pype_carbon_intensity-0.1.0.tar.gz.
File metadata
- Download URL: bio_pype_carbon_intensity-0.1.0.tar.gz
- Upload date:
- Size: 31.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a7c9505e419e567ae79468224798dd3a2d7c065c09d79b06bcfa5bf017166e5f
|
|
| MD5 |
7d28054ba493b087aeea17eb5f19f669
|
|
| BLAKE2b-256 |
dee5a5b192451fa39d0326be18ca16c9afb0e157ae46fbbfd258c58abc9ea068
|
File details
Details for the file bio_pype_carbon_intensity-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bio_pype_carbon_intensity-0.1.0-py3-none-any.whl
- Upload date:
- Size: 39.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9f286d10d9519090d953fad73033a9d3fe7ecf1890a40e51071f695ec3aad5d
|
|
| MD5 |
9e78311bae08912c22102846281c5587
|
|
| BLAKE2b-256 |
417d5934602fc469015059cf4fd91129b3cb3b671606bd8819449cd37c9cc62a
|