Add IQR as measure of heat rate spread in clusters
@@ -5,6 +5,7 @@ import numpy as np
import pandas as pd
import requests
from bs4 import BeautifulSoup
+from scipy.stats import iqr
from sklearn import cluster, preprocessing
import sqlalchemy as sa
import sqlite3
@@ -996,6 +997,11 @@ def calc_unit_cluster_values(df, settings, technology=None):
"heat_rate_mmbtu_mwh": wm,
}
)
+ df_values["heat_rate_mmbtu_mwh_iqr"] = df.groupby("cluster").agg(
+ {
+ "heat_rate_mmbtu_mwh": iqr,
+ }
+ )
df_values["Min_power"] = (
df_values["minimum_load_mw"] / df_values[settings["capacity_col"]]
