UKCarbonIntensityData
Documentation for UKCarbonIntensityData.
Retrieving Data
We can use this package to retrieve the recorded carbon intensity (measured in gCO₂/kWh) over a specified date range.
National data
using UKCarbonIntensityData
using Plots
using TimeZones
start_date = ZonedDateTime(2022, 01, 01, tz"UTC")
end_date = ZonedDateTime(2022, 02, 28, tz"UTC")
# get national level intensity data for the given period
national_data = get_carbon_intensity(start_date, end_date)
first(national_data, 5)
5 rows × 5 columns
from | to | forecast | actual | index | |
---|---|---|---|---|---|
DateTime | DateTime | Any | Any | Any | |
1 | 2021-12-31T23:30:00 | 2022-01-01T00:00:00 | 83 | 71 | low |
2 | 2022-01-01T00:00:00 | 2022-01-01T00:30:00 | 74 | 74 | low |
3 | 2022-01-01T00:30:00 | 2022-01-01T01:00:00 | 70 | 75 | low |
4 | 2022-01-01T01:00:00 | 2022-01-01T01:30:00 | 70 | 73 | low |
5 | 2022-01-01T01:30:00 | 2022-01-01T02:00:00 | 61 | 68 | low |
Regional data
We can also retrieve the forecasted carbon intensity at the regional level
regional_data = get_regional_data(start_date, end_date)
regional_intensity = regional_data.intensity;
regional_mix = regional_data.generation;
display(first(regional_mix))
Todays forecast
We can also grab the forecast data for the next 48 hours, at both national or regional levels.
national_data = get_todays_forecast()
first(national_data)
DataFrameRow (5 columns)
from | to | forecast | actual | index | |
---|---|---|---|---|---|
DateTime | DateTime | Any | Any | Any | |
1 | 2022-04-28T23:30:00 | 2022-04-29T00:00:00 | 268 | 273 | high |
regional_data = get_todays_forecast(regional = true)
first(regional_data)
DataFrameRow (8 columns)
from | to | shortname | dnoregion | regionid | generationmix | forecast | index | |
---|---|---|---|---|---|---|---|---|
DateTime | DateTime | Any | Any | Any | Any | Any | Any | |
1 | 2022-04-28T23:30:00 | 2022-04-29T00:00:00 | North Scotland | Scottish Hydro Electric Power Distribution | 1 | [Dict{String, Any}("fuel"=>"biomass", "perc"=>0), Dict{String, Any}("fuel"=>"coal", "perc"=>0), Dict{String, Any}("fuel"=>"imports", "perc"=>0), Dict{String, Any}("fuel"=>"gas", "perc"=>84.6), Dict{String, Any}("fuel"=>"nuclear", "perc"=>0), Dict{String, Any}("fuel"=>"other", "perc"=>0), Dict{String, Any}("fuel"=>"hydro", "perc"=>5.6), Dict{String, Any}("fuel"=>"solar", "perc"=>0), Dict{String, Any}("fuel"=>"wind", "perc"=>9.8)] | 333 | very high |
Plotting Data
This package also exports some recipes to plot the data. Below shows how we can retrieve the 48 hour forecast data, for the nation as a whole,
todays_plot()
or for a specific region
todays_plot(region = "South Scotland")
todays_plot(region = "North West England")
We can also view the recorded carbon intensity over a given time period
carbon_intensity(start_date, end_date)