Skip to content

rencal.calibration.wind.wind_calibrator

rencal.calibration.wind.wind_calibrator defines the concrete wind calibration workflow for converting ERA5 wind resource data and historical generation into fitted wind power curves and long-term load-factor streams.

WindCalibrator extends Calibrator for wind technologies, fits Weibull and logistic curve parameters per plant, and writes tabular calibration outputs plus stream artifacts for downstream simulation.

from pathlib import Path
from rencal.calibration.wind.wind_calibrator import WindCalibrator
# Using local data files
calibrator = WindCalibrator(
data_path="data",
plant_id_col="plant_id",
output_path=Path("outputs"),
visual_output=False,
stream_npy_output=True,
)
calibrator.calibrate()
# Using a custom loader (e.g. reading inputs from cloud storage)
calibrator = WindCalibrator(
loader=my_cloud_loader,
output_path=Path("outputs"),
)
calibrator.calibrate()

class WindCalibrator(
data_path: str = None,
plant_id_col: str = None,
output_path: str | Path = Path.cwd(),
visual_output: bool = False,
stream_npy_output: bool = False,
loader: DataLoader | None = None,
): WindCalibrator

Calibrates wind power curves for a set of timestamps and CFD IDs.

  • data_path str

    Path to the folder containing plant information, generation, and resource data.

  • plant_id_col str

    Name of the plant identifier column.

  • output_path str | Path

    Location to write the output files to.

  • visual_output bool

    If True, each calibrated plant’s power curve is plotted to the output folder.

  • stream_npy_output bool

    If True, wind streams are written in NPY format alongside PARQUET.

  • loader DataLoader | None

    Optional pre-configured data loader used instead of the default LocalDataLoader (e.g. a cloud loader reading inputs directly from their original Blob locations). When provided it overrides data_path.

Returns WindCalibrator

calibrate() -> None

Triggers the full wind calibration workflow.

This workflow extracts plant-level wind speeds, computes historical load factors, fits Weibull and logistic parameters, writes calibration summary artifacts, generates wind streams, and writes resulting outputs.

Returns None

WindCalibrator.extract_resource_timeseries_for_plants

Section titled “WindCalibrator.extract_resource_timeseries_for_plants”
extract_resource_timeseries_for_plants() -> pd.DataFrame

Extracts resource data for plants into a DataFrame.

Returns pd.DataFrame

WindCalibrator.calculate_historical_load_factors

Section titled “WindCalibrator.calculate_historical_load_factors”
calculate_historical_load_factors() -> pd.DataFrame

Calculates historical load factors based on resource availability and generation data for each plant.

Returns pd.DataFrame

WindCalibrator.fit_historical_load_factor_distribution

Section titled “WindCalibrator.fit_historical_load_factor_distribution”
fit_historical_load_factor_distribution() -> pd.DataFrame

Fits probability distribution to historical load factors and resource availability.

Returns pd.DataFrame

WindCalibrator.estimate_load_factors_for_resource

Section titled “WindCalibrator.estimate_load_factors_for_resource”
estimate_load_factors_for_resource() -> pd.DataFrame

Estimates load factors based on the historical distribution and the whole resource availability history.

Returns pd.DataFrame

Raises

  • ValueError: If no calibration summary rows were produced.
logistic_function(
x: int | float | np.ndarray,
b: float,
c: float,
g: float,
) -> float | np.ndarray

Defines a generalised logistic function in the log domain for stability and calculates its value for any numeric input x.

For deeper conceptual context, see Logistic Power Curve.

The generalized logistic function has five shape parameters; this implementation constrains minimum/maximum to 0 and 1 respectively because load factors are bounded to [0, 1].

The non-log-domain form is:

where b is steepness, c is inflection location, and g is asymmetry.

  • x int | float | np.ndarray

    Input variable(s), i. e.: wind speed.

  • b float

    Steepness parameter of the generalised logistic function.

  • c float

    X-axis inflection point location parameter of the generalised logistic function.

  • g float

    Asymmetry parameter of the generalised logistic function.

Returns float | np.ndarray

weibull_function(
x: int | float | np.ndarray,
k_val: float,
lambda_val: float,
) -> float | np.ndarray

Calculates the value of a specified Weibull distribution for any numeric input x.

For deeper conceptual context, see Weibull Wind-Speed Distribution.

The Weibull density is:

where k is shape and λ is scale.

  • x int | float | np.ndarray

    Input variable(s), i. e.: wind speed.

  • k_val float

    Shape parameter of the Weibull distribution.

  • lambda_val float

    Scale parameter of the Weibull distribution.

Returns float | np.ndarray

generate_resource_streams() -> pd.DataFrame

Generates wind streams from fitted and/or generalised power curve parameters and long-term wind data.

Returns pd.DataFrame

WindCalibrator.output_historical_load_factor_distribution_parameters

Section titled “WindCalibrator.output_historical_load_factor_distribution_parameters”
output_historical_load_factor_distribution_parameters() -> None

Writes historical load factor parameters to a CSV file.

Returns None

output_resource_per_plant() -> None

Writes resource time series for each plant to a CSV file.

Returns None

output_resource_streams() -> None

Writes resource streams to a parquet file.

If stream_npy_output=True, the method also writes an .npy file alongside the parquet output.

Returns None

WindCalibrator.output_estimated_load_factors_tabular

Section titled “WindCalibrator.output_estimated_load_factors_tabular”
output_estimated_load_factors_tabular() -> None

Outputs table of estimated load factors for whole resource availability history.

Returns None

WindCalibrator.output_estimated_load_factors_visual

Section titled “WindCalibrator.output_estimated_load_factors_visual”
output_estimated_load_factors_visual(
logistic_params: np.ndarray,
load_factors: pd.DataFrame,
) -> None

Outputs a series of plots of estimated load and fitted curves per plant.

  • logistic_params np.ndarray

    Fitted logistic parameters.

  • load_factors pd.DataFrame

    Plant load-factor observations.

Returns None