Example

import reperiods as rp
from reperiods.datasets import load_renewable

# Loading a dataset of hourly capacity factor in a TemporalData object
data = load_renewable(24*7*2)
temporal_data = rp.TemporalData(data)
temporal_data.plot_curves()
_images/timeseries.png

Finding Representative Periods (RP)

Setting number of RP to select on the data and length in hours.
N_RP = 2
RP_length=48

Poncelet

# Using Poncelet method to find RP and their weights
temporal_data.calculate_RP(method = "poncelet", N_RP=N_RP, RP_length=RP_length, N_bins=15)
# Show RP selected (highlighted in green) and their weights
temporal_data.plot_RP()
_images/poncelet.png

K-medoids

# Using K-medoids method
temporal_data.calculate_RP(method = "kmedoids", N_RP=N_RP, RP_length=RP_length)
# Show RP selected (highlighted in green) and their weights
temporal_data.plot_RP()
_images/kmedoids.png

Random

For comparison purpose, the random method randomly select RP and their weights.

# Using random method to find RP and their weights three times
temporal_data.calculate_RP(method = "random", N_RP=N_RP, RP_length=RP_length)
temporal_data.plot_RP()
_images/random1.png
_images/random2.png
_images/random3.png

Duration Curves

To evaluate RP and their weights it is possible to compare the duration curve approximation from RP and original data’s duration curve using plot_DC().

temporal_data.calculate_RP(method = "poncelet", N_RP=N_RP, RP_length=RP_length, N_bins=15)
temporal_data.plot_DC()
temporal_data.calculate_RP(method = "kmedoids", N_RP=N_RP, RP_length=RP_length)
temporal_data.plot_DC()
temporal_data.calculate_RP(method = "random", N_RP=N_RP, RP_length=RP_length)
temporal_data.plot_DC()
temporal_data.calculate_RP(method = "random", N_RP=N_RP, RP_length=RP_length)
temporal_data.plot_DC()
temporal_data.calculate_RP(method = "random", N_RP=N_RP, RP_length=RP_length)
temporal_data.plot_DC()

Poncelet

_images/poncelet1.png

K-medoids

_images/kmedoids1.png

Random

_images/random11.png
_images/random21.png
_images/random31.png

Export

Export RP and their weights using export().

temporal_data.export("Folder_receiving_export")