-
Notifications
You must be signed in to change notification settings - Fork 437
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
Add capacity additions and retirements to statistics #760
base: master
Are you sure you want to change the base?
Conversation
df = pd.concat(per_period, axis=1) | ||
elif when in ("build_year", "retirement") and groupby_kwargs is not None: | ||
# TODO uses 9999 as the sentinel value for after modelling period | ||
investment_periods = pd.Index(np.r_[n.investment_periods, 9999]) |
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.
maybe to make it clear just add one line
SENTINEL_YEAR = 9999
investment_periods = pd.Index(np.r_[n.investment_periods, SENTINEL_YEAR])
period = investment_periods[0 if when == "build_year" else -1] | ||
else: | ||
year = n.df(c)["build_year"] | ||
if when == "retirement": |
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.
we should add to the description that retirement is the first year the asset is not operating anymore
if when == "retirement": | ||
year += n.df(c)["lifetime"] | ||
|
||
period = investment_periods[ |
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.
I haven't tested it but is it necessary to define the period
or can we just groupby year
?
per_period[p] = df[n.get_active_assets(c, p).loc[df.index]] | ||
df = pd.concat(per_period, axis=1) | ||
|
||
if isinstance(n.snapshots, pd.MultiIndex): |
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.
maybe this functionality is also useful for running myopic code where you don't have a multi-index snapshot but still the information about build year and lifetime
Great! I only have some minor comments. I can't come up with better names, sorry! I think they one suggested are fine! |
Adds a new
when
argument to onlyoptimal_capacity
add the moment, which allows switching from selecting power plants, which are "active" in a given investment period to only show them at their "build_year" or at their "retirement" year.Not super happy with the names so fishing for suggestions and also comments on which other variables would benefit from such a scope.