simeasren.plotting.prepare_pv_data
Functions
|
Convert columns with commas as decimals to numeric floats. |
|
Extract year tag (e.g., Location2020) from dataframe column names. |
|
Load, clean, and prepare all measured and simulated PV datasets |
Module Contents
- simeasren.plotting.prepare_pv_data.convert_comma_to_dot(df: pandas.DataFrame) pandas.DataFrame
Convert columns with commas as decimals to numeric floats.
- simeasren.plotting.prepare_pv_data.extract_year_selected(dataframe: pandas.DataFrame, column_pattern='([A-Za-z]+[0-9]{4})') str
Extract year tag (e.g., Location2020) from dataframe column names.
- simeasren.plotting.prepare_pv_data.prepare_pv_data_for_plots(location_name: str, year: str, file_path_sim_meas: str = None, file_path_pvdata: str = None)
Load, clean, and prepare all measured and simulated PV datasets for subsequent time series and high-resolution plotting.
This function consolidates and preprocesses photovoltaic (PV) performance data by loading measured Excel files and corresponding simulated CSV outputs for a given location and year. It also merges high-resolution daily data (clear and cloudy sky) with hourly simulation results to ensure consistent plotting inputs.
- Parameters:
location_name (str) – Name of the PV site or measurement location (e.g., “Almeria”, “Turin”, “Utrecht”). Must match the filename in the data/measured_PV/ directory
year (str) – Specific year to filter the simulation data (e.g., “2023”). The year should exist in the measured data files
- Returns:
data_sim_meas (pd.DataFrame) – Hourly simulated and measured PV data (limited to 8760 hours for a full year). Columns include simulated and measured normalized power outputs per model/tool.
clear_sky_df (pd.DataFrame) – Processed and merged clear-sky day data, combining high-resolution measured values with corresponding simulation results.
cloudy_sky_df (pd.DataFrame) – Processed and merged cloudy-sky day data, combining high-resolution measured values with corresponding simulation results.
- Raises:
FileNotFoundError – If the measured PV Excel file for the specified location does not exist.
UserWarning – If the specified year is not found in the dataset, resulting in empty outputs.
Notes
Measured PV data are expected in:
` data/measured_PV/{location_name}.xlsx `with sheet names “Clear sky day” and “Cloudy sky day”.By default simulated PV results are expected in:
` results/{location_name}/simulated_pv/{location_name}_meas_sim.csv `Helper functions used: - convert_comma_to_dot() for numeric conversion. - extract_year_selected() for extracting year tags from column names.
Examples
>>> from simeasren import prepare_pv_data_for_plots >>> data_sim_meas, clear_sky_df, cloudy_sky_df = prepare_pv_data_for_plots( ... location_name="Almeria", ... year="2023" ... ) >>> data_sim_meas.shape (8760, 3)