-
Notifications
You must be signed in to change notification settings - Fork 1
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
Feature/routine for decomissioning of exisiting capacity #78
Feature/routine for decomissioning of exisiting capacity #78
Conversation
…missioning-of-exisitng-capacity
& results from industy test
data_adapter_oemof/calculations.py
Outdated
if max_column in adapter_dict.keys(): | ||
if adapter_dict[capacity_column] == adapter_dict[max_column]: | ||
adapter_dict[max_column] = adapter_dict[capacity_column] / np.max( | ||
adapter_dict[capacity_column] | ||
) | ||
else: | ||
logging.info("Decommissioning and max value can not be set in parallel") | ||
adapter_dict[max_column] = list( | ||
(adapter_dict[max_column] / np.max(adapter_dict[capacity_column])) | ||
) | ||
else: | ||
adapter_dict[max_column] = adapter_dict[capacity_column] / np.max( | ||
adapter_dict[capacity_column] | ||
) |
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 explain whats happening in decommission function, as I don't quite get it from code alone?
Best to put in docstring directly...
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.
Baisicly I am just dividing the yealy changing capacity by the maximum capacity and then setting the max capacity as value for all years while using the quotient as value for max
I also wanted to check whether max value already is used and wheter it just is the same as the capacity value (as in data provided for steel industy)
Separating caluclaitons to happen pre and post calculation. Recalculation of activity bonds to be relative values. And then applying decommission logic helps to be certain about already existing max values. |
Moreover making it easier to adapt in future if more unexpected values occour.
…g-capacity # Conflicts: # data_adapter_oemof/adapters.py
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 Felix, thank you for starting to implement this.
I made some comments/requests for you.
One thing: the max/min in MIMO will look different and will not depend on output_parameters - just to keep that in mind.
Made following changes:
|
Will be adapting tests on dev to keep things at least a little separated. |
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.
Implementation looks good.
I have only smaller things regarding user feedback via logging, which could help us debugging.
Now including a nan value handler to replace nan values automatically if the parameter values differ over the periods. Replacing This feature is not meant to be used extensively since leaving values empty for some years is implicit and in most cases considered 0! |
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.
Have two questions
data_adapter_oemof/calculations.py
Outdated
if column in ["method", "source", "comment", "bandwidth_type"]: | ||
continue | ||
|
||
if group_df[column].nunique(dropna=False) > 1: |
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.
What does this line?
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.
It should make sure to only apply cahnges to columns with nan values. I modified to make the intention more clear.
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.
Somehow, GitHub marked the wrong line. I meant the part if group_df[column].nunique(dropna=False) > 1:
?
data_adapter_oemof/calculations.py
Outdated
if group_df[column].nunique(dropna=False) > 1: | ||
if column in max: | ||
group_df[column].fillna(max_value, inplace=True) | ||
elif column in min: |
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.
This could be removed, as next else statement looks the same
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.
Modified to raise an error if nan values are found in columns that cannot be derived as min/max.
Multi-Period cannot handle nan values for some Periods only as far as I know.
data_adapter_oemof/calculations.py
Outdated
@@ -214,10 +214,16 @@ def handle_nans(group_df: pd.DataFrame) -> pd.DataFrame: | |||
if column in ["method", "source", "comment", "bandwidth_type"]: | |||
continue | |||
|
|||
if group_df[column].nunique(dropna=False) > 1: | |||
if group_df.isna().sum>0: |
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 would remove this check completely as I think this costs more than simply fillna all columns which need to be checked...
data_adapter_oemof/calculations.py
Outdated
if "type" in group_df.columns: | ||
|
||
raise ValueError(f"In column {column} for process {group_df['type']} nan values are found" | ||
f"please make sure to only provide complete datasets") | ||
else: | ||
raise ValueError(f"In column {column} nan values are found" | ||
f"please make sure to only provide complete datasets") |
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.
This could cause us more trouble then letting None in there IMO.
So maybe not check for it instead...
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.
Yes it would but yet I am facing this issue again now with x2x dataset and it is hard to guess which dataset is faulty. The dataset has empty lists where also non empty lists are.
This data set has nans and lists in the same column.
Having an Error here or in data_adapter
would help since it is actually an error? We should not ignore and detect it somewhere (as early as possible)?
But maybe this should be discussed in another issue?
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.
Having an Error here or in
data_adapter
would help since it is actually an error? We should not ignore and detect it somewhere (as early as possible)?
But I think there will be many cases in datasets where this is the case - and I don't see people fixing datasets quick enough. So better be prepared for None values and ignore them as far as possible (tabular sets default values in most cases)?
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.
Tabular will not be able to set default values since currently it is impossible to know which values are missing. We are loosing information if single entries are missing because tabular is receiving a list for changing values. If the list is shorter than the amount of periods we will not know anymore which years value has gone missing.
Maybe we can adjust the reading of datapackage in tabular to use pass a nan if a string is (eg. "nan") is found in such a list?
92635d0
to
d9e872d
Compare
Adding in Decommissioning for stock processes fading out.
max
values