Open angusmcb opened 1 month ago
Thanks for bringing this to our attention, this is unintended behavior. node_type
and link_type
are used in the dictionary representation of a water network model (wn.to_dict
, wn.from_dict
), which combines junctions/reservoirs/tanks into nodes and pipes/pumps/valves into links. The dictionary representation is also used to convert water network models to/from GeoDataFrames (to_gis
calls to_dict
and from_gis
calls from_dict
). However, as you point out the object type should is known and should not change. We discussed an easy fix that will ensure, for example, the information in A.junctions will always be Junctions.
Summary Could be a bug or a feature.
When importing from a water network from_gis, the column 'node_type' (and 'link_type') is used to decide what type of node it is. Whist useful, this is an undocumented feature/bug and I think that normal behaviour would be that it is decided by whether it is in the 'junctions', 'tanks','reservoirs' dataframe instead.
In fact, 'node_type' is not listed as one of the valid column names.
Example I tweaked one of the tests from test_network.py:
Expected behaviour is no change - test should pass - because junctions would be detected as being junctions from the fact they are in the 'junctions' dataframe, rather than a property within the dataframe. (I realise this is really not the best example ).
Environment Provide information on your computing environment.