-
Notifications
You must be signed in to change notification settings - Fork 7
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
84 add enums for all scenario input names #85
Conversation
@@ -183,7 +183,7 @@ def _maybeCreateDiagrams(arguments): | |||
return | |||
|
|||
diagramsFormat = arguments.diagramsFormat if arguments.diagramsFormat else "pdf" | |||
cmd = f"{_SCRIPTS_DIR / 'pyreverse'} -k -o {diagramsFormat} -p optihood -d test-results optihood" | |||
cmd = f"{_SCRIPTS_DIR / 'pyreverse'} -o {diagramsFormat} -p optihood -d test-results optihood" | |||
_printAndRun(cmd.split()) |
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.
Pyreverse ignores class attributes and methods when "-k" is used.
The new implementation thus provides better feedback.
} | ||
return nodes_data | ||
|
||
@staticmethod | ||
def get_values_from_dataframe(df: pd.DataFrame, identifier: str, identifier_column: str, desired_column: str): |
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 is a very common implementation in this part.
Putting it into a function should make this part more readable.
electricityCost = nodesData["commodity_sources"].loc[nodesData["commodity_sources"]["label"] == "electricityResource", "variable costs"].iloc[0] | ||
demandProfilesPath = nodesData["profiles"].loc[nodesData["profiles"]["name"] == "demand_profiles", "path"].iloc[0] | ||
weatherDataPath = nodesData["profiles"].loc[nodesData["profiles"]["name"] == "weather_data", "path"].iloc[0] | ||
electricityImpact = self.get_values_from_dataframe(nodesData[_ent.NodeKeys.commodity_sources.value], _ent.CommoditySourceTypes.electricityResource.value, _ent.CommoditySourcesLabels.label.value, _ent.CommoditySourcesLabels.CO2_impact.value) |
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.
First try of using the enums in the main code.
Currently this is very verbose.
Before using this throughout, we should discuss other options.
@@ -23,3 +23,215 @@ class CsvInputFilePathsRelative(_enum.StrEnum): | |||
storages = "storages.csv" | |||
stratified_storage = "stratified_storage.csv" | |||
profiles = "profiles.csv" | |||
|
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.
These entities are important for another project, where we will automatically be writing a lot of scenario files.
|
||
|
||
class BusesLabels(_enum.StrEnum): | ||
label = "label" |
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.
There is quite a bit of repetition here.
Perhaps, these can be combined somehow.
No description provided.