-
Notifications
You must be signed in to change notification settings - Fork 61
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
Conversation
There was a problem hiding this 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
)
powerplantmatching/data.py
Outdated
# 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" | ||
|
There was a problem hiding this comment.
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
powerplantmatching/powerplantmatching/utils.py
Lines 143 to 172 in f593581
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
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
…nstead of Combustion Engine/PP
Thank you @gincrement ! |
Closes # (if applicable).
Changes proposed in this Pull Request
Checklist
doc
.doc/release_notes.rst
of the upcoming release is included.