PyPSA is intended to be data format agnostic, but given the reliance internally on pandas DataFrames, it is natural to use comma-separated-variable (CSV) files.
Create a folder with CSVs for each component type (e.g. generators.csv, storage_units.csv
), then a CSV for each time-dependent variable (e.g. generators-p_max_pu.csv, loads-p_set.csv
). Then run :pypypsa.Network.import_from_csv_folder
Note
It is not necessary to add every single column, only those where values differ from the defaults listed in components
. All empty values/columns are filled with the defaults.
The network can be exported as a folder of csv files with :pypypsa.Network.export_to_csv_folder
.
Networks can also be built step-by-step for each component by calling :pypypsa.Network.add
. Likewise, components can also be removed with :pypypsa.Network.remove
.
Multiple components can be added by calling :pypypsa.Network.madd
. Multiple components can be removed by calling :pypypsa.Network.mremove
.
To add multiple components whose static attributes are given in a pandas DataFrame, use :pypypsa.Network.import_components_from_dataframe
To import time-varying information use :pypypsa.Network.import_series_from_dataframe
netCDF files take up less space than CSV files and are faster to load.
netCDF is also preferred over HDF5 because netCDF is structured more cleanly, is easier to use from other programming languages, can limit float precision to save space and supports lazy loading.
To export network and components to a netCDF file run :pypypsa.Network.export_to_netcdf
.
To import network data from netCDF file run :pypypsa.Network.import_from_netcdf
.
Note
netCDF is preferred over HDF5 because netCDF is structured more cleanly, is easier to use from other programming languages, can limit float precision to save space and supports lazy loading.
To export network and components to an HDF store run :pypypsa.Network.export_to_hdf5
.
To import network data from HDF5 store at path
run :pypypsa.Network.import_from_hdf5
.
PyPSA supports import from Pypower's ppc dictionary/numpy.array format version 2, see :pypypsa.Network.import_from_pypower_ppc
.
Warning
Importing from pandapower is still in beta; not all pandapower data is supported.
PyPSA supports import from pandapower using the function :pypypsa.Network.import_from_pandapower_net
.