Skip to content

Commit

Permalink
validation data added
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorb1 committed Oct 14, 2024
1 parent 9360e76 commit c2e55f0
Show file tree
Hide file tree
Showing 7 changed files with 65,063 additions and 0 deletions.
196 changes: 196 additions & 0 deletions resources/data/validation/climatewatch.csv

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/data/validation/eia_capacity.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions resources/data/validation/eia_generation.json

Large diffs are not rendered by default.

32,259 changes: 32,259 additions & 0 deletions resources/data/validation/irena_capacity.csv

Large diffs are not rendered by default.

32,259 changes: 32,259 additions & 0 deletions resources/data/validation/irena_generation.csv

Large diffs are not rendered by default.

250 changes: 250 additions & 0 deletions resources/data/validation/iso.csv

Large diffs are not rendered by default.

97 changes: 97 additions & 0 deletions workflow/rules/validate.smk
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
"""Rules for validating historical results"""

###
# constants
###

# used for target rules
CAPACITY_VALIDATION = ["ember", "irena", "eia"]
GENERATION_VALIDATION = ["ember", "irena", "eia"]
EMISSION_VALIDATION = ["ember", "climatewatch"]

###
# capacity
###

def capacity_validation_data(wildcards):
if wildcards.datasource == "ember":
return "resources/data/ember_yearly_electricity_data.csv"
elif wildcards.datasource == "irena":
return "resources/data/validation/irena_capacity.csv"
elif wildcards.datasource == "eia":
return "resources/data/validation/eia_capacity.json"

def capacity_options(wildcards):
if wildcards.datasource == "irena":
return {"iso_codes": "resources/data/validation/iso.csv"}
else:
return []

rule validate_capacity:
message: "Validating capacity against {wildcards.datasource}"
input:
unpack(capacity_options),
validation_data = capacity_validation_data,
og_result = "results/{scenario}/results/TotalCapacityAnnual.csv",
params:
result_dir="results/{scenario}/results",
variable="capacity"
output:
expand("results/{{scenario}}/validation/{country}/capacity/{{datasource}}.png", country=COUNTRIES)
script:
"../scripts/osemosys_global/validation/main.py"

###
# generation
###

def generation_validation_data(wildcards):
if wildcards.datasource == "ember":
return "resources/data/ember_yearly_electricity_data.csv"
elif wildcards.datasource == "irena":
return "resources/data/validation/irena_generation.csv"
elif wildcards.datasource == "eia":
return "resources/data/validation/eia_generation.json"

def generation_options(wildcards):
if wildcards.datasource == "irena":
return {"iso_codes": "resources/data/validation/iso.csv"}
else:
return []

rule validate_generation:
message: "Validating generation against {wildcards.datasource}"
input:
unpack(generation_options),
validation_data = generation_validation_data,
og_result = "results/{scenario}/results/ProductionByTechnologyAnnual.csv",
params:
result_dir="results/{scenario}/results",
variable="generation"
output:
expand("results/{{scenario}}/validation/{country}/generation/{{datasource}}.png", country=COUNTRIES)
script:
"../scripts/osemosys_global/validation/main.py"

###
# emissions
###

def emission_validation_data(wildcards):
if wildcards.datasource == "ember":
return "resources/data/ember_yearly_electricity_data.csv"
elif wildcards.datasource == "climatewatch":
return "resources/data/validation/climatewatch.csv"

rule validate_emissions:
message: "Validating emissions against {wildcards.datasource}"
input:
validation_data = emission_validation_data,
og_result = "results/{scenario}/results/AnnualEmissions.csv"
params:
result_dir="results/{scenario}/results",
variable="emissions"
output:
expand("results/{{scenario}}/validation/{country}/emissions/{{datasource}}.png", country=COUNTRIES)
script:
"../scripts/osemosys_global/validation/main.py"

0 comments on commit c2e55f0

Please sign in to comment.