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

fixed issue #209 (CCGT power plant 4079) defined as STORE instead of PP #221

Merged
merged 4 commits into from
Jan 30, 2025

Conversation

gincrement
Copy link
Contributor

Closes # (if applicable).

Changes proposed in this Pull Request

Checklist

  • [ x] Code changes are sufficiently documented; i.e. new functions contain docstrings and further explanations may be given in doc.
  • Unit tests for new features were added (if applicable).
  • A note for the release notes doc/release_notes.rst of the upcoming release is included.
  • [ x] I consent to the release of this PR's code under the MIT license.

Copy link
Member

@lkstrp lkstrp left a comment

Choose a reason for hiding this comment

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

Hey @gincrement,

powerplant.csv' is generated automatically. This is basically the standard output of powerplantsmatching, so you can use the data without re-running it.
Which means that fixing things in here will just be overwritten by the next release. We would need to look at GEM and GPD, see where the problem is coming from and make a manual adjustment (manual_corrections.csv) or improve the general pre-processing (data.py)

Comment on lines 567 to 572
# fix a bug within the data source GPD related with the power plant at 'Creyke Beck'
# Technology: CCGT -> Combustion Engine
# Set: Store -> PP
df.loc[df["Gppd_Idnr"] == "GBR2001173", "Technology"] = "Combustion Engine"
df.loc[df["Gppd_Idnr"] == "GBR2001173", "Set"] = "PP"

Copy link
Member

Choose a reason for hiding this comment

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

Can you just add that in here?
https://github.com/PyPSA/powerplantmatching/blob/master/powerplantmatching/package_data/manual_corrections.csv

It will basically do the same, those changes will be updated via

def correct_manually(df, name, config=None):
"""
Update powerplant data based on stored corrections in
powerplantmatching/data/in/manual_corrections.csv. Specify the name
of the data by the second argument.
Parameters
----------
df : pandas.DataFrame
Powerplant data
name : str
Name of the data source, should be in columns of manual_corrections.csv
"""
if config is None:
config = get_config()
corrections_fn = _package_data("manual_corrections.csv")
corrections = pd.read_csv(corrections_fn)
corrections = (
corrections.query("Source == @name")
.drop(columns="Source")
.set_index("projectID")
)
if corrections.empty:
return df
df = df.set_index("projectID").copy()
df.update(corrections)
return df.reset_index()

It is just much cleaner if we keep single manual corrections in a file, instead of bloating up data.csv which should just contain general preprocessing logic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Could be done if I am allowed to add a column as well.

Copy link
Member

Choose a reason for hiding this comment

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

True, but yes go for it. The function looks already generic enough

@lkstrp
Copy link
Member

lkstrp commented Jan 30, 2025

Thank you @gincrement !

@lkstrp lkstrp merged commit bc7c047 into PyPSA:master Jan 30, 2025
14 of 16 checks passed
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.

2 participants