package carbon

All checked builds pass
  1. Overview
  2. Docs
OCaml library for accessing various Carbon Intensity APIs

Install

dune-project
 Dependency

Authors

Maintainers

Sources

carbon-0.2.0.tbz
sha256=8d4e2f152d97aa02eff54919b05c7a61c317f0103fc634a0029c246482249e0b
sha512=6c1e04c2192e62b5f2137f6ba35afa6d261079cb17312e35cb881f657b79dfdf88380b02b6629db796dd007937ab5de9a1c868c6a8d31769efbd35412f987a3f

Description

Carbon provides access to various APIs to discover carbon intensity information for different countries.

Added to opam-repository:

README

carbon-intensity

Carbon Intensity is an OCaml client for querying various energy grid APIs to understand the energy generation mix. This enables programs like schedulers, energy monitors etc. to have a better understanding of their carbon intensity.

The API provides geographic-specific services, which allow you to exploit more fine-grained APIs and then a generic Intensity interface for a global-oriented API.

Integrated APIs

  • Great Britain:

    • https://www.carbonintensity.org.uk/
  • France:

    • https://www.rte-france.com/eco2mix
  • Misc:

    • https://www.co2signal.com (requires API key)

Usage

A very simple use of the region specific API for Great Britain only requires the user to provide Eio's network capability.

# Eio_main.run @@ fun env ->
  Mirage_crypto_rng_eio.run (module Mirage_crypto_rng.Fortuna) env @@ fun _ ->
  let gb = Carbon.Gb.v env#net in
  Carbon.Gb.get_intensity gb
  |> Eio.traceln "%a" Carbon.Gb.Intensity.pp;;
+period: 2024-11-25T21:00Z - 2024-11-25T21:30Z
+forecast: 99 gCO2/kWh
+actual: 92 gCO2/kWh
+index: low
+
- : unit = ()

Dependencies (8)

  1. uri
  2. tls-eio >= "1.0.4"
  3. ptime
  4. ezjsonm >= "1.2.0"
  5. cohttp-eio >= "6.0.0~beta2"
  6. ca-certs
  7. eio >= "1.1"
  8. dune >= "3.11"

Dev Dependencies (4)

  1. odoc with-doc
  2. eio_main with-test
  3. mdx with-test
  4. mirage-crypto-rng-eio with-test

Optional Dependencies

None

Used by

None

Conflicts

None

Build status

Results of building carbon with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
0.2.0 (this version) n/a n/a good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure