-
Notifications
You must be signed in to change notification settings - Fork 0
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
Initial setup of pp2psdm converter #12
base: main
Are you sure you want to change the base?
Conversation
# Conflicts: # poetry.lock # pp2psdm/conversion/pandapower.py # pp2psdm/grid.py # pp2psdm/io/utils.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.
Found some parts that could be improved.
"uuid": [node_index_uuid_map[idx] for idx in df.index], | ||
"geo_position": [ | ||
format_geo_position(geodata.iloc[idx]) for idx in range(len(df)) | ||
], | ||
"subnet": [get_default(row.get("zone"), 101) for _, row in df.iterrows()], |
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.
Will this cause issues in SIMONA? Because we have nodes in a different subgrids. This could be hard to detect. Maybe we could set a value like 0 or -1 here, to indicate a missing subgrid number.
|
||
def get_default(value, default): | ||
return value if not pd.isna(value) else default | ||
node_index_uuid_map = {idx: str(uuid4()) for idx in df.index} | ||
|
||
data_dict = { |
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 are no slack nodes in this dict. But we need one in SIMONA. Does pandapower specify a slack node?
g_us, b_us = line_param_conversion(row["c_nf_per_km"], row["g_us_per_km"]) | ||
|
||
# Collect data for each line | ||
line_data = { |
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 are missing the uuid
here.
|
||
autoTap = True if row["autoTap"] == 1 else False | ||
|
||
trafo_data = { |
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 are missing the uuid
here.
README.md
Outdated
```py | ||
from pypsdm import RawGridContainer | ||
from pp2psdm.grid import convert_grid | ||
|
||
### CI | ||
|
||
To give you a slap on the wrist if you did not apply the formatter or your tests don't pass there is a [Github Actions](https://github.com/features/actions) workflow at `.github/workflows/simple-ci.yml`. | ||
After pushing to the remote repository it checks out your code, installs all the dependencies then runs `flake8` for any code style issues and `black --check` to check the formatting. | ||
Depending on how that went you will see yourself either confronted with a friendly green tick or rather unfriendly red cross at the code window in github (or the `Actions` section of the github repository.) | ||
|
||
### Pre-Commit | ||
|
||
To reduce slaps on the wrist there is [pre-commit](https://pre-commit.com/) having your back. | ||
It installs pre-commit hooks that `black` and `flake8` before the CI gets a chance to complain. | ||
The types of git hooks are configured in `.pre-commit-config.yaml`. | ||
To install the hooks run `pre-commit install` once in the terminal at the project's root directory. | ||
|
||
### Dependabot | ||
|
||
To keep the dust off your dependencies [Dependabot](https://github.blog/2020-06-01-keep-all-your-packages-up-to-date-with-dependabot/) checks for new versions once a day (according to current cofigurations) and opens Pull-Requests in case it finds any newer versions. | ||
The configuration can be changed at `.github/dependabot.yml` | ||
Keep in mind that dependency updates can break your code. | ||
You safeguard yourself against this by making sure you have all your code tested and the dependency pull request does not break any of them. | ||
|
||
## Something Missing? | ||
|
||
We are happy to learn about additional tools for easing the developer workflow. | ||
Feel free to open an issue or pull-request to make suggestions. No newline at end of file | ||
pp_path = "/my/psdm_grid/path" | ||
psdm_grid = RawGridContainer.from_csv(psdm_path) | ||
pp_grid, uuid_idx_maps = convert_grid(psdm_grid) | ||
``` |
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 way we are converting a psdm into a pandapwer grid. It shoukd be the other way.
resolves #11