Skip to content

Commit 050cac5

Browse files
committed
Correct imports
1 parent f9ea722 commit 050cac5

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

example/basic_example.py

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@
88

99
import os
1010
import pandas as pd
11-
import numpy as np
1211

1312
try:
1413
from matplotlib import pyplot as plt
1514
except ImportError:
1615
plt = None
1716

18-
from windpowerlib import modelchain
19-
from windpowerlib import wind_turbine as wt
17+
from windpowerlib.modelchain import ModelChain
18+
from windpowerlib.wind_turbine import WindTurbine
2019

2120
# You can use the logging package to get logging messages from the windpowerlib
2221
# Change the logging level if you want more or less messages
@@ -108,7 +107,7 @@ def initialise_wind_turbines():
108107
'wind_speed': [0.0, 3.0, 5.0, 10.0, 15.0, 25.0]}) # in m/s
109108
}
110109
# initialise WindTurbine object
111-
my_turbine = wt.WindTurbine(**myTurbine)
110+
my_turbine = WindTurbine(**myTurbine)
112111

113112
# specification of wind turbine where power curve is provided
114113
# if you want to use the power coefficient curve add
@@ -119,7 +118,7 @@ def initialise_wind_turbines():
119118
'rotor_diameter': 127 # in m
120119
}
121120
# initialise WindTurbine object
122-
e126 = wt.WindTurbine(**enerconE126)
121+
e126 = WindTurbine(**enerconE126)
123122

124123
return my_turbine, e126
125124

@@ -149,28 +148,28 @@ def calculate_power_output(weather, my_turbine, e126):
149148
# power output calculation for my_turbine
150149
# initialise ModelChain with default parameters and use run_model method
151150
# to calculate power output
152-
mc_my_turbine = modelchain.ModelChain(my_turbine).run_model(weather)
151+
mc_my_turbine = ModelChain(my_turbine).run_model(weather)
153152
# write power output timeseries to WindTurbine object
154153
my_turbine.power_output = mc_my_turbine.power_output
155154

156155
# power output calculation for e126
157156
# own specifications for ModelChain setup
158157
modelchain_data = {
159-
'obstacle_height': 0, # default: 0
160158
'wind_speed_model': 'logarithmic', # 'logarithmic' (default),
161159
# 'hellman' or
162160
# 'interpolation_extrapolation'
163161
'density_model': 'ideal_gas', # 'barometric' (default), 'ideal_gas' or
164162
# 'interpolation_extrapolation'
165-
'temperature_model': 'linear_gradient', # 'linear_gradient' (def.) or
166-
# 'interpolation_extrapolation'
163+
'temperature_model': 'linear_gradient', # 'linear_gradient' (def.) or
164+
# 'interpolation_extrapolation'
167165
'power_output_model': 'power_curve', # 'power_curve' (default) or
168166
# 'power_coefficient_curve'
169167
'density_correction': True, # False (default) or True
168+
'obstacle_height': 0, # default: 0
170169
'hellman_exp': None} # None (default) or None
171170
# initialise ModelChain with own specifications and use run_model method
172171
# to calculate power output
173-
mc_e126 = modelchain.ModelChain(e126, **modelchain_data).run_model(weather)
172+
mc_e126 = ModelChain(e126, **modelchain_data).run_model(weather)
174173
# write power output timeseries to WindTurbine object
175174
e126.power_output = mc_e126.power_output
176175

windpowerlib/modelchain.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99
__license__ = "GPLv3"
1010

1111
import logging
12-
from windpowerlib import wind_speed, density, temperature, power_output, tools
13-
import pandas as pd
12+
from . import wind_speed, density, temperature, power_output, tools
1413

1514

1615
class ModelChain(object):

0 commit comments

Comments
 (0)