pypsa.Network.copy

Contents

pypsa.Network.copy#

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

Returns a deep copy of Network objec t.

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 tuple or pd.Index , default self.snapshots) – A list of snapshots to copy, must be a subset of n.snapshots. Pass an empty list ignore all snapshots.

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

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

  • with_time (boolean, default True) –

    Copy snapshots and time-varying n.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:

n – The copied network object.

Return type:

pypsa.Network

Examples

>>> network_copy = n.copy()