I have a PyPSA network with multilinks which I defined with the override_component_attrs
argument of pypsa.Network
.
When exporting and reimporting the network as netcfd or csv folder the non-standard attributes are lost.
Is there a way to keep the additionally defined attributes when exporting?
If you provide the same
override_component_attrs
dict that you used to create the network when loading thepypsa.Network
from file, the non-standard attributes are loaded as well. (They are always saved, just not loaded as ofpypsa=0.23.0
).Instead of duplicating code you can either either carry the
dict
over between along with your network:Or you create a common function which you call from your different scripts which creates a
Network
with the components overwritten and then callpypsa.Network.import_from_<netcdf|csv_folder>(...)
.