Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: resolve resampling problem for geothermal variable efficiency #1470

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

yechenyan
Copy link

@yechenyan yechenyan commented Dec 28, 2024

Closes # (if applicable).

Changes proposed in this Pull Request

Resolve resampling problem for geothermal variable efficiency

Problem

When resample is set in wildcards and both enhanced_geothermal and var_cf are enabled, such as in the following configuration:

scenario:
  opts:
  - 2H
  sector_opts:
  - 2H

sector:
  enhanced_geothermal:
    enable: true
    var_cf: true

The code encounters an error because the network snapshots are being resampled to 2-hour intervals, while the geothermal efficiency is still being processed at hourly intervals. This mismatch causes the code to break at line 4546, found here:

efficiency=bus_eta,

The error information is as follows:

INFO:__main__:[EGS] district heat distribution part -> 'geothermal district heat'
INFO:__main__:Adding Enhanced Geothermal with time-varying capacity factors.
INFO:__main__:Adding EGS as Combined Heat and Power.
ERROR:root:Uncaught exception
Traceback (most recent call last):
  File "/Users/maxiao/Documents/code/rli-code/pypsa-eur-flexibility/.snakemake/scripts/tmp_gfh6mzl.prepare_sector_network.py", line 4754, in <module>
    add_enhanced_geothermal(
  File "/Users/maxiao/Documents/code/rli-code/pypsa-eur-flexibility/.snakemake/scripts/tmp_gfh6mzl.prepare_sector_network.py", line 4542, in add_enhanced_geothermal
    n.add(
  File "/opt/anaconda3/envs/pypsa-eur/lib/python3.12/site-packages/pypsa/components.py", line 1003, in add
    raise ValueError(msg.format(f"DataFrame {k}", "network snapshots"))
ValueError: DataFrame efficiency has an index which does not align with the passed network snapshots.

Fix

Adjust the resampling of geothermal efficiency according to the resample setting specified in wildcards.

Resample may also be gotten from resolution_elec

Checklist

  • I tested my contribution locally and it works as intended.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to envs/environment.yaml.
  • Changes in configuration options are added in config/config.default.yaml.
  • Changes in configuration options are documented in doc/configtables/*.csv.
  • Sources of newly added data are documented in doc/data_sources.rst.
  • A release note doc/release_notes.rst is added.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant