bsrn.visualization.separation.plot_k_vs_kt#

bsrn.visualization.separation.plot_k_vs_kt(df, models, lat, lon, ghi_col='ghi', dhi_col='dhi', k_mod_cols=None, output_file=None, title=None)[source]#

Faceted scatter plot of k (diffuse fraction) vs kt (clearness index) from a DataFrame.

One panel per model; measured (gray) and model (colored) in each panel.

Parameters:
  • df (pd.DataFrame) – Input data with DatetimeIndex and at least ghi_col and dhi_col.

  • models (sequence of str) – Model names to plot, e.g. ('erbs', 'brl'). Each in SUPPORTED_SEPARATION_MODELS.

  • lat (float) – Latitude. [degrees]

  • lon (float) – Longitude. [degrees]

  • ghi_col (str, default "ghi") – Column name for GHI.

  • dhi_col (str, default "dhi") – Column name for DHI.

  • k_mod_cols (dict or None, optional) – Map model name to column name for model k. If None, runs each separation model. For engerer2 and yang4, k must be pre-computed and provided here (both need clear-sky GHI).

  • output_file (str, optional) – Path to save the figure.

  • title (str, optional) – Overall plot title.

Notes

To include Engerer2 or Yang4 (both require clear-sky GHI): add clear-sky GHI to df (e.g. bsrn.physics.clearsky.add_clearsky_columns()), run the separation with ghi_clear=df["ghi_clear"].values, assign the result’s "k" to a column, then pass k_mod_cols={"engerer2": "k_engerer2", "yang4": "k_yang4"}.

Returns:

p – The ggplot object. If output_file was set, this is a new instance (the one used for saving is not safe to draw again after plt.close).

Return type:

plotnine.ggplot