def assign_power_curve(self, wake_losses_model='power_efficiency_curve',
                           smoothing=False, block_width=0.5,
                           standard_deviation_method='turbulence_intensity',
                           smoothing_order='wind_farm_power_curves',
                           turbulence_intensity=None, **kwargs):
        r"""
        Calculates the power curve of a wind farm.

        The wind farm power curve is calculated by aggregating the power curves
        of all wind turbines in the wind farm. Depending on the parameters the
        power curves are smoothed (before or after the aggregation) and/or a
        wind farm efficiency (power efficiency curve or constant efficiency) is
        applied after the aggregation. After the calculations the power curve
        is assigned to the wind farm object.

        Parameters
        ----------
        wake_losses_model : string
            Defines the method for taking wake losses within the farm into
            consideration. Options: 'power_efficiency_curve',
            'constant_efficiency' or None. Default: 'power_efficiency_curve'.
        smoothing : boolean
            If True the power curves will be smoothed before or after the
            aggregation of power curves depending on `smoothing_order`.
            Default: False.
        block_width : float
            Width between the wind speeds in the sum of the equation in
            :py:func:`~.power_curves.smooth_power_curve`. Default: 0.5.
        standard_deviation_method : string
            Method for calculating the standard deviation for the Gauss
            distribution. Options: 'turbulence_intensity',
            'Staffell_Pfenninger'. Default: 'turbulence_intensity'.
        smoothing_order : string
            Defines when the smoothing takes place if `smoothing` is True.
            Options: 'turbine_power_curves' (to the single turbine power
            curves), 'wind_farm_power_curves'.
            Default: 'wind_farm_power_curves'.
        turbulence_intensity : float
            Turbulence intensity at hub height of the wind farm for power curve
            smoothing with 'turbulence_intensity' method. Can be calculated
            from `roughness_length` instead. Default: None.

        Other Parameters
        ----------------
        roughness_length : float, optional.
            Roughness length. If `standard_deviation_method` is
            'turbulence_intensity' and `turbulence_intensity` is not given
            the turbulence intensity is calculated via the roughness length.

        Returns
        -------
        self

        """
        # Check if all wind turbines have a power curve as attribute
        for item in self.wind_turbine_fleet:
            if item['wind_turbine'].power_curve is None:
                raise ValueError("For an aggregated wind farm power curve " +
                                 "each wind turbine needs a power curve " +
                                 "but `power_curve` of wind turbine " +
                                 "{} is {}.".format(
                                     item['wind_turbine'].name if
                                     item['wind_turbine'].name else '',
                                     item['wind_turbine'].power_curve))
        # Initialize data frame for power curve values
        df = pd.DataFrame()
        for turbine_type_dict in self.wind_turbine_fleet:
            # Check if all needed parameters are available and/or assign them
            if smoothing:
                if (standard_deviation_method == 'turbulence_intensity' and
                        turbulence_intensity is None):
                    if 'roughness_length' in kwargs:
                        # Calculate turbulence intensity and write to kwargs
                        turbulence_intensity = (
                            tools.estimate_turbulence_intensity(
                                turbine_type_dict['wind_turbine'].hub_height,
                                kwargs['roughness_length']))
                        kwargs['turbulence_intensity'] = turbulence_intensity
                    else:
                        raise ValueError(
                            "`roughness_length` must be defined for using " +
                            "'turbulence_intensity' as " +
                            "`standard_deviation_method` if " +
                            "`turbulence_intensity` is not given")
            if wake_losses_model is not None:
                if self.efficiency is None:
                    raise KeyError(
                        "`efficiency` is needed if " +
                        "`wake_losses_model´ is '{0}', but ".format(
                            wake_losses_model) +
                        "`efficiency` of wind farm {0} is {1}.".format(
                            self.name if self.name else '', self.efficiency))
            # Get original power curve
            power_curve = pd.DataFrame(
                turbine_type_dict['wind_turbine'].power_curve)
            # Editions to the power curves before the summation
            if smoothing and smoothing_order == 'turbine_power_curves':
                power_curve = power_curves.smooth_power_curve(
                    power_curve['wind_speed'], power_curve['value'],
                    standard_deviation_method=standard_deviation_method,
                    block_width=block_width, **kwargs)
            else:
                # Add value zero to start and end of curve as otherwise there
                # can occure problems during the aggregation
                if power_curve.iloc[0]['wind_speed'] != 0.0:
                    power_curve = pd.concat(
                        [pd.DataFrame(data={
                            'value': [0.0], 'wind_speed': [0.0]}),
                         power_curve], sort=True)
                if power_curve.iloc[-1]['value'] != 0.0:
                    power_curve = pd.concat(
                        [power_curve, pd.DataFrame(data={
                            'value': [0.0], 'wind_speed': [
                                power_curve['wind_speed'].loc[
                                    power_curve.index[-1]] + 0.5]})],
                        sort=True)
            # Add power curves of all turbine types to data frame
            # (multiplied by turbine amount)
            df = pd.concat(
                [df, pd.DataFrame(power_curve.set_index(['wind_speed']) *
                 turbine_type_dict['number_of_turbines'])], axis=1)
        # Aggregate all power curves
        wind_farm_power_curve = pd.DataFrame(
            df.interpolate(method='index').sum(axis=1))
        wind_farm_power_curve.columns = ['value']
        wind_farm_power_curve.reset_index('wind_speed', inplace=True)
        # Editions to the power curve after the summation
        if smoothing and smoothing_order == 'wind_farm_power_curves':
            wind_farm_power_curve = power_curves.smooth_power_curve(
                wind_farm_power_curve['wind_speed'],
                wind_farm_power_curve['value'],
                standard_deviation_method=standard_deviation_method,
                block_width=block_width, **kwargs)
        if (wake_losses_model == 'constant_efficiency' or
                wake_losses_model == 'power_efficiency_curve'):
            wind_farm_power_curve = (
                power_curves.wake_losses_to_power_curve(
                    wind_farm_power_curve['wind_speed'].values,
                    wind_farm_power_curve['value'].values,
                    wake_losses_model=wake_losses_model,
                    wind_farm_efficiency=self.efficiency))
        self.power_curve = wind_farm_power_curve
        return self