ebm.cmd.load_scurve module

Generate S-curves from calibrated CSV parameters.

This module reads S-curve parameters from a CSV file, optionally filters them using a pandas query, and computes S-curves for each parameter set using the SCurve model. The results are returned as a combined pandas DataFrame and can optionally be saved to a CSV file.

Notes

  • Requires Python 3.10 or later.

  • Uses loguru for logging and pandas for data manipulation.

  • The S-curve calculation logic is implemented in ebm.model.scurve.SCurve.

Examples

Run the script from the command line:

python -m ebm.cmd.load_scurve data/long_analysis_2024/s_curve.csv --query "building_category == 'house'" --output results.csv

Optionally use python flag -i to work with the result in the python repl:

python -i ebm/cmd/load_scurve.py data/long_analysis_2024/s_curve.csv --query "building_category == 'house'" --output results.csv

Functions

generate_scurve_dataframe(s_curve_parameters)

Generate a combined DataFrame of S-curves based on input parameters.

parse_arguments()

Parse command-line arguments for CSV path, query, and output file.

main()

Main entry point for generating S-curves.

Command-Line Arguments

scurve_csvstr, optional

Path to the S-curve CSV file. Defaults to data/calibrated/s_curve.csv.

–querystr, optional

Pandas query string to filter the input DataFrame.

–outputstr, optional

Path to save the generated S-curves as a CSV file.

Returns

tuple of (pd.DataFrame | None, pd.DataFrame)

A tuple containing the generated S-curves DataFrame (or None if no curves were generated) and the original or filtered parameter DataFrame.

generate_scurve_dataframe(s_curve_parameters: DataFrame) DataFrame[source]

Generate a combined DataFrame of S-curves based on input parameters.

filter_s_curve_parameters(filter_query: str | None, scurve_parameters: DataFrame) DataFrame[source]

Filter S-curve parameters using a pandas query string.

parse_arguments() Namespace[source]

Parse command-line arguments.

main() tuple[DataFrame | None, DataFrame][source]

Main entry point for generating S-curves.