Skip to content

Commit

Permalink
snakemake ts data fix
Browse files Browse the repository at this point in the history
  • Loading branch information
maartenbrinkerink committed Dec 20, 2024
1 parent f8d4082 commit e8a7b61
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions workflow/rules/preprocess.smk
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,8 @@ rule timeslice:
csv_files = expand('results/data/{output_file}.csv', output_file=timeslice_files),
log:
log = 'results/logs/timeslice.log'
shell:
'python workflow/scripts/osemosys_global/TS_data.py 2> {log}'
script:
"../scripts/osemosys_global/TS_data.py"

rule reserves:
message:
Expand Down
30 changes: 14 additions & 16 deletions workflow/scripts/osemosys_global/TS_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ def correct_datetime_formatting(time_str):
# ### Create column for timeslice with and without day-type


if daytpe:
if daytype:
demand_df["TIMESLICE"] = (
demand_df["Season"] + demand_df["Day-of-week"] + demand_df["Daypart"]
)
Expand Down Expand Up @@ -451,7 +451,6 @@ def capacity_factor(df):
end_year = snakemake.params.end_year
region_name = snakemake.params.region_name
geographic_scope = snakemake.params.geographic_scope
custom_nodes = snakemake.params.custom_nodes
output_data_dir = snakemake.params.output_data_dir
input_data_dir = snakemake.params.input_data_dir
output_dir = snakemake.params.output_dir
Expand All @@ -462,18 +461,18 @@ def capacity_factor(df):
dayparts = snakemake.params.dayparts
timeshift = snakemake.params.timeshift

plexos_demand = snakemake.input.plexos_demand
plexos_csp_2015 = snakemake.input.plexos_csp_2015
plexos_spv_2015 = snakemake.input.plexos_spv_2015
plexos_hyd_2015 = snakemake.input.plexos_hyd_2015
plexos_won_2015 = snakemake.input.plexos_won_2015
plexos_wof_2015 = snakemake.input.plexos_wof_2015
custom_specified_demand_profiles = snakemake.input.custom_specified_demand_profiles
custom_csp_profiles = snakemake.input.custom_csp_profiles
custom_hyd_profiles = snakemake.input.custom_hyd_profiles
custom_spv_profiles = snakemake.input.custom_spv_profiles
custom_wof_profiles = snakemake.input.custom_wof_profiles
custom_won_profiles = snakemake.input.custom_won_profiles
plexos_demand = pd.read_csv(snakemake.input.plexos_demand)
plexos_csp_2015 = pd.read_csv(snakemake.input.plexos_csp_2015)
plexos_spv_2015 = pd.read_csv(snakemake.input.plexos_spv_2015)
plexos_hyd_2015 = pd.read_csv(snakemake.input.plexos_hyd_2015)
plexos_won_2015 = pd.read_csv(snakemake.input.plexos_won_2015)
plexos_wof_2015 = pd.read_csv(snakemake.input.plexos_wof_2015)
custom_specified_demand_profiles = pd.read_csv(snakemake.input.custom_specified_demand_profiles)
custom_csp_profiles = pd.read_csv(snakemake.input.custom_csp_profiles)
custom_hyd_profiles = pd.read_csv(snakemake.input.custom_hyd_profiles)
custom_spv_profiles = pd.read_csv(snakemake.input.custom_spv_profiles)
custom_wof_profiles = pd.read_csv(snakemake.input.custom_wof_profiles)
custom_won_profiles = pd.read_csv(snakemake.input.custom_won_profiles)

# The below else statement defines variables if the 'powerplant/main' script is to be run locally
# outside the snakemake workflow. This is relevant for testing purposes only! User inputs when running
Expand All @@ -484,13 +483,12 @@ def capacity_factor(df):
end_year = 2050
region_name = 'GLOBAL'
geographic_scope = ['BTN', 'IND']
custom_nodes = []
output_data_dir = 'results/data'
input_data_dir = 'resources/data'
output_dir = 'results'
input_dir = 'resources'
custom_nodes_dir = 'resources/data/custom_nodes'
daytpe = False
daytype = False
seasons = {'S1': [1, 2, 3, 4, 5, 6],
'S2': [7, 8, 9, 10, 11, 12]}
dayparts = {'D1': [1, 7],
Expand Down

0 comments on commit e8a7b61

Please sign in to comment.