powerplants: filter out powerplants with shut down date < 2021

This commit is contained in:
Fabian 2022-04-05 15:12:01 +02:00
parent f878faac73
commit 1fd6a685ab
3 changed files with 12 additions and 8 deletions

View File

@ -53,8 +53,10 @@ electricity:
battery: 6
H2: 168
powerplants_filter: false # use pandas query strings here, e.g. Country not in ['Germany']
custom_powerplants: false # use pandas query strings here, e.g. Country in ['Germany']
# use pandas query strings here, e.g. Country not in ['Germany']
powerplants_filter: (DateOut >= 2021 or DateOut != DateOut)
# use pandas query strings here, e.g. Country in ['Germany']
custom_powerplants: false
conventional_carriers: [nuclear, oil, OCGT, CCGT, coal, lignite, geothermal, biomass]
renewable_capacities_from_OPSD: [] # onwind, offwind, solar

View File

@ -22,6 +22,7 @@ Energy Security Release (April 2022)
* old: ``estimate_renewable_capacities_from_capacity_stats``
* new: ``estimate_renewable_capacities``
* The powerplants that have been shut down before 2021 are filtered out.
**Bugs and Compatibility**

View File

@ -94,6 +94,10 @@ def add_custom_powerplants(ppl, custom_powerplants, custom_ppl_query=False):
return pd.concat([ppl, add_ppls], sort=False, ignore_index=True, verify_integrity=True)
def replace_natural_gas_by_technology(df):
return df.Fueltype.where(df.Fueltype != 'Natural Gas', df.Technology)
if __name__ == "__main__":
if 'snakemake' not in globals():
from _helpers import mock_snakemake
@ -103,16 +107,13 @@ if __name__ == "__main__":
n = pypsa.Network(snakemake.input.base_network)
countries = n.buses.country.unique()
ppl = (pm.powerplants(from_url=True)
.powerplant.fill_missing_decommissioning_years()
.powerplant.convert_country_to_alpha2()
.query('Fueltype not in ["Solar", "Wind"] and Country in @countries')
.replace({'Technology': {'Steam Turbine': 'OCGT'}})
.assign(Fueltype=lambda df: (
df.Fueltype
.where(df.Fueltype != 'Natural Gas',
df.Technology.replace('Steam Turbine',
'OCGT').fillna('OCGT')))))
.replace({'Technology': {'Steam Turbine': 'OCGT', "Combustion Engine": "OCGT"}})
.assign(Fueltype=replace_natural_gas_by_technology))
ppl_query = snakemake.config['electricity']['powerplants_filter']
if isinstance(ppl_query, str):