Skip to content

Commit

Permalink
Fix inconsistencies in Arabias wind generation and capacity (#3323)
Browse files Browse the repository at this point in the history
  • Loading branch information
pabloarosado authored Sep 22, 2024
1 parent df0d729 commit 69abbe4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -630,30 +630,6 @@ def run(dest_dir: str) -> None:
(tb["country"] == "Saudi Arabia") & (tb["year"] >= 2000),
["hydro_consumption_equivalent_ej", "hydro_electricity_generation_twh"],
] = 0

# Wind generation (and consumption) for Saudi Arabia in 2022 and 2023 is possibly wrong.
# It goes from 0.005678 TWh in 2021 to 1.45 TWh in 2022 and 2023.
# According to IRENA, Saudi Arabia's wind capacity was 3MW in 2022:
# https://www.irena.org/Publications/2023/Jul/Renewable-energy-statistics-2023
# Either generation or capacity must be wrong.
# For now, first assert that the (possibly spurious) jump is in the data, and then remove those points.
error = "Data for Saudi Arabia may have changed (possibly fixing a data issue). Remove this part of the code."
assert (
tb[(tb["country"] == "Saudi Arabia") & (tb["year"] == 2021)]["wind_electricity_generation_twh"].item() < 0.006
), error
assert (
tb[(tb["country"] == "Saudi Arabia") & (tb["year"] == 2022)]["wind_electricity_generation_twh"].item() > 1.45
), error
assert (
tb[(tb["country"] == "Saudi Arabia") & (tb["year"] == 2021)]["wind_consumption_equivalent_ej"].item() < 0.00006
), error
assert (
tb[(tb["country"] == "Saudi Arabia") & (tb["year"] == 2022)]["wind_consumption_equivalent_ej"].item() > 0.01
), error
tb.loc[
(tb["country"] == "Saudi Arabia") & (tb["year"].isin([2022, 2023])),
["wind_consumption_equivalent_ej", "wind_electricity_generation_twh"],
] = None
####################################################################################################################

# Create additional variables, like primary energy consumption in TWh (both direct and in input-equivalents).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,23 @@ def run(dest_dir: str) -> None:
# For convenience, remove parentheses from column names.
tb = tb.rename(columns={column: column.replace("(", "").replace(")", "") for column in tb.columns}, errors="raise")

####################################################################################################################
# The latest Statistical Review reports a very high wind generation in Saudi Arabia in 2022.
# The reported value would be physically impossible, given the reported capacity from IRENA for 2022.
# However, IRENA has recently updated their data, reporting a much higher capacity for Arabia, of 403MW in 2022.
# https://www.irena.org/Publications/2024/Mar/Renewable-capacity-statistics-2024
# That would be consistent with the reported generation.
# For now, I will remove the old data point for 2022 (which was an estimate by IRENA).
# Next time capacity data is updated, the following assertion will fail, and we will remove this part of the code.
wind_columns = ["Onshore wind energy", "Wind energy"]
error = (
"IRENA's reported wind capacity for Saudi Arabia used to be 3MW (incompatible with generation reported by "
"the Statistical Review). This may have changed now. Remove this code."
)
assert tb.loc[(tb["country"] == "Saudi Arabia") & (tb["year"] == 2022), "Onshore wind energy"].item() == 3.25, error
tb.loc[(tb["country"] == "Saudi Arabia") & (tb["year"] == 2022), wind_columns] = None
####################################################################################################################

# Add region aggregates.
tb = geo.add_regions_to_table(
tb, regions=REGIONS, ds_regions=ds_regions, ds_income_groups=ds_income_groups, min_num_values_per_year=1
Expand Down

0 comments on commit 69abbe4

Please sign in to comment.