Update Clustering authored by Christine Nowak's avatar Christine Nowak
......@@ -48,7 +48,49 @@ Several errors were encountered, when developing/using this tool. The following
| description| what caused it/what to do|
| ------ | ------ |
| 'some number does not match expected number' | One of the mentioned number is twice the amount of buses in your `networks/elec_s.nc". Somewhere along the way some buses were lost and are missing in the output.|
| some error in a clustering routine yielding a list of country codes | Although you might not see it, the list contains different country codes but it shouldn't. Make sure that you don't create clusters that span across borders, as this causes issues. Use `n.buses` to see which bus should go into which country and check your result for differences. |
| some error in a clustering routine yielding a list of country codes | Although you might not see it, the list contains different country codes but it shouldn't. Make sure that you don't create clusters that span across borders, as this causes issues. Use `n.buses` to see which bus should go into which country and check your result for differences.
E.g. the thrown error can look like this:
> File "C:\ProgramData\Miniconda3\envs\pypsa-eur\lib\site-packages\pypsa\networkclustering.py", line 60, in consense
> assert ((x == v).all() or x.isnull().all()), (
> AssertionError: In Bus cluster country the values of attribute country do not agree:
> 8235 SE
> 8121 SE
> 8070 SE
> 5565 SE
> 6181 SE
> ..
> 8669 SE
> 7630 SE
> 8362 SE
> 8034 SE
> 8479 SE
> Name: country, Length: 137, dtype: object
Gain insight by altering the following code in ´C:\ProgramData\Miniconda3\envs\pypsa-eur\Lib\site-packages\pypsa\networkclustering.py´:
```
def _make_consense(component, attr):
def consense(x):
v = x.iat[0]
** # Troubleshooting error: AssertionError: In Bus cluster country the values of attribute country do not agree
with open("error_v.csv","w") as file:
file.write(str(v) + "\n")
x_df = pd.DataFrame(x)
x_df.to_csv("error_x_df.csv")**
assert ((x == v).all() or x.isnull().all()), (
"In {} cluster {} the values of attribute {} do not agree:\n{}"
.format(component, x.name, attr, x)
)
return v
return consense
```
Alter the differing country in the corresponding bus in your custom_busmap_elec_s_NUMBERNODES.csv and restart your snakemake command.
|
......
......