pypsa.Network.copy

Contents

pypsa.Network.copy#

Network.copy(snapshots: Collection = None, investment_periods: Collection = None, ignore_standard_types: bool = False, with_time: bool = None)#

Returns a deep copy of Network object.

If only default arguments are passed, the copy will be created via copy.deepcopy() and will contain all components and time-varying data. For most networks this is the fastest way. However, if the network is very large, it might be better to filter snapshots and investment periods to reduce the size of the copy. In this case copy.deepcopy() is not used and only the selected snapshots and investment periods are copied to a new object.

Parameters:
  • snapshots (list or index slice , default self.snapshots) – A list of snapshots to copy, must be a subset of network.snapshots. Pass an empty list ignore all snapshots.

  • investment_periods (list or index slice, default self.investment_period_weightings.index) – A list of investment periods to copy, must be a subset of network.investment_periods. Pass

  • ignore_standard_types (boolean, default False) – Ignore the PyPSA standard types.

  • with_time (boolean, default True) –

    Copy snapshots and time-varying network.component_names_t data too.

    Deprecated since version 0.29.0: Will be removed in a future version. Pass an empty list to ‘snapshots’ instead.

Returns:

network – The copied network object.

Return type:

pypsa.Network

Examples

>>> network_copy = network.copy()