<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def wind_speed_hub(self, weather_df):
 r""" Calculates the wind speed at hub height. The method specified by the parameter `wind_speed_model` is used. Parameters weather_df : pandas.DataFrame DataFrame with time series for wind speed `wind_speed` in m/s and roughness length `roughness_length` in m. The columns of the DataFrame are a MultiIndex where the first level contains the variable name (e.g. wind_speed) and the second level contains the height at which it applies (e.g. 10, if it was measured at a height of 10 m). See documentation of :func:`ModelChain.run_model` for an example on how to create the weather_df DataFrame. Returns ------- wind_speed_hub : pandas.Series or numpy.array Wind speed in m/s at hub height. Notes ----- If `weather_df` contains wind speeds at different heights the given wind speed(s) closest to the hub height are used. """

        if self.power_plant.hub_height in weather_df['wind_speed']:
            wind_speed_hub = weather_df['wind_speed'][
                self.power_plant.hub_height]
        elif self.wind_speed_model == 'logarithmic':
            logging.debug('Calculating wind speed using logarithmic wind '
                          'profile.')
            closest_height = weather_df['wind_speed'].columns[
                min(range(len(weather_df['wind_speed'].columns)),
                    key=lambda i: abs(weather_df['wind_speed'].columns[i] -
                                      self.power_plant.hub_height))]
            wind_speed_hub = wind_speed.logarithmic_profile(
                weather_df['wind_speed'][closest_height], closest_height,
                self.power_plant.hub_height,
                weather_df['roughness_length'].iloc[:, 0],
                self.obstacle_height)
        elif self.wind_speed_model == 'hellman':
            logging.debug('Calculating wind speed using hellman equation.')
            closest_height = weather_df['wind_speed'].columns[
                min(range(len(weather_df['wind_speed'].columns)),
                    key=lambda i: abs(weather_df['wind_speed'].columns[i] -
                                      self.power_plant.hub_height))]
            wind_speed_hub = wind_speed.hellman(
                weather_df['wind_speed'][closest_height], closest_height,
                self.power_plant.hub_height,
                weather_df['roughness_length'].iloc[:, 0],
                self.hellman_exp)
        elif self.wind_speed_model == 'interpolation_extrapolation':
            logging.debug('Calculating wind speed using linear inter- or '
                          'extrapolation.')
            wind_speed_hub = tools.linear_interpolation_extrapolation(
                weather_df['wind_speed'], self.power_plant.hub_height)
        elif self.wind_speed_model == 'log_interpolation_extrapolation':
            logging.debug('Calculating wind speed using logarithmic inter- or '
                          'extrapolation.')
            wind_speed_hub = tools.logarithmic_interpolation_extrapolation(
                weather_df['wind_speed'], self.power_plant.hub_height)
        else:
            raise ValueError("'{0}' is an invalid value. ".format(
                self.wind_speed_model) + "`wind_speed_model` must be "
                "'logarithmic', 'hellman', 'interpolation_extrapolation' " +
                "or 'log_interpolation_extrapolation'.")
        return wind_speed_hub