Skip to content

Commit 0ab3de1

Browse files
committed
docstrings and PEP8
1 parent 1b2a18a commit 0ab3de1

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

windpowerlib/modelchain.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def wind_speed_hub(self, weather_df):
318318

319319
def calculate_power_output(self, wind_speed_hub, density_hub):
320320
r"""
321-
Calculates the power output of the wind turbine. # todo power plant output????
321+
Calculates the power output of the wind power plant.
322322
323323
The method specified by the parameter `power_output_model` is used.
324324

windpowerlib/power_curves.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def smooth_power_curve(power_curve_wind_speeds, power_curve_values,
126126
raise ValueError("{} is no valid `standard_deviation_method`. Valid "
127127
+ "options are 'turbulence_intensity', or "
128128
+ "'Staffell_Pfenninger'".format(
129-
standard_deviation_method))
129+
standard_deviation_method))
130130
# Initialize list for power curve values
131131
smoothed_power_curve_values = []
132132
# Append wind speeds to `power_curve_wind_speeds`
@@ -225,7 +225,8 @@ def wake_losses_to_power_curve(power_curve_wind_speeds, power_curve_values,
225225
wake_losses_model, wind_farm_efficiency))
226226
df = pd.concat([power_curve_df.set_index('wind_speed'),
227227
wind_farm_efficiency.set_index('wind_speed')], axis=1)
228-
# Add column with reduced power (nan values of efficiency are interpolated)
228+
# Add column with reduced power (nan values of efficiency are
229+
# interpolated)
229230
df['reduced_power'] = df['power'] * df['efficiency'].interpolate(
230231
method='index')
231232
reduced_power = df['reduced_power'].dropna()

windpowerlib/wake_losses.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ def get_wind_efficiency_curve(curve_name='all'):
136136
# Raise error if wind efficiency curve specified in 'curve_name' does
137137
# not exist
138138
if curve_name not in list(wind_efficiency_curves):
139-
msg = ("Efficiency curve <{0}> does not exist. Must be one of the"
139+
msg = ("Efficiency curve <{0}> does not exist. Must be one of the"
140140
"following: {1}.")
141141
raise ValueError(msg.format(curve_name, *possible_curve_names))
142142

windpowerlib/wind_turbine.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ class WindTurbine(object):
6565
Diameter of the rotor in m. Default: None.
6666
power_coefficient_curve : None, pandas.DataFrame or dictionary
6767
Power coefficient curve of the wind turbine. DataFrame/dictionary must
68-
have 'wind_speed' and 'power coefficient' columns/keys with wind speeds
68+
have 'wind_speed' and 'power_coefficient' columns/keys with wind speeds
6969
in m/s and the corresponding power coefficients. Default: None.
7070
power_curve : None, pandas.DataFrame or dictionary
7171
Power curve of the wind turbine. DataFrame/dictionary must have
@@ -82,11 +82,12 @@ class WindTurbine(object):
8282
Notes
8383
------
8484
Your wind turbine object should have a power coefficient or power curve.
85-
You can set the `fetch_curve` parameter and the `data_source` parameter
86-
want to automatically fetch a curve from a data set provided in the Open
87-
Energy Database (oedb) or want to read a csv file that you provide.
85+
You can set the `fetch_curve` parameter and the `data_source` parameter if
86+
you want to automatically fetch a curve from a data set provided in the
87+
Open Energy Database (oedb) or want to read a csv file that you provide.
8888
See `example_power_curves.csv' and `example_power_coefficient_curves.csv`
89-
in example/data for the required form of such a csv file.
89+
in example/data for the required form of such a csv file (more columns can
90+
be added).
9091
9192
Examples
9293
--------
@@ -127,11 +128,10 @@ def fetch_turbine_data(self, fetch_curve, data_source):
127128
128129
Method fetches nominal power as well as power coefficient curve or
129130
power curve from a data set provided in the Open Energy Database
130-
(oedb). You can also use this function to import your own power
131-
(coefficient) curves from a file. For that the wind speeds in m/s have
132-
to be in the first row and the corresponding power coefficient curve
133-
values or power curve values in W in a row where the first column
134-
contains the turbine name.
131+
(oedb). You can also import your own power (coefficient) curves from a
132+
file. For that the wind speeds in m/s have to be in the first row and
133+
the corresponding power coefficient curve values or power curve values
134+
in W in a row where the first column contains the turbine name.
135135
See `example_power_curves.csv' and
136136
`example_power_coefficient_curves.csv` in example/data for the required
137137
form of a csv file (more columns can be added). See
@@ -350,7 +350,10 @@ def get_turbine_types(print_out=True):
350350
----------
351351
print_out : boolean
352352
Directly prints a tabular containing the turbine types in column
353-
'turbine_type'. Default: True.
353+
'turbine_type', the manufacturer in column 'manufacturer' and
354+
information about whether a power (coefficient) curve exists (True) or
355+
not (False) in columns 'has_power_curve' and 'has_cp_curve'.
356+
Default: True.
354357
355358
Examples
356359
--------
@@ -377,7 +380,7 @@ def get_turbine_types(print_out=True):
377380
p_curves_df = df.iloc[df.loc[df['has_power_curve'] == True].index][
378381
['manufacturer', 'turbine_type', 'has_power_curve']]
379382
curves_df = pd.merge(p_curves_df, cp_curves_df, how='outer',
380-
sort=True).fillna(False)
383+
sort=True).fillna(False)
381384
if print_out:
382385
pd.set_option('display.max_rows', len(curves_df))
383386
print(curves_df)

0 commit comments

Comments
 (0)