@@ -1358,12 +1358,64 @@ def gen_te_projections(
1358
1358
.drop (["scenario_version" , "scenario" ], axis = 1 )
1359
1359
)
1360
1360
fix_cost = fix_cost [fix_cost ["technology" ].isin (model_tec_set )]
1361
+
1362
+ # # Ensure that fix_costs are also added for activity years of vintage years
1363
+ # # prior to the firstmodelyear and remove any entries for activity years for
1364
+ # # which the technology is not active.
1365
+ # tmp_fc = pd.DataFrame()
1366
+ # remove = []
1367
+ # for node in fix_cost.node_loc.unique().tolist():
1368
+ # for tec in fix_cost.loc[fix_cost.node_loc == node].technology.unique().tolist():
1369
+ # yva_found = False
1370
+ # tmp = fix_cost.loc[(fix_cost.node_loc == node) & (fix_cost.technology == tec)].copy()
1371
+ # try:
1372
+ # yva = scen.vintage_and_active_years([node, tec])
1373
+ # yva_found = True
1374
+ # except Exception:
1375
+ # yva = scen.vintage_and_active_years()
1376
+ # if yva_found == False or max(yva.year_vtg) < max(scen.set("year")):
1377
+ # inp = scen.par("input", filters={"node_loc": node, "technology": tec})[["year_vtg", "year_act"]]
1378
+ # inp = inp.loc[inp.year_act >= scen.firstmodelyear]
1379
+ # out = scen.par("output", filters={"node_loc": node, "technology": tec})[["year_vtg", "year_act"]]
1380
+ # out = out.loc[out.year_act >= scen.firstmodelyear]
1381
+ # if not inp.empty:
1382
+ # yva = yva.merge(inp, on=["year_vtg", "year_act"], how="right")
1383
+ # elif not out.empty:
1384
+ # yva = yva.merge(out, on=["year_vtg", "year_act"], how="right")
1385
+ # else:
1386
+ # yva = scen.par("relation_activity", filters={"node_loc": node, "technology": tec})[["year_rel", "year_act"]].drop_duplicates().rename(columns={"year_rel": "year_vtg"})
1387
+ # if yva.empty:
1388
+ # yva = scen.par("relation_total_capacity", filters={"node_rel": node, "technology": tec})[["year_rel"]].drop_duplicates().rename(columns={"year_rel": "year_vtg"})
1389
+ # yva["year_act"] = yva["year_vtg"]
1390
+ # if yva.empty:
1391
+ # print(f"No data found for technology {tec} in node {node}. Continuing")
1392
+ # remove.append([node, tec])
1393
+ # continue
1394
+ #
1395
+ # tmp = tmp.merge(yva, on=["year_vtg", "year_act"], how="right").sort_values(by=["year_act", "year_vtg"]).bfill()
1396
+ #
1397
+ # # Handle Exceptions
1398
+ # if tec in ["coal_ppl_u", "nuc_lc"]:
1399
+ # tmp = tmp.dropna()
1400
+ #
1401
+ # check = tmp.copy()
1402
+ # check = check.loc[check.value.isnull()]
1403
+ # if not check.empty:
1404
+ # print(tec)
1405
+ # print(node)
1406
+ # print(tmp)
1407
+ # print(check)
1408
+ #
1409
+ # tmp_fc = pd.concat([tmp_fc, tmp])
1410
+ # fix_cost = tmp_fc.copy()
1361
1411
inv_cost = (
1362
1412
out_materials ["inv_cost" ]
1363
1413
.drop_duplicates ()
1364
1414
.drop (["scenario_version" , "scenario" ], axis = 1 )
1365
1415
)
1366
1416
inv_cost = inv_cost [inv_cost ["technology" ].isin (model_tec_set )]
1417
+ # for items in remove:
1418
+ # inv_cost = inv_cost.loc[~((inv_cost.node_loc == items[0]) & (inv_cost.technology == items[1]))]
1367
1419
return inv_cost , fix_cost
1368
1420
1369
1421
0 commit comments