Our building data may have a special index, for example building addresses could define the index for more transparency elsewhere. Forcing a reset of this index in process_geometry() can cause inconveniences.
Specifically, I have a case where I want to use settings["heat_demand"] = "series" instead of a single P_heat_max value column. For this to work, the indices of the building geometry and the timeseries column names need to match.
They did match in my case, until the index of the geometry data got reset by process_geometry(). It is inconvenient to have to reset and synchronize both indexes beforehand.
Instead with commit 4b5560acef360818ba87eba2d749291b4c6a7dfa I propose a new argument 'reset_index : bool' to process_geometry(). Default is True. If set to False, the index is not reset.
Apart from simply not using .reset_index(), another important change was
if not reset_index:
# Connection lines are ordered the same as points. Match their indexes
lines_consumers.index = consumers.index
lines_producers.index = producers.index
Furthermore, everywhere a string like 'consumers-Hans-Straße 8' is later deconstructed to 'consumers' and 'Hans-Straße 8', .split('-', maxsplit=1) instead of .split('-') has to be used (which would yield 'Hans')
Even debugging can become easier, because now nodes can have names like 'consumers-ABC123' which may be easier to identify.
This can lead to errors if the index contains duplicates for some reason. But this is the user's responsibility if they set reset_index=False. A ValueError is thrown.
Our building data may have a special index, for example building addresses could define the index for more transparency elsewhere. Forcing a reset of this index in
process_geometry()
can cause inconveniences.Specifically, I have a case where I want to use settings["heat_demand"] = "series" instead of a single P_heat_max value column. For this to work, the indices of the building geometry and the timeseries column names need to match. They did match in my case, until the index of the geometry data got reset by
process_geometry()
. It is inconvenient to have to reset and synchronize both indexes beforehand.Instead with commit 4b5560acef360818ba87eba2d749291b4c6a7dfa I propose a new argument 'reset_index : bool' to process_geometry(). Default is True. If set to False, the index is not reset. Apart from simply not using .reset_index(), another important change was
Furthermore, everywhere a string like 'consumers-Hans-Straße 8' is later deconstructed to 'consumers' and 'Hans-Straße 8',
.split('-', maxsplit=1)
instead of.split('-')
has to be used (which would yield 'Hans')Even debugging can become easier, because now nodes can have names like 'consumers-ABC123' which may be easier to identify.
This can lead to errors if the index contains duplicates for some reason. But this is the user's responsibility if they set reset_index=False. A ValueError is thrown.