adding unit_id_pudl column
We need the information about thermal units in each cluster for the downscaling purpose.
@@ -2357,6 +2357,12 @@ class GeneratorClusters:
if num_clusters[region][tech] != 0:
_df = calc_unit_cluster_values(grouped, self.settings, tech)
_df["region"] = region
+ _df['unit_id_pudl'] = '0'
+ df_1 = df.reset_index(drop=True)
+ EachClusterWeight = [None] * num_clusters[region][tech]
+ for k in range(num_clusters[region][tech]):
+ EachClusterWeight[k] = len(clusters.labels_[clusters.labels_ == k])
+ _df['unit_id_pudl'][k+1] = list(df_1.loc[list(np.where(clusters.labels_==k)[0])]['unit_id_pudl'])
self.cluster_list.append(_df)
# Save some data about individual units for easy access
