SS 2025
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
# ----------------------------------------------------- #
|
||||
# Calculate Energy and Analysis Workflow #
|
||||
# ----------------------------------------------------- #
|
||||
|
||||
|
||||
# Processes photovoltaic and solar datasets to calculate and calculate yearly energy
|
||||
rule calculate_theoretical_energy:
|
||||
input:
|
||||
area = f"{RESULTS}/solarparcs_area.txt",
|
||||
sunshine_duration = f"{RESULTS}/sunshine_duration.csv"
|
||||
output:
|
||||
f"{RESULTS}/solarparcs_energy.csv"
|
||||
shell:
|
||||
f"{PYTHON} {SRC}/calculate_energy.py {{input.area}} {{input.sunshine_duration}} {{output}} {EFFICIENCY}"
|
||||
|
||||
|
||||
# Sums each row across all columns of the solaparc data and writes the result as a single-column file
|
||||
rule collapse_columns_theoretical_energy:
|
||||
input:
|
||||
f"{RESULTS}/solarparcs_energy.csv"
|
||||
output:
|
||||
f"{RESULTS}/solarparcs_energy_yearly.csv"
|
||||
params:
|
||||
column_name = "Energy [kWh]"
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/collapse_columns.py {{input}} {{output}} "{{params.column_name}}"'
|
||||
|
||||
|
||||
# trim rows from the beginning and end of the solarparc CSV file and save the result
|
||||
rule trim_theoretical_energy:
|
||||
input:
|
||||
f"{RESULTS}/solarparcs_energy_yearly.csv"
|
||||
output:
|
||||
f"{RESULTS}/solarparcs_energy_yearly_trimmed.csv"
|
||||
params:
|
||||
arg1 = "67",
|
||||
arg2 = "0"
|
||||
shell:
|
||||
f"{PYTHON} {SRC}/trim.py {{input}} {{output}} {{params.arg1}} {{params.arg2}}"
|
||||
|
||||
|
||||
# plots the yearly changes of solarparc energy
|
||||
rule plot_yearly_energy_change:
|
||||
input:
|
||||
f"{RESULTS}/solarparcs_energy_yearly_trimmed.csv"
|
||||
output:
|
||||
f"{REPORT}/solarparcs_energy_yearly_trimmed.png"
|
||||
params:
|
||||
title = "Theoretical Energy 2018-2024",
|
||||
year_filter=None
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/plot_change.py {{input}} {{output}} "{{params.title}}" {{params.year_filter}}'
|
||||
|
||||
|
||||
# plots the yearly changes of phtovoltaic energy
|
||||
rule plot_yearly_change_photovoltaic:
|
||||
input:
|
||||
f"{RESULTS}/pv_data_cleaned_trimmed_collapsed.csv"
|
||||
output:
|
||||
f"{REPORT}/pv_data_cleaned_trimmed_collapsed.png"
|
||||
params:
|
||||
title = "Photovoltaic",
|
||||
year_filter=None
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/plot_change.py {{input}} {{output}} "{{params.title}}" {{params.year_filter}}'
|
||||
|
||||
|
||||
# Calculates and compares yearly energy sums from actual and theoretical solar data
|
||||
rule calculate_difference:
|
||||
input:
|
||||
actual = f"{RESULTS}/pv_data_cleaned_trimmed_collapsed.csv",
|
||||
theoretical = f"{RESULTS}/solarparcs_energy_yearly_trimmed.csv"
|
||||
output:
|
||||
f"{RESULTS}/energy_difference.csv"
|
||||
shell:
|
||||
f"{PYTHON} {SRC}/calculate_difference.py {{input.actual}} {{input.theoretical}} {{output}}"
|
||||
|
||||
|
||||
# plots the monthly change of photovoltaic energy
|
||||
rule plot_monthly_change_photovoltaic:
|
||||
input:
|
||||
f"{RESULTS}/pv_data_cleaned.csv"
|
||||
output:
|
||||
f"{REPORT}/pv_monthly_change_{YEAR}.png"
|
||||
params:
|
||||
title = "'Monthly Change Photovoltaic'",
|
||||
year_filter={YEAR}
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/plot_change.py {{input}} {{output}} "{{params.title}}" "{{params.year_filter}}"'
|
||||
|
||||
|
||||
# Plots yearly differences between actual and theoretical photovoltaic energy
|
||||
rule plot_energy difference:
|
||||
input:
|
||||
f"{RESULTS}/energy_difference.csv"
|
||||
output:
|
||||
f"{REPORT}/energy_difference.png"
|
||||
params:
|
||||
title = "Yearly Energy Difference: Actual – Theoretical (kWh)",
|
||||
year_filter=None
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/plot_change.py {{input}} {{output}} "{{params.title}}" {{params.year_filter}}'
|
||||
@@ -0,0 +1,41 @@
|
||||
# ----------------------------------------------------- #
|
||||
# Processing of Photovoltaic Data Workflow #
|
||||
# ----------------------------------------------------- #
|
||||
|
||||
|
||||
|
||||
# Processes and cleans the photovoltaic CSV dataset, then extracts specific data types "Electricity feed-in systems"
|
||||
rule load_and_clean_photovoltaic_data:
|
||||
input:
|
||||
csv_in = f"{DATA}/pv_data.csv"
|
||||
output:
|
||||
csv_out = f"{RESULTS}/pv_data_cleaned.csv"
|
||||
params:
|
||||
label = "Electricity feed-in"
|
||||
shell:
|
||||
r'"{PYTHON}" "{SRC}/clean_pv_data.py" "{input.csv_in}" "{output.csv_out}" "{params.label}"'
|
||||
|
||||
|
||||
# trim rows from the beginning and end of the photovoltaic CSV file and save the result
|
||||
rule trim_photovoltaic:
|
||||
input:
|
||||
f"{RESULTS}/pv_data_cleaned.csv"
|
||||
output:
|
||||
f"{RESULTS}/pv_data_cleaned_trimmed.csv"
|
||||
params:
|
||||
arg1 = "0",
|
||||
arg2 = "1"
|
||||
shell:
|
||||
f"{PYTHON} {SRC}/trim.py {{input}} {{output}} {{params.arg1}} {{params.arg2}}"
|
||||
|
||||
|
||||
# Sums each row across all columns of the photovoltaic data and writes the result as a single-column file
|
||||
rule collapse_columns_photovoltaic:
|
||||
input:
|
||||
csv_in = f"{RESULTS}/pv_data_cleaned_trimmed.csv"
|
||||
output:
|
||||
csv_out = f"{RESULTS}/pv_data_cleaned_trimmed_collapsed.csv"
|
||||
params:
|
||||
column_name = "Energy [kWh]"
|
||||
shell:
|
||||
f'{PYTHON} "{SRC}/collapse_columns.py" "{{input.csv_in}}" "{{output.csv_out}}" "{{params.column_name}}"'
|
||||
@@ -0,0 +1,35 @@
|
||||
# ----------------------------------------------------- #
|
||||
# Processing of Solarparc Data Workflow #
|
||||
# ----------------------------------------------------- #
|
||||
|
||||
|
||||
# performs spatial clipping of Geopackages using GeoPandas
|
||||
rule load_solarparc_and_border_data:
|
||||
input:
|
||||
solarparcs = f"{DATA}/solarparcs.gpkg",
|
||||
germany = f"{DATA}/germany.gpkg"
|
||||
output:
|
||||
f"{RESULTS}/solarparcs_clipped.gpkg"
|
||||
shell:
|
||||
f"{PYTHON} {SRC}/clip.py {{input.solarparcs}} {{input.germany}} {{output}}"
|
||||
|
||||
|
||||
# Reads geographic data, plots it on a base map, and saves the visualization as an image
|
||||
rule plot_solarparc_map:
|
||||
input:
|
||||
clipped = f"{RESULTS}/solarparcs_clipped.gpkg",
|
||||
germany = f"{DATA}/germany.gpkg"
|
||||
output:
|
||||
f"{REPORT}/solarparcs.png"
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/plot_geo.py {{input.clipped}} {{input.germany}} {{output}} "Solarparcs in Germany 2025"'
|
||||
|
||||
|
||||
# Calculate and compare yearly energy sums from actual and theoretical solar data
|
||||
rule calculate_area:
|
||||
input:
|
||||
f"{RESULTS}/solarparcs_clipped.gpkg"
|
||||
output:
|
||||
f"{RESULTS}/solarparcs_area.txt"
|
||||
shell:
|
||||
f"{PYTHON} {SRC}/polygons2area.py {{input}} {{output}} m"
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
# ----------------------------------------------------- #
|
||||
# Processing of Sunshine Duration Data Workflow #
|
||||
# ----------------------------------------------------- #
|
||||
|
||||
|
||||
# Downloads all files from a URL to a local directory
|
||||
rule load_sunshine_duration_data:
|
||||
output:
|
||||
directory(f"{RESULTS}/{SUNSHINE_DATA}/")
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/wgetdir.py "https://opendata.dwd.de/climate_environment/CDC/regional_averages_DE/monthly/sunshine_duration/" {{output}}'
|
||||
|
||||
|
||||
# Combines twelve CSV files from a directory by selecting German averages into one dataframe
|
||||
rule merge_series:
|
||||
input:
|
||||
f"{RESULTS}/{SUNSHINE_DATA}/"
|
||||
output:
|
||||
f"{RESULTS}/sunshine_duration.csv"
|
||||
shell:
|
||||
f"{PYTHON} {SRC}/merge_series.py {{input}} {{output}}"
|
||||
|
||||
|
||||
# Sums each row across all columns of the sunshiine duration data and write the result as a single-column file
|
||||
rule collapse_columns_sunshine_duration:
|
||||
input:
|
||||
f"{RESULTS}/sunshine_duration.csv"
|
||||
output:
|
||||
f"{RESULTS}/sunshine_duration_yearly.csv"
|
||||
params:
|
||||
column_name = "Duration [h]"
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/collapse_columns.py {{input}} {{output}} "{{params.column_name}}"'
|
||||
|
||||
|
||||
# trim rows from the beginning and end of the solarparc CSV file and save the result
|
||||
rule trim_sunshine_duration:
|
||||
input:
|
||||
f"{RESULTS}/sunshine_duration_yearly.csv"
|
||||
output:
|
||||
f"{RESULTS}/sunshine_duration_yearly_trimmed.csv"
|
||||
params:
|
||||
arg1 = "67",
|
||||
arg2 = "0"
|
||||
shell:
|
||||
f"{PYTHON} {SRC}/trim.py {{input}} {{output}} {{params.arg1}} {{params.arg2}}"
|
||||
|
||||
|
||||
# plots the yearly changes of sunshine duration
|
||||
rule plot_yearly_change_sunshine:
|
||||
input:
|
||||
f"{RESULTS}/sunshine_duration_yearly_trimmed.csv"
|
||||
output:
|
||||
f"{REPORT}/sunshine_duration_yearly_trimmed.png"
|
||||
params:
|
||||
title = "Sunshine Duration 2018-2024",
|
||||
year_filter = None
|
||||
shell:
|
||||
f'{PYTHON} {SRC}/plot_change.py {{input}} {{output}} "{{params.title}}" {{params.year_filter}}'
|
||||
Reference in New Issue
Block a user