Giter Site home page Giter Site logo

wind-python / windpowerlib Goto Github PK

View Code? Open in Web Editor NEW
294.0 26.0 100.0 2.76 MB

The windpowerlib is a library to model the output of wind turbines and farms.

Home Page: https://oemof.org/

License: MIT License

Python 58.83% Jupyter Notebook 41.17%
wind energy power model modelling

windpowerlib's Introduction

image

image

image

image

image

image

Introduction

The windpowerlib is a library that provides a set of functions and classes to calculate the power output of wind turbines. It was originally part of the feedinlib (windpower and photovoltaic) but was taken out to build up a community concentrating on wind power models.

For a quick start see the Examples and basic usage section.

Documentation

Full documentation can be found at readthedocs.

Use the project site of readthedocs to choose the version of the documentation. Go to the download page to download different versions and formats (pdf, html, epub) of the documentation.

Installation

If you have a working Python 3 environment, use pypi to install the latest windpowerlib version:

pip install windpowerlib

The windpowerlib is designed for Python 3 and tested on Python >= 3.10. We highly recommend to use virtual environments. Please see the installation page of the oemof documentation for complete instructions on how to install python and a virtual environment on your operating system.

Optional Packages

To see the plots of the windpowerlib example in the Examples and basic usage section you should install the matplotlib package. Matplotlib can be installed using pip:

pip install matplotlib

Examples and basic usage

The simplest way to run the example notebooks without installing windpowerlib is to click here and open them with Binder.

The basic usage of the windpowerlib is shown in the ModelChain example that is available as jupyter notebook and python script:

To run the example you need example weather that is downloaded automatically and can also be downloaded here:

To run the examples locally you have to install the windpowerlib. To run the notebook you also need to install notebook using pip3. To launch jupyter notebook type jupyter notebook in the terminal. This will open a browser window. Navigate to the directory containing the notebook to open it. See the jupyter notebook quick start guide for more information on how to install and how to run jupyter notebooks. In order to reproduce the figures in a notebook you need to install matplotlib.

Further functionalities, like the modelling of wind farms and wind turbine clusters, are shown in the TurbineClusterModelChain example. As the ModelChain example it is available as jupyter notebook and as python script. The weather used in this example is the same as in the ModelChain example.

You can also look at the examples in the Examples section.

Wind turbine data

The windpowerlib provides data of many wind turbines but it is also possible to use your own turbine data.

Use internal data

The windpowerlib provides wind turbine data (power curves, hub heights, etc.) for a large set of wind turbines. See Initialize wind turbine in Examples section on how to use this data in your simulations.

The dataset is hosted and maintained on the OpenEnergy database (oedb). To update your local files with the latest version of the oedb turbine library you can execute the following in your python console:

from windpowerlib.data import store_turbine_data_from_oedb
store_turbine_data_from_oedb()

If you find your turbine in the database it is very easy to use it in the windpowerlib

from windpowerlib import WindTurbine
enercon_e126 = {
    "turbine_type": "E-126/4200",  # turbine type as in register
    "hub_height": 135,  # in m
}
e126 = WindTurbine(**enercon_e126)

We would like to encourage anyone to contribute to the turbine library by adding turbine data or reporting errors in the data. See the OEP for more information on how to contribute.

Use your own turbine data

It is possible to use your own power curve. However, the most sustainable way is to send us the data to be included in the windpowerlib and to be available for all users. This may not be possible in all cases.

Assuming the data files looks like this:

wind,power
0.0,0.0
3.0,39000.0
5.0,270000.0
10.0,2250000.0
15.0,4500000.0
25.0,4500000.0

You can use pandas to read the file and pass it to the turbine dictionary. I you have basic knowledge of pandas it is easy to use any kind of data file.

import pandas as pd
from windpowerlib import WindTurbine, create_power_curve
my_data = pd.read_csv("path/to/my/data/file.csv")

my_turbine_data = {
    "nominal_power": 6e6,  # in W
    "hub_height": 115,  # in m
    "power_curve": create_power_curve(
        wind_speed=my_data["wind"], power=my_data["power"]
    ),
}

my_turbine = WindTurbine(**my_turbine_data)

See the modelchain_example for more information.

Contributing

We are warmly welcoming all who want to contribute to the windpowerlib. If you are interested in wind models and want to help improving the existing model do not hesitate to contact us via github or email ([email protected]).

Clone: https://github.com/wind-python/windpowerlib and install the cloned repository using pip:

pip install -e /path/to/the/repository

As the windpowerlib started with contributors from the oemof developer group we use the same developer rules.

How to create a pull request:

  • Fork the windpowerlib repository to your own github account.
  • Change, add or remove code.
  • Commit your changes.
  • Create a pull request and describe what you will do and why.
  • Wait for approval.

Generally the following steps are required when changing, adding or removing code:

  • Add new tests if you have written new functions/classes.
  • Add/change the documentation (new feature, API changes ...).
  • Add a whatsnew entry and your name to Contributors.
  • Check if all tests still work by simply executing pytest in your windpowerlib directory:
pytest

Citing the windpowerlib

We use the zenodo project to get a DOI for each version. Search zenodo for the right citation of your windpowerlib version.

License

Copyright (c) 2019 oemof developer group

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

windpowerlib's People

Contributors

birgits avatar fwitte avatar kumar10725 avatar maurerle avatar pajot avatar sabinehaas avatar sasanjac avatar stickler-ci avatar thesethtruth avatar uvchik avatar vezeli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

windpowerlib's Issues

Changing the imports to absolute imports

I had some problems using single modules of the windpowerlib. Couldn't we use absolute imports as it is recommended in PEP8's import section.

Absolute imports are recommended, as they are usually more readable and tend to be better behaved (or at least give better error messages) if the import system is incorrectly configured (such as when a directory inside a package ends up on sys.path):

import mypkg.sibling
from mypkg import sibling
from mypkg.sibling import example

However, explicit relative imports are an acceptable alternative to absolute imports, especially when dealing with complex package layouts where using absolute imports would be unnecessarily verbose:

from . import sibling
from .sibling import example

Standard library code should avoid complex package layouts and always use absolute imports.

Implicit relative imports should never be used and have been removed in Python 3.

I could do that, but I do not want to cause merge conflicts. So tell me what you think about it. It is definitely not urgent.

BTW, oemof changed all imports to absolute imports with v0.2.0.

Remove check of python version in setup.py

The restriction to install the windpowerlib with python versions specified in the setup.py should be removed since the windpowerlib also works with newer python versions and might also work with python versions < 2.7. Instead of restricting the python version it should be pointed out in the README with which python version(s) the windpowerlib was tested and will definitely work.

Replace `ix` method

We should change line 288 and 299 of the modelchain module to avoid these warnings and possible errors in the future.

windpowerlib/modelchain.py:288: DeprecationWarning: 
  .ix is deprecated. Please use
  .loc for label based indexing or
  .iloc for positional indexing

New class WindTurbineGroup

In PR #63 @uvchik suggested an additional class WindTurbineGroup in order to have a cleaner initialization of the WindFarm class. As that PR was intended to allow specifying a WindFarm with a total installed capacity per turbine type and the discussion about this new class went beyond that topic, I decided to move it to a new issue. Important comments about the new class from the PR are:
#63 (comment)
#63 (comment)

Change parameter of requests.get()

The SSL certificate of the OEP has to be renewed. Until then the requests are done with verify= False, which should be set to True for the release.

Limits of pandas versions in windpowerlib v0.2.0

In v.0.1.2 pandas is limited to 'pandas >= 0.19.1, < 0.25.0'.

The concatenation of data frames here provokes a future warning:

FutureWarning: Sorting because non-concatenation axis is not aligned. A future version
  of pandas will change to not sort by default.
  
  To accept the future behavior, pass 'sort=False'.
  
  To retain the current behavior and silence the warning, pass 'sort=True'.

Following the recommendations of the warning (adding sort=True/False) pandas versions < 0.23.0 arenโ€™t working anymore.

This future warning was ignored in windpowerlib v.0.1.2 to be able to use it with older oemof versions (<=0.1.5).

For the v.0.2.0 release I propose to use the โ€˜sortโ€™ parameter.

Oedb connection not successful

When i run df = wt.get_turbine_types(print_out=False), from the example
i get ConnectionError: Database connection not successful. Response: [404].
I hit the URL with curl and got:

Moved Permanently

The document has moved here.

Delete example csv files

Example csv files in example/data are unnecessary now as the oedb csv files are provided along with the windpowerlib. The examples and documentation need to be adapted accordingly.

oemof installation

Have followed the installation procedure (Windows) step by step:

C:\Python\WPy64-3680\scripts>pip install oemof
Requirement already satisfied: oemof in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (0.2.3)
Requirement already satisfied: pyomo<5.6,>=4.4.0 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from oemof) (5.5.1)
Requirement already satisfied: dill<=0.2.8.5 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from oemof) (0.2.8.2)
Requirement already satisfied: networkx<2.3 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from oemof) (2.2)
Requirement already satisfied: numpy<1.16,>=1.7.0 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from oemof) (1.15.4)
Requirement already satisfied: pandas<0.24,>=0.18.0 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from oemof) (0.23.4)
Requirement already satisfied: six>=1.4 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from pyomo<5.6,>=4.4.0->oemof) (1.12.0)
Requirement already satisfied: appdirs in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from pyomo<5.6,>=4.4.0->oemof) (1.4.3)
Requirement already satisfied: PyUtilib>=5.6.3 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from pyomo<5.6,>=4.4.0->oemof) (5.6.5)
Requirement already satisfied: ply in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from pyomo<5.6,>=4.4.0->oemof) (3.11)
Requirement already satisfied: pyreadline>=1.7.1 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from dill<=0.2.8.5->oemof) (2.1)
Requirement already satisfied: decorator>=4.3.0 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from networkx<2.3->oemof) (4.3.2)
Requirement already satisfied: pytz>=2011k in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from pandas<0.24,>=0.18.0->oemof) (2018.9)
Requirement already satisfied: python-dateutil>=2.5.0 in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from pandas<0.24,>=0.18.0->oemof) (2.8.0)
Requirement already satisfied: nose in c:\python\wpy64-3680\python-3.6.8.amd64\lib\site-packages (from PyUtilib>=5.6.3->pyomo<5.6,>=4.4.0->oemof) (1.3.7)

C:\Python\WPy64-3680\scripts>

Here is what I got after running "oemof_installation_test" :


Solver installed with oemof:

cbc: not working
glpk: not working
gurobi: not working
cplex: not working


oemof successfully installed.


Looks like none of them is working on my computer...

Bug in wind_turbine.py

Hi,

first of all it's great to see this project coming together, and to see a lot of learnings from pvlib and other projects are being leveraged.

I just started having a look at the code, and my linter is yelling at me due to lines 340-341 of wind_turbine.py.

It looks like a pair of curly braces are missing:

raise ConnectionError("Database connection not successful. " +
                      "Error: {}".format(result.status_code))

instead of

raise ConnectionError("Database connection not successful. " +
                      "Error: ".format(result.status_code))

It's likely that the bug has not been spotted in tests because the error is only raised if the connection to the server fails.

Move examples to the oemof_examples repo

Move well documented examples to the oemof_examples repo. It is a good and central place for examples and people will be aware of the different tools of the oemof cosmos.

Improve documentation

This issue collects possible/necessary improvements to the documentation and examples:

  • document models in modelchains, e.g. explain or link to explanation of what different wind_speed_models do (modelchain @birgits, cluster modelchain @SabineHaas)
  • add axes labels to power output plots

Release v0.2.0 (due: end of July)

The v0.2.0 will have some API changes:

  • no p_nom column in power curve csv file (@SabineHaas)
  • name parameter of wind turbine, wind farm and wind turbine cluster as optional (or remove?) (@birgits) --> same for coordinates parameter?!
  • remove power_output attribute from wind turbine, wind farm and wind turbine cluster (@birgits)
  • remove installed_power attribute (@birgits )
  • use efficiency attribute for wake_losses_to_power_curve() instead of wake_losses_model parameter (@SabineHaas)
  • remove overwrite parameter from wind_turbine.get_turbine_data_from_oedb() (@SabineHaas)
  • remove deprecation warnings (@SabineHaas and @birgits)
  • remove fetch_curve and data_source parameters from WindTurbine (@SabineHaas)
  • adapt examples (@birgits)
  • check if tests are adapted, f.e. no fetch_curve parameter (@SabineHaas)
  • csv file containing all turbine data from oedb apart from curves (@SabineHaas)
  • Check if example/modelchain_example.ipynb was merged correctly (@birgits)
  • document changes in whats new (@SabineHaas, @birgits)

logging.info messag should be an error

In the wind_farm module line 399ff a logging message is shown if the wake_loss model 'wind_farm_efficiency' is chosen but no efficiency is given.

In my opinion an exception should be raised because the efficiency is mandatory to calculate the wake_losses. I think it is error prone to ignore it and to just show a logging info message.

power output of wind farm is sum of individual turbine?

based on the wind_farm.get_installed_power(), the power output of a wind farm is sum of individual turbine output without considering interference among turbines. Is there a more accurate method available?

def get_installed_power(self):
r"""
Calculates the installed power of the wind farm.
The installed power of wind farms is necessary when a
:class:~.wind_turbine_cluster.WindTurbineCluster object is used and
it's power weighed mean hub height is calculated with
:py:func:~.wind_turbine_cluster.WindTurbineCluster.mean_hub_height.
Returns
-------
float
Installed power of the wind farm.
"""
return sum(
wind_dict['wind_turbine'].nominal_power *
wind_dict['number_of_turbines']
for wind_dict in self.wind_turbine_fleet)

Sphinx documentation was not build due to notebook errors

I had a look at the sphinx documentation to check the API of a function and found out that the most actual version was build 6 month ago.

I fixed the requirements and the doctests but sphinx also checks the notebook in the docs folder.

Now we have three options

  1. Check the notebook within the pytests and switch off the sphinx test with nbsphinx_allow_errors = True in config.py (my preferred solution)
  2. Leave it as it is and repair the notebook (second best solution in my opinion)
  3. Switch off the sphinx test (bad solution)

I think the best place to test the examples is the test environment (1). If it does not work so easily we can let Sphinx (readthedocs) do the job (2). I think it is less comfortable because Sphinx/RTD can fail due to many reasons and it is not so clear. If we just switch it of we may not notice if the notebook is broken (3).

Shall we use structure and pep checker

In other oemof packages various structure and pep checkers are used. Shall we also integrate some of them. We can ask other contributors on the developer meeting and decide after/on the meeting.

This is a reminder, for the windpowerlib session at the oemof developer meeting in December (https://oemof.org/news/).

Use the wind_turbine module after importing the whole windpowerlib

At the moment it is not possible to use the wind_turbine module after importing the whole windpowerlib package. Is it intended to work like this or is it a bug? I think this behaviour is not very convenient.

import windpowerlib
turbine = {...}
windpowerlib.wind_turbine.WindTurbine(**turbine)

The code above raises an error but I think it should not.

AttributeError: module 'windpowerlib' has no attribute 'wind_turbine'

pytest does not work as intended

...at least as I think it is intended ๐Ÿ˜ It is not urgent but if I want to contribute I need to run the tests.

I tried it on a originally cloned repository.

pytest /path/to/local/git/windpowerlib/tests/ - works (collected 13 items)
pytest /path/to/local/git/windpowerlib/windpowerlib/ - works (collected 7 items)

pytest /path/to/local/git/windpowerlib/ - error (collected 22 items)

=================================================================================================================== ERRORS ====================================================================================================================
__________________________________________________________________________________________________________ ERROR collecting setup.py __________________________________________________________________________________________________________
git_local/windpowerlib/setup.py:16: in <module>
    'pandas >= 0.13.1'])
.virtualenv/oemof_cosmos/lib/python3.5/site-packages/setuptools/__init__.py:129: in setup
    return distutils.core.setup(**attrs)
/usr/lib/python3.5/distutils/core.py:134: in setup
    ok = dist.parse_command_line()
.virtualenv/oemof_cosmos/lib/python3.5/site-packages/setuptools/dist.py:439: in parse_command_line
    result = _Distribution.parse_command_line(self)
/usr/lib/python3.5/distutils/dist.py:472: in parse_command_line
    args = self._parse_command_opts(parser, args)
.virtualenv/oemof_cosmos/lib/python3.5/site-packages/setuptools/dist.py:754: in _parse_command_opts
    nargs = _Distribution._parse_command_opts(self, parser, args)
/usr/lib/python3.5/distutils/dist.py:521: in _parse_command_opts
    raise SystemExit("invalid command name '%s'" % command)
E   SystemExit: invalid command name '/home/uwe/git_local/windpowerlib'
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Interrupted: 1 errors during collection !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
=========================================================================================================== 1 error in 0.81 seconds ===========================================================================================================

BTW: pytest /path/to/local/git/oemof/works.

Change license to a permissive licence

The windpowerlib is a basic library that should be used in other libraries. The GPL3 makes it more complicate to use it in projects with permissive licenses such as BSD, MIT, Apache...

Therefore, I would like to change the license to a more permissive license.

The easy MIT licences could be a good choice.

Wind feedin ts contains values greater than nominal power

@SabineHaas As mentioned before, I tested the windpowerlib to find out whether the feedin exceeds the nominal power of a turbine. I used the following script:
https://gist.github.com/nesnoj/b275925d829cd03fce871e2e9d825490

  • The max. output is 5,8% larger than nominal power in this case
  • I used your example weather data weather.csv from the repo but I encountered the same behaviour with a different dataset
  • Similar results with different turbines (I tested E82/3000)

Is this due to an incorrect cp curve?

Original issue: reegis/reegis#9

Add readme.rst as long description on PyPi

In the release of v0.0.5 the README.rst file is interpreted as long description for the pypi page. Due to changes on the pypi-page this is not the case for v0.0.6.

Have a look at the setup.py file of oemof to see how we solved this issue for oemof by adding a long_description parameter to the setup call. This should automatically use the actual README.rst as long description on pypi if a release is uploaded. Therefore, we should fix it before the next release.

Set up CI and other useful tools to automatically check code/changes

  1. Creating a list of useful tools (have a look at other project such as oemof and pvlib)
  2. Discuss which tool might be useful for the windpowerlib.
  3. Implement the tools

LIST OF TOOLS:

Feel free add other services or to vote for the tools from the list above by adding a comment
(you can also extend the list if you have the rights)

Properties in rtd documentation

in PR53 properties were added. To have them appear in the documentation I added rst files for WindFarm and WindTurbineCluster documentation. Locally the build works as expected, but on rtd these changes don't seem to have any effect.

Review of v0.0.5

@birgits asked me to add my comments. Here they are ๐Ÿ˜„

  1. The windpowerlib use some of pvlib's concepts. I like it because it makes it easier for energy system modellers to understand the concept. Could you therefore rename the Modelchain to ModelChain.

  2. I would use the text from oemof for the Installation.

If you have a working Python3 environment, use pypi to install the latest oemof version.

pip install oemof

So far, the windpowerlib is mainly tested on python 3.4 but seems to work down to 2.7 
and for newer versions. Please see the installation page of the oemof documentation
for complete instructions on how to install python on your operating system.
  1. I liked the Basic Usage section from the old documentation. I would at least add an "How to use the ModelChain" to the documentation.

defective power key when fetching power curve

When running the notebook and initializing turbine enerconE126 the fetch_curve: power_curve parameter does not work as intended.

When in plotting section the keyword power is missing.
But when putting the explicit power curve of my_turbine there the power curve is plotted in the lower section.

enerconE126 = {
    'turbine_name': 'ENERCON E 126 7500',  # turbine name as in register
    'hub_height': 135,  # in m
    'rotor_diameter': 127,  # in m
    'fetch_curve': 'power_curve'  # fetch power curve
}
# initialise WindTurbine object
e126 = WindTurbine(**enerconE126)

Calculating turbine power output defective on my_turbine

This is the error provided by the notebook

KeyError                                  Traceback (most recent call last)
c:\python37\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
   3077             try:
-> 3078                 return self._engine.get_loc(key)
   3079             except KeyError:

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'values'

During handling of the above exception, another exception occurred:

KeyError                                  Traceback (most recent call last)
<ipython-input-31-9297154bc349> in <module>
      2 # initialise ModelChain with default parameters and use run_model
      3 # method to calculate power output
----> 4 mc_my_turbine = ModelChain(my_turbine).run_model(weather)
      5 # write power output timeseries to WindTurbine object
      6 my_turbine.power_output = mc_my_turbine.power_output

c:\python37\lib\site-packages\windpowerlib\modelchain.py in run_model(self, weather_df)
    404                        else self.density_hub(weather_df))
    405         self.power_output = self.turbine_power_output(wind_speed_hub,
--> 406                                                       density_hub)
    407         return self

c:\python37\lib\site-packages\windpowerlib\modelchain.py in turbine_power_output(self, wind_speed_hub, density_hub)
    335                         wind_speed_hub,
    336                         self.wind_turbine.power_curve['wind_speed'],
--> 337                         self.wind_turbine.power_curve['values'],
    338                         density_hub, self.density_correction))
    339         elif self.power_output_model == 'power_coefficient_curve':

c:\python37\lib\site-packages\pandas\core\frame.py in __getitem__(self, key)
   2686             return self._getitem_multilevel(key)
   2687         else:
-> 2688             return self._getitem_column(key)
   2689 
   2690     def _getitem_column(self, key):

c:\python37\lib\site-packages\pandas\core\frame.py in _getitem_column(self, key)
   2693         # get column
   2694         if self.columns.is_unique:
-> 2695             return self._get_item_cache(key)
   2696 
   2697         # duplicate columns & possible reduce dimensionality

c:\python37\lib\site-packages\pandas\core\generic.py in _get_item_cache(self, item)
   2487         res = cache.get(item)
   2488         if res is None:
-> 2489             values = self._data.get(item)
   2490             res = self._box_item_values(item, values)
   2491             cache[item] = res

c:\python37\lib\site-packages\pandas\core\internals.py in get(self, item, fastpath)
   4113 
   4114             if not isna(item):
-> 4115                 loc = self.items.get_loc(item)
   4116             else:
   4117                 indexer = np.arange(len(self.items))[isna(self.items)]

c:\python37\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance)
   3078                 return self._engine.get_loc(key)
   3079             except KeyError:
-> 3080                 return self._engine.get_loc(self._maybe_cast_indexer(key))
   3081 
   3082         indexer = self.get_indexer([key], method=method, tolerance=tolerance)

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas\_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

pandas\_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

KeyError: 'values'

Release v0.1.2 - to be release next week (24th of May) - please check if you have anything to add

  • save turbine library from database as csv instead of hdf5 (@SabineHaas)
  • kwargs in init of wind turbine, wind farm, wind turbine cluster (@birgits)
  • installed power as attribute or getter in wind farm and wind turbine cluster (@birgits)
  • document that cluster modelchain / wind farm (for aggregated power curve) requires wind turbines to have power curves (maybe additionally document how to convert power coefficient curve to power curve) (@birgits)
  • add deprecation warnings (@birgits)
  • check pandas version in setup.py (@birgits)
  • add oedb turbine library csv files to repo (@SabineHaas)
  • MOVED to v0.2.0: adapt parameter descriptions (now some are links some not or: string <--> str)

Simplify the way to use weather data with the windpowerlib

The weather data set for the windpowerlib has to have a very specific format. At the moment one has to pass a MultiIndex DataFrame with specific names and the data heights in the second level.

The format is useful but it seems to be a barrier for some users to convert their own weather data to this format.

This is a reminder, for the windpowerlib session at the oemof developer meeting in December (https://oemof.org/news/).

The release of v0.1.0 is coming up soon

The deadline of the first zero single release is the 16th of January at 2 pm.

  • Set the milestone to the next release if you will not be able to close your issue until the deadline of the v0.1.0 release.
  • Add all changes you made (fixes, enhancements,...) to the whatsnew-file and commit them.
  • Merge everything you want to release into the dev branch until the deadline. Later merges/commits will be ignored. Close the related issue.

Allow heights in modelchains weather_df multiindex to be strings

The weather_dfused in the ModelChain is required to be a multiindex dataframe in order to allow variables to be provided at different heights. At the ongoing developer meeting we decided to leave it this way but make its usage more convenient by allowing the heights to be provided as strings which occurs when a multiindex dataframe is read from a csv. @uvchik volunteered to implement it.

Travis tests fail as new version of pandas was released and there is no upper restriction for pandas in setup.py

All tests fail as there was a new pandas release on Jan 25 (0.24.0), which causes the following error in the examples:

weather_df.index = pd.to_datetime(weather_df.index).tz_localize(
            'UTC').tz_convert('Europe/Berlin')
E       AttributeError: 'Index' object has no attribute 'tz_localize'

I would restrict pandas to pandas >= 0.19.1, < 0.24 and check later if we can adapt the code to work with all versions. Do you agree?

How should we handle this for v0.1.0?

ModelChain example

**Hello,

I have installed oemof & windpowerlib and I am trying to run the ModelChain example. I downloaded the "ModelChain example (Python script)" and "Example data file" and put these two in the same folder. Then I used "Spyder" to open the "ModelChain example (Python script)" file and run it. Here is what I got from the console:**

Python 3.6.8 (tags/v3.6.8:3c6b436a57, Dec 24 2018, 00:16:47) [MSC v.1916 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 7.3.0 -- An enhanced Interactive Python.

runfile('C:/Python/Example/ModelChain/modelchain_example.py', wdir='C:/Python/Example/ModelChain')
Traceback (most recent call last):

File "", line 1, in
runfile('C:/Python/Example/ModelChain/modelchain_example.py', wdir='C:/Python/Example/ModelChain')

File "C:\Python\WPy64-3680\python-3.6.8.amd64\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
execfile(filename, namespace)

File "C:\Python\WPy64-3680\python-3.6.8.amd64\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Python/Example/ModelChain/modelchain_example.py", line 27, in
from windpowerlib import ModelChain

ImportError: cannot import name 'ModelChain'

It was saying that "ImportError: cannot import name 'ModelChain'". Not sure what is wrong ...

Tests fail due to failing database connection

Tests fail due to failing database connection.

bildschirmfoto_2019-02-04_10-08-25

It is not urgent, because most of the time the connection works but we should think of mid term solution. It does not look very good, when people come to our github page:

bildschirmfoto_2019-02-04_10-04-45

For me this is connected to the question: "Is it possible to use the windpowerlib offline?"

I triggered the build process again and now everything is fine. that shows clearly that it is just a database issue.

Add example or function to make it easier to use your own weather data

Weather data in the ModelChain currently needs to be a MultiIndex DataFrame. This has on the one hand the drawback that the data height can only be a scalar and on the other hand that it is not easy to use for people who have not worked with pandas alot.
Concerning the first issue I will wait for the feedinlib weather data class and maybe use ideas from it for the windpowerlib, so either also add a class or use xarray directly.
Concerning the second issue we should provide an example how to create a MultiIndex DataFrame.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.