Skip to main content

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-NSW1AU-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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bio_pype_carbon_intensity-0.1.0.tar.gz (31.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bio_pype_carbon_intensity-0.1.0-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file bio_pype_carbon_intensity-0.1.0.tar.gz.

File metadata

File hashes

Hashes for bio_pype_carbon_intensity-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a7c9505e419e567ae79468224798dd3a2d7c065c09d79b06bcfa5bf017166e5f
MD5 7d28054ba493b087aeea17eb5f19f669
BLAKE2b-256 dee5a5b192451fa39d0326be18ca16c9afb0e157ae46fbbfd258c58abc9ea068

See more details on using hashes here.

File details

Details for the file bio_pype_carbon_intensity-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for bio_pype_carbon_intensity-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a9f286d10d9519090d953fad73033a9d3fe7ecf1890a40e51071f695ec3aad5d
MD5 9e78311bae08912c22102846281c5587
BLAKE2b-256 417d5934602fc469015059cf4fd91129b3cb3b671606bd8819449cd37c9cc62a

See more details on using hashes here.

Supported by

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