Skip to content

rencal.calibration.solar.solar_calibrator

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

SolarCalibrator extends Calibrator for solar technologies, estimates plant-specific gamma and NOCT parameters, and writes tabular calibration outputs plus stream artifacts for downstream simulation.

from pathlib import Path
from rencal.calibration.solar.solar_calibrator import SolarCalibrator
calibrator = SolarCalibrator(
data_path="data",
plant_id_col="plant_id",
output_path=Path("outputs"),
visual_output=False,
stream_npy_output=True,
)
calibrator.calibrate()

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

Calibrates solar power curves for a set of timestamps and plant 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 PV curve is plotted to the output folder.

  • stream_npy_output bool

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

Returns SolarCalibrator

calibrate() -> None

Triggers the full solar calibration workflow.

This workflow extracts plant-level irradiance and temperature data, calculates historical load factors, fits a NOCT-based PV curve for each plant, writes calibration summary artifacts, generates solar streams, and writes the resulting outputs.

Returns None

solar_regression_model(
x_data,
gamma,
noct,
) -> np.ndarray

Defines the NOCT-style solar regression used to map irradiance and temperature to expected plant output.

The model is:

T_cell = T + (NOCT - 20) * G / 800
return (1 - gamma * (T_cell - 25)) * G / 1000

where G is irradiance and T is temperature. This gives a physically plausible PV response that decreases with elevated cell temperature while scaling with available irradiance.

Returns np.ndarray

SolarCalibrator.extract_resource_timeseries_for_plants

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

Extracts solar irradiance and temperature data for plants into a DataFrame.

Returns pd.DataFrame

SolarCalibrator.calculate_historical_load_factors

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

Calculates historical solar load factors from generation, capacity, and aligned irradiance/temperature data for each plant.

Returns pd.DataFrame

SolarCalibrator.fit_historical_load_factor_distribution

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

Fits an empirical irradiance histogram for each plant and stores distribution summary statistics.

Returns pd.DataFrame

SolarCalibrator.estimate_load_factors_for_resource

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

Fits the plant-specific NOCT curve parameters using curve_fit, then stores the resulting gamma, NOCT, and mean estimated load factor.

Returns pd.DataFrame

generate_resource_streams() -> pd.DataFrame

Applies the fitted PV curves to the full historical irradiance and temperature records to create plant-level solar load-factor streams.

Returns pd.DataFrame