allow fixed load data year deviating from snapshots
This commit is contained in:
parent
a71552eb1b
commit
6d260435a6
@ -77,8 +77,8 @@ rule retrieve_load_data:
|
||||
|
||||
rule build_load_data:
|
||||
input: "data/load_raw.csv"
|
||||
output: "resources/load.csv"
|
||||
log: "logs/build_load_data.log"
|
||||
output: "resources/load{weather_year}.csv"
|
||||
log: "logs/build_load_data{weather_year}.log"
|
||||
script: 'scripts/build_load_data.py'
|
||||
|
||||
|
||||
|
@ -196,7 +196,7 @@ load:
|
||||
time_shift_for_large_gaps: 1w # data gaps up until this size are copied by copying from
|
||||
manual_adjustments: true # false
|
||||
scaling_factor: 1.0
|
||||
fallback_year: 2013
|
||||
fixed_year: false # false or year
|
||||
|
||||
costs:
|
||||
year: 2030
|
||||
|
@ -196,11 +196,23 @@ if __name__ == "__main__":
|
||||
|
||||
configure_logging(snakemake)
|
||||
|
||||
weather_year = snakemake.wildcard.weather_year
|
||||
if weather_year:
|
||||
snapshots = dict(
|
||||
start=weather_year,
|
||||
end=str(int(weather_year)+1),
|
||||
closed="left"
|
||||
)
|
||||
else:
|
||||
snapshots = snakemake.config['snapshots']
|
||||
snapshots = pd.date_range(freq='h', **snapshots)
|
||||
|
||||
fixed_year = snakemake.config["load"].get("fixed_year", False)
|
||||
years = slice(fixed_year, fixed_year) if fixed_year else slice(snapshots[0], snapshots[-1])
|
||||
|
||||
powerstatistics = snakemake.config['load']['power_statistics']
|
||||
interpolate_limit = snakemake.config['load']['interpolate_limit']
|
||||
countries = snakemake.config['countries']
|
||||
snapshots = pd.date_range(freq='h', **snakemake.config['snapshots'])
|
||||
years = slice(snapshots[0], snapshots[-1])
|
||||
time_shift = snakemake.config['load']['time_shift_for_large_gaps']
|
||||
|
||||
load = load_timeseries(snakemake.input[0], years, countries, powerstatistics)
|
||||
@ -220,5 +232,9 @@ if __name__ == "__main__":
|
||||
'`time_shift_for_large_gaps` or modify the `manual_adjustment` function '
|
||||
'for implementing the needed load data modifications.')
|
||||
|
||||
# need to reindex load time series to target year
|
||||
if fixed_year:
|
||||
load.index = load.index.map(lambda t: t.replace(year=snapshots.year[0]))
|
||||
|
||||
load.to_csv(snakemake.output[0])
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user