diff --git a/config.default.yaml b/config.default.yaml index f952f5b7..4cd0eadc 100755 --- a/config.default.yaml +++ b/config.default.yaml @@ -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 diff --git a/doc/release_notes.rst b/doc/release_notes.rst index 9b012bf8..4ef5e956 100644 --- a/doc/release_notes.rst +++ b/doc/release_notes.rst @@ -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** diff --git a/scripts/build_powerplants.py b/scripts/build_powerplants.py index e18232b8..9a7c9e23 100755 --- a/scripts/build_powerplants.py +++ b/scripts/build_powerplants.py @@ -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):