Skip to content

Commit be09792

Browse files
Birgit SchachlerBirgit Schachler
authored andcommitted
Merge branch 'dev' of github.com:wind-python/windpowerlib into dev
Conflicts: setup.py
2 parents fbc31fe + 81c63d4 commit be09792

File tree

11 files changed

+8825
-122
lines changed

11 files changed

+8825
-122
lines changed

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.0.2dev"
1+
__version__ = "0.0.4"

doc/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
# built documents.
6262
#
6363
# The short X.Y version.
64-
version = '0.0.1'
64+
version = '0.0.3'
6565
# The full version, including alpha/beta/rc tags.
6666
#release = 'beta'
6767

doc/whats_new.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ These are new features and improvements of note in each release
88
:local:
99
:backlinks: top
1010

11-
.. include:: whatsnew/v002.txt
11+
.. include:: whatsnew/v004.txt
12+
.. include:: whatsnew/v003.txt
1213
.. include:: whatsnew/v001.txt

doc/whatsnew/v002.txt

Lines changed: 0 additions & 27 deletions
This file was deleted.

doc/whatsnew/v003.txt

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
1-
v0.0.2 ()
1+
v0.0.3 (November 18, 2016)
22
+++++++++++++++++++++++++
33

4-
New features
5-
############
6-
7-
8-
Documentation
9-
#############
10-
11-
12-
Testing
13-
#######
14-
15-
16-
Bug fixes
17-
#########
18-
194

205
Other changes
216
#############
22-
7+
Allow installation of windpowerlib for python versions >3.4
8+
Import requests package instead of urllib5
239

2410
Contributors
2511
############
2612

27-
* name
13+
* Uwe Krien
14+
* Stephen Bosch
15+
* Birgit Schachler
16+
17+
Comment
18+
#######
19+
Release of v0.0.2 has been skipped due to a mistake in the release process.

doc/whatsnew/v004.txt

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
v0.0.4 ()
2+
+++++++++++++++++++++++++
3+
4+
New features
5+
############
6+
7+
* cp-values database file is now part of the repository and will be installed using pip/setup.py. The former download server was down due to technical problems and it might be safer not to be reliant on an external server.
8+
9+
10+
Documentation
11+
#############
12+
13+
14+
Testing
15+
#######
16+
17+
18+
Bug fixes
19+
#########
20+
21+
22+
Other changes
23+
#############
24+
25+
26+
Contributors
27+
############
28+
29+
* Uwe Krien

example/basic_example.py

Lines changed: 1 addition & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33

44
import pandas as pd
55
import logging
6-
import os
7-
from urllib.request import urlretrieve
86

97
try:
108
from matplotlib import pyplot as plt
@@ -40,36 +38,14 @@
4038
'wind_conv_type': 'VESTAS V 90 3000'}
4139

4240

43-
def download_file(filename, url):
44-
if not os.path.isfile(filename):
45-
logging.info('Copying weather data from {0} to {1}'.format(
46-
url, filename))
47-
urlretrieve(url, filename)
48-
49-
50-
def fetch_example_files():
51-
basic_path = os.path.join(os.path.expanduser("~"), '.oemof')
52-
filename_1 = os.path.join(basic_path, 'weather.csv')
53-
url1 = 'http://vernetzen.uni-flensburg.de/~git/weather.csv'
54-
filename_2 = os.path.join(basic_path, 'weather_wittenberg.csv')
55-
url2 = 'http://vernetzen.uni-flensburg.de/~git/weather_wittenberg.csv'
56-
if not os.path.exists(basic_path):
57-
os.makedirs(basic_path)
58-
download_file(filename_1, url1)
59-
download_file(filename_2, url2)
60-
return filename_1, filename_2
61-
62-
6341
def ready_example_data(filename, datetime_column='Unnamed: 0'):
6442
df = pd.read_csv(filename)
6543
return df.set_index(pd.to_datetime(df[datetime_column])).tz_localize(
6644
'UTC').tz_convert('Europe/Berlin').drop(datetime_column, 1)
6745

6846

69-
filename1, filename2 = fetch_example_files()
70-
7147
# Loading weather data
72-
weather_df = ready_example_data(filename1)
48+
weather_df = ready_example_data('weather.csv')
7349

7450
e126 = basicmodel.SimpleWindTurbine(**enerconE126)
7551
v90 = basicmodel.SimpleWindTurbine(**vestasV90)

example/weather.csv

Lines changed: 8761 additions & 0 deletions
Large diffs are not rendered by default.

setup.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@
33
@author: uwe
44
"""
55

6-
import sys
6+
import os
77
from setuptools import setup
88

9-
# check python version.
10-
if not sys.version_info[:2] in ((2, 7), (3, 3), (3, 4), (3, 5)):
11-
sys.exit('%s requires Python 2.7, 3.3, 3.4 or 3.5' % 'feedinlib')
12-
139
setup(name='windpowerlib',
14-
version='0.0.2dev',
10+
version='0.0.4',
1511
description='Creating time series from wind power plants.',
1612
url='http://github.com/wind-python/windpowerlib',
1713
author='oemof developing group',
1814
author_email='mail',
1915
license=None,
2016
packages=['windpowerlib'],
17+
package_data={
18+
'windpowerlib': [os.path.join('data', '*.csv')]},
2119
zip_safe=False,
2220
install_requires=['numpy >= 1.7.0',
23-
'pandas >= 0.13.1',
24-
'urllib5'])
21+
'pandas >= 0.13.1'])

windpowerlib/basicmodel.py

Lines changed: 15 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import logging
44
import numpy as np
55
import pandas as pd
6-
from urllib.request import urlretrieve
76

87

98
class SimpleWindTurbine:
@@ -293,7 +292,7 @@ def read_wpp_data(**kwargs):
293292
r"""
294293
Fetch cp values from a file or download it from a server.
295294
296-
The files are located in the ~/.oemof folder.
295+
The files are located in the data folder of the package root.
297296
298297
Returns
299298
-------
@@ -303,46 +302,21 @@ def read_wpp_data(**kwargs):
303302
304303
Other Parameters
305304
----------------
306-
cp_path : string, optional
307-
Path where the cp file is stored. Default: $HOME/.windpower
305+
datapath : string, optional
306+
Path where the cp file is stored. Default: '$PACKAGE_ROOT/data'
308307
filename : string, optional
309-
Filename of the cp file without suffix. The suffix of the file should be
310-
csv or hf5.
311-
url : string, optional
312-
URL from where the cp file is loaded if not present
313-
314-
Notes
315-
-----
316-
The files can be downloaded from
317-
http://vernetzen.uni-flensburg.de/~git/
308+
Filename of the cp file.
309+
318310
"""
319-
default_cp_path = os.path.join(os.path.expanduser("~"), '.windpower')
320-
cp_path = kwargs.get('cp_path', default_cp_path)
321-
filename = kwargs.get('filename', 'cp_values')
322-
filepath = os.path.join(cp_path, filename)
323-
url = kwargs.get(
324-
'url', 'http://vernetzen.uni-flensburg.de/~git/cp_values')
325-
suffix = '.hf5'
326-
if not os.path.exists(cp_path):
327-
os.makedirs(cp_path)
328-
if not os.path.isfile(filepath + suffix):
329-
urlretrieve(url + suffix, filepath + suffix)
330-
logging.info('Copying cp_values from {0} to {1}'.format(
331-
url, filepath + suffix))
332-
logging.debug('Retrieving cp values from {0}'.format(
333-
filename + suffix))
334-
try:
335-
df = pd.read_hdf(filepath + suffix, 'cp')
336-
except ValueError:
337-
suffix = '.csv'
338-
logging.info('Failed loading cp values from hdf file, trying csv.')
339-
logging.debug('Retrieving cp values from {0}'.format(
340-
filename + suffix))
341-
if not os.path.isfile(filename + suffix):
342-
urlretrieve(url + suffix, filename + suffix)
343-
logging.info('Copying cp_values from {0} to {1}'.format(
344-
url, filename + suffix))
345-
df = pd.read_csv(filename + suffix, index_col=0)
311+
if 'datapath' not in kwargs:
312+
kwargs['datapath'] = os.path.join(os.path.dirname(__file__), 'data')
313+
314+
if 'filename' not in kwargs:
315+
kwargs['filename'] = 'cp_values.csv'
316+
317+
cp_file = os.path.join(kwargs['datapath'], kwargs['filename'])
318+
319+
df = pd.read_csv(cp_file, index_col=0)
346320
return df
347321

348322

@@ -363,7 +337,7 @@ def get_wind_pp_types(print_out=True):
363337
(91, 2)
364338
>>> print(valid_types_df.iloc[5])
365339
rli_anlagen_id DEWIND D8 2000
366-
p_nenn 2000.0
340+
p_nenn 2000
367341
Name: 5, dtype: object
368342
"""
369343
df = read_wpp_data()

0 commit comments

Comments
 (0)