The Grid Intensity CLI allows data to be sourced from several providers. Currently the following integrations are available:
If you would like us to integrate more providers please open an issue.
You can generate a list of all the available providers in the Grid Intensity CLI by running the grid-intensity provider list
command. This will generate a table output with the provider name, and related website URL.
grid-intensity provider list
NAME URL
CarbonIntensityOrgUK carbonintensity.org.uk
ElectricityMaps electricitymaps.com
Ember ember-climate.org
WattTime watttime.org
When running the Grid Intensity CLI, you can change providers by passing the --provider
flag, along with the name of the provider you want to use. Alternately, you can set GRID_INTENSITY_PROVIDER
as an environment variable.
When no provider is set, the CLI will use Ember as the default.
Ember is an energy think tank that uses data-driven insights to shift the world from coal to clean electricity.
--provider Ember
Ember is the default provider for the Grid Intensity CLI. The Ember integration returns regional data by country, for the last calendar year.
When using Ember, you will need to pass either an Alpha-2 or Alpha-3 ISO country code. You can do this using the --location
flag.
For example, the code below returns data for Taiwan.
grid-intensity --provider Ember --location TW
# Returns
[
{
"emissions_type": "average",
"metric_type": "absolute",
"provider": "Ember",
"location": "TW",
"units": "gCO2e per kWh",
"valid_from": "2021-01-01T00:00:00Z",
"valid_to": "2021-12-31T23:59:00Z",
"value": 565.629
}
]
WattTime is a nonprofit that offers technology solutions that make it easy for anyone to achieve emissions reductions without compromising cost, comfort, and function.
--provider WattTime
Before using the WattTime integration, you must first create a user account. This will allow you to access and use their API. Details on registering an account are available on the WattTime website.
Once you have created a WattTime account, you must set the WATT_TIME_USER
and WATT_TIME_PASSWORD
environment variables. This allows the Grid Intensity CLI to access the WattTime API.
export WATT_TIME_USER=your-username
export WATT_TIME_PASSWORD=your-password
When using WattTime, you will need to pass a location that is supported by the WattTime API. WattTime's API documentation details how you can get a list of locations, or use latitude & longitude to find a specific location.
For example, running the command below returns an array data for California Independent System Operator (North).
grid-intensity --provider WattTime --location CAISO_NORTH
# Returns
[
{
"emissions_type": "marginal",
"metric_type": "relative",
"provider": "WattTime",
"location": "CAISO_NORTH",
"units": "percent",
"valid_from": "2022-08-19T07:40:00Z",
"valid_to": "2022-08-19T07:45:00Z",
"value": 32
},
{
"emissions_type": "marginal",
"metric_type": "absolute",
"provider": "WattTime",
"location": "CAISO_NORTH",
"units": "lbCO2e per MWh",
"valid_from": "2022-08-19T07:40:00Z",
"valid_to": "2022-08-19T07:45:00Z",
"value": 918
}
]
Each location will return a percent
field. This value represents the relative real-time marginal emissions intensity for the past month.
If you require absolute Marginal Operating Emissions Rate (MOER) data, this is available for free when querying the CAISO_NORTH
location as shown above. However, you will require a WattTime Pro subscription to obtain this data for other locations.
The Electricity Maps API provides worldwide access to 24/7 grid carbon intensity historically, in real time, and as a forecast for the next 24 hours.
--provider ElectricityMaps
Before using the Electricity Maps integration, you must first obtain an API key. This will allow you to access and use their API. You can use their free tier for non-commercial use. You can also register for a 30 day trial of their paid API which includes their forecast data.
Once you have an Electricity Maps API key, you must set the ELECTRICITY_MAPS_API_TOKEN
and ELECTRICITY_MAPS_API_URL
environment variables. This allows the Grid Intensity CLI to access the Electricity Maps API.
export ELECTRICITY_MAPS_API_TOKEN=your-token
export ELECTRICITY_MAPS_API_URL=https://api-access.electricitymaps.com/free-tier/
When using Electricity Maps, you will need to pass a supported location. You can get a list of all supported locations using the Electricity Maps API.
For example, running the command below will return data for Portugal.
grid-intensity --provider ElectricityMaps --location PT
# Returns
[
{
"emissions_type": "average",
"metric_type": "absolute",
"provider": "ElectricityMaps",
"location": "PT",
"units": "gCO2e per kWh",
"valid_from": "2023-07-14T10:00:00Z",
"valid_to": "2023-07-14T11:00:00Z",
"value": 155
}
]
National Grid ESO have developed a Regional Carbon Intensity forecast for the Great Britain electricity grid.
--provider CarbonIntensityOrgUK
The UK Carbon Intensity API integration supports only one area, --location=UK
. This can be passed to the CLI as an optional parameter.
For example, the code below returns data for the UK.
grid-intensity --provider CarbonIntensityOrgUK --location UK
# Returns
[
{
"emissions_type": "average",
"metric_type": "absolute",
"provider": "CarbonIntensityOrgUK",
"location": "UK",
"units": "gCO2e per kWh",
"valid_from": "2022-08-19T07:00:00Z",
"valid_to": "2022-08-19T07:30:00Z",
"value": 201
}
]