build_powerplants: fix duplicated names per bus
This commit is contained in:
parent
e37a3f57ab
commit
d53487f822
@ -118,7 +118,7 @@ if __name__ == "__main__":
|
|||||||
# Correct bioenergy for countries where possible
|
# Correct bioenergy for countries where possible
|
||||||
opsd = pm.data.OPSD_VRE().powerplant.convert_country_to_alpha2()
|
opsd = pm.data.OPSD_VRE().powerplant.convert_country_to_alpha2()
|
||||||
opsd = opsd.query('Country in @countries and Fueltype == "Bioenergy"')
|
opsd = opsd.query('Country in @countries and Fueltype == "Bioenergy"')
|
||||||
opsd['Fueltype'] = 'biomass'
|
opsd['Name'] = "Biomass"
|
||||||
available_countries = opsd.Country.unique()
|
available_countries = opsd.Country.unique()
|
||||||
ppl = ppl.query('not (Country in @available_countries and Fueltype == "Bioenergy")')
|
ppl = ppl.query('not (Country in @available_countries and Fueltype == "Bioenergy")')
|
||||||
ppl = pd.concat([ppl, opsd])
|
ppl = pd.concat([ppl, opsd])
|
||||||
@ -148,4 +148,8 @@ if __name__ == "__main__":
|
|||||||
if bus_null_b.any():
|
if bus_null_b.any():
|
||||||
logging.warning(f"Couldn't find close bus for {bus_null_b.sum()} powerplants")
|
logging.warning(f"Couldn't find close bus for {bus_null_b.sum()} powerplants")
|
||||||
|
|
||||||
|
# TODO: This has to fixed in PPM, some powerplants are still duplicated
|
||||||
|
cumcount = ppl.groupby(['bus', 'Fueltype']).cumcount() + 1
|
||||||
|
ppl.Name = ppl.Name.where(cumcount == 1, ppl.Name + " " + cumcount.astype(str))
|
||||||
|
|
||||||
ppl.to_csv(snakemake.output[0])
|
ppl.to_csv(snakemake.output[0])
|
||||||
|
Loading…
Reference in New Issue
Block a user