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

group storage with duplicate labels #873

Merged
merged 4 commits into from
Jan 18, 2024
Merged

Conversation

lindnemi
Copy link
Contributor

Closes # (if applicable).

Changes proposed in this Pull Request

fixes an error that occurs when h2 storage is built at the same bus but at different snapshots

Traceback (most recent call last):
  File "/home/micha/git/pypsa-ariadne/.snakemake/scripts/tmp53wos82s.plot_network.py", line 1105, in <module>
    plot_h2_map(n, regions)
  File "/home/micha/git/pypsa-ariadne/.snakemake/scripts/tmp53wos82s.plot_network.py", line 278, in plot_h2_map
    regions["H2"] = h2_storage.rename(
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/geopandas/geodataframe.py", line 1543, in __setitem__
    super().__setitem__(key, value)
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/frame.py", line 4091, in __setitem__
    self._set_item(key, value)
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/frame.py", line 4300, in _set_item
    value, refs = self._sanitize_column(value)
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/frame.py", line 5036, in _sanitize_column
    return _reindex_for_setitem(value, self.index)
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/frame.py", line 12309, in _reindex_for_setitem
    raise err
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/frame.py", line 12304, in _reindex_for_setitem
    reindexed_value = value.reindex(index)._values
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/series.py", line 4981, in reindex
    return super().reindex(
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/generic.py", line 5521, in reindex
    return self._reindex_axes(
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/generic.py", line 5544, in _reindex_axes
    new_index, indexer = ax.reindex(
  File "/home/micha/micromamba/envs/pypsa-ariadne/lib/python3.10/site-packages/pandas/core/indexes/base.py", line 4434, in reindex
    raise ValueError("cannot reindex on an axis with duplicate labels")
ValueError: cannot reindex on an axis with duplicate labels

Checklist

  • I tested my contribution locally and it seems to work fine.
  • Code and workflow changes are sufficiently documented.
  • Changed dependencies are added to envs/environment.yaml.
  • Changes in configuration options are added in all of config.default.yaml.
  • Changes in configuration options are also documented in doc/configtables/*.csv.
  • A release note doc/release_notes.rst is added.

@lindnemi lindnemi requested a review from fneum January 17, 2024 16:10
Comment on lines 1072 to 1075
clusters="22",
ll="v1.2",
sector_opts="365H-T-H-B-I-A-solar+p3-linemaxext15",
planning_horizons="2040",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could you remove these changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good spot, that was an accident!

@fneum
Copy link
Member

fneum commented Jan 18, 2024

Looks good and also works for overnight scenarios.

@fneum fneum merged commit 948bf3b into master Jan 18, 2024
5 checks passed
@fneum fneum deleted the duplicate-labels-H2-storage branch January 18, 2024 17:18
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.

3 participants