PyPSA/pypsa-eur

Bug in "add_heating_capacities_installed_before_baseyear"

Opened this issue · 1 comments

  • I am using the current master branch.
  • I am running on an up-to-date pypsa-eur environment. Update via conda env update -f envs/environment.yaml.

Describe the Bug

When running a myopic forecast for the year 2050 there is a bug when in the script "add_existing_baseyear.py".

            valid_grouping_years = pd.Series(
                [
                    int(grouping_year)
                    for grouping_year in grouping_years
                    if int(grouping_year) + default_lifetime > int(baseyear)
                    and int(grouping_year) < int(baseyear)
                ]
                
int(grouping_year) + default_lifetime is lowe than int(baseyear), so the result is an empty pandas series that gives an error in the following lines (see image below). I guess a fix could be a simple check if that variable is empty.
Parameters that changed in my config file (I ran a single nation but I see the same bug in other spatial configurations):

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#foresight
foresight: myopic

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#scenario
# Wildcard docs in https://pypsa-eur.readthedocs.io/en/latest/wildcards.html
scenario:
  ll:
  - vopt
  clusters:
  - 5
  opts:
  - ''
  sector_opts:
  - ''
  planning_horizons:
  # - 2020
  # - 2030
  # - 2040
  - 2050

# docs in https://pypsa-eur.readthedocs.io/en/latest/configuration.html#countries
countries: ['IT']

Error Message

image