Thanks, I tested this commit and it results in a consense error when aggregating the buses in cluster_network.py (I attached the error below).
I also see that on later commits these changes were reverted. I have pulled master branch but i get the same error as in my initial message.
Any thoughts on this? I am still trying to find where this location attribute is created during the electricity only workflow.
File "C:\Users\SE91723\Modelos\pypsa\pypsa-eur\.snakemake\scripts\
tmpf_3g62se.cluster_network.py", line 646, in <module>
clustering = clustering_for_n_clusters(
File "C:\Users\SE91723\Modelos\pypsa\pypsa-eur\.snakemake\scripts\
tmpf_3g62se.cluster_network.py", line 413, in clustering_for_n_clusters
clustering = get_clustering_from_busmap(
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pypsa\clustering\spatial.py", line 536, in get_clustering_from_busmap
buses = aggregatebuses(n, busmap, custom_strategies=bus_strategies)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pypsa\clustering\spatial.py", line 344, in aggregatebuses
aggregated = n.buses.groupby(busmap).agg(strategies)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\groupby\generic.py", line 1432, in aggregate
result = op.agg()
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\apply.py", line 190, in agg
return self.agg_dict_like()
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\apply.py", line 423, in agg_dict_like
return self.agg_or_apply_dict_like(op_name="agg")
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\apply.py", line 1608, in agg_or_apply_dict_like
result_index, result_data = self.compute_dict_like(
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\apply.py", line 496, in compute_dict_like
results = [
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\apply.py", line 497, in <listcomp>
getattr(obj._gotitem(key, ndim=1), op_name)(how, **kwargs)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\groupby\generic.py", line 294, in aggregate
return self._python_agg_general(func, *args, **kwargs)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\groupby\generic.py", line 327, in _python_agg_general
result = self._grouper.agg_series(obj, f)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\groupby\ops.py", line 863, in agg_series
result = self._aggregate_series_pure_python(obj, func)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\groupby\ops.py", line 884, in _aggregate_series_pure_python
res = func(group)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pandas\core\groupby\generic.py", line 324, in <lambda>
f = lambda x: func(x, *args, **kwargs)
File "C:\Users\SE91723\Anaconda3\envs\pypsa-eur\lib\site-packages\pypsa\clustering\spatial.py", line 136, in consense
assert (x == v).all() or x.isnull().all(), (
AssertionError: In Bus cluster location, the values of attribute location do not agree:
Bus
7928 7928
927 927
929 929
1004 1004
1005 1005
...
8655 8655
8508 8508
7814 7814
7825 7825
7106 7106
Name: location, Length: 748, dtype: object
[Mon Feb 19 10:05:37 2024]
Error in rule cluster_network:
jobid: 4
input: resources/2024-test/networks/
elec_s.nc, resources/2024-test/regions_onshore_elec_s.geojson, resources/2024-test/regions_offshore_elec_s.geojson, resources/2024-test/busmap_elec_s.csv, data/costs_2030_mod.csv
output: resources/2024-test/networks/
elec_s_2.nc, resources/2024-test/regions_onshore_elec_s_2.geojson, resources/2024-test/regions_offshore_elec_s_2.geojson, resources/2024-test/busmap_elec_s_2.csv, resources/2024-test/linemap_elec_s_2.csv
log: logs/2024-test/cluster_network/elec_s_2.log (check log file(s) for error details)