Move atb costs data load out of class init
Only loading required data for new gen types, so redo each time new gens
are calculated.
@@ -1990,15 +1990,6 @@ class GeneratorClusters:
# self.utilities_eia = load_utilities_eia(self.pudl_engine)
else:
self.existing_resources = pd.DataFrame()
-
- self.offshore_spur_costs = fetch_atb_offshore_spur_costs(
- self.pudl_engine, self.settings
- )
- self.atb_costs = fetch_atb_costs(
- self.pudl_engine, self.settings, self.offshore_spur_costs
- )
- self.atb_hr = fetch_atb_heat_rates(self.pudl_engine)
-
self.fuel_prices = fetch_fuel_prices(self.settings)
def fill_na_heat_rates(self, df):
@@ -2507,6 +2498,13 @@ class GeneratorClusters:
return self.results
def create_new_generators(self):
+ self.offshore_spur_costs = fetch_atb_offshore_spur_costs(
+ self.pudl_engine, self.settings
+ )
+ self.atb_costs = fetch_atb_costs(
+ self.pudl_engine, self.settings, self.offshore_spur_costs
+ )
+ self.atb_hr = fetch_atb_heat_rates(self.pudl_engine, self.settings)
self.new_generators = atb_new_generators(
self.atb_costs, self.atb_hr, self.settings
@@ -2565,9 +2563,7 @@ class GeneratorClusters:
self.all_resources = self.all_resources.reset_index(drop=True)
self.all_resources["variable_CF"] = 0.0
for i, p in enumerate(self.all_resources["profile"]):
- if isinstance(
- p, (collections.Sequence, np.ndarray)
- ):
+ if isinstance(p, (collections.Sequence, np.ndarray)):
self.all_resources.loc[i, "variable_CF"] = np.mean(p)
# Set Min_power of wind/solar to 0
