Data Import and Export¶
See the module
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.
Import from folder of CSV files¶
Create a folder with CSVs for each component type
generators.csv, storage_units.csv), then a CSV for each
time-dependent variable (e.g.
loads-p_set.csv). Then run
Note that is 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.
Export to folder of CSV files¶
The network can be exported as a folder of csv files with
Adding and removing components one-by-one¶
Adding and removing multiple components¶
Adding components using pandas DataFrames¶
To add multiple components whose static attributes are given in a
pandas DataFrame, use
To import time-varying information use
Export to netCDF¶
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
Export to HDF5¶
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
Import from HDF5¶
To import network data from HDF5 store at
Import from Pypower¶
PyPSA supports import from Pypower’s ppc dictionary/numpy.array format
version 2, see