Skip to content

Commit

Permalink
Rename examples according to modelchains
Browse files Browse the repository at this point in the history
  • Loading branch information
SabineHaas committed Dec 17, 2018
1 parent abd780d commit c1892d3
Show file tree
Hide file tree
Showing 16 changed files with 127 additions and 105 deletions.
12 changes: 6 additions & 6 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ Matplotlib can be installed using pip3 though some Linux users reported that it
Examples and basic usage
=========================

The basic usage of the windpowerlib is shown `here <http://windpowerlib.readthedocs.io/en/stable/basic_example_notebook.html>`_. The presented example is available as jupyter notebook and python script. You can download them along with example weather data:
The basic usage of the windpowerlib is shown in the `modelchain_example <http://windpowerlib.readthedocs.io/en/stable/basic_example_notebook.html>`_. The presented example is available as jupyter notebook and python script. You can download them along with example weather data:

* `Basic example (Python script) <https://raw.githubusercontent.com/wind-python/windpowerlib/master/example/basic_example.py>`_
* `Basic example (Jupyter notebook) <https://raw.githubusercontent.com/wind-python/windpowerlib/features/revise_example/example/basic_example.ipynb>`_
* `ModelChain example (Python script) <https://raw.githubusercontent.com/wind-python/windpowerlib/master/example/basic_example.py>`_
* `ModelChain example (Jupyter notebook) <https://raw.githubusercontent.com/wind-python/windpowerlib/features/revise_example/example/basic_example.ipynb>`_
* `Example data file <https://raw.githubusercontent.com/wind-python/windpowerlib/master/example/weather.csv>`_


To run the examples you first 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 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 <http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/install.html>`_ and
`how to run <http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html>`_ jupyter notebooks.

The usage of further functions are shown in a second example. As the basic usage example it is available as jupyter notebook and as python script. The weather data in this example is the same as in the example above.
Further functionalities, like the modelling of wind farms and wind turbine clusters, are shown in a second example. As the ModelChain example it is available as jupyter notebook and as python script. The weather data in this example is the same as in the example above.

* `Further example (Python script) <https://raw.githubusercontent.com/wind-python/windpowerlib/release_preparation/example/further_example.py>`_
* `Further example (Jupyter notebook) <https://raw.githubusercontent.com/wind-python/windpowerlib/release_preparation/example/basic_example.ipynb>`_
* `TurbineClusterModelChain example (Python script) <https://raw.githubusercontent.com/wind-python/windpowerlib/release_preparation/example/further_example.py>`_
* `TurbineClusterModelChain example (Jupyter notebook) <https://raw.githubusercontent.com/wind-python/windpowerlib/release_preparation/example/basic_example.ipynb>`_
* `Example data file <https://raw.githubusercontent.com/wind-python/windpowerlib/master/example/weather.csv>`_


Expand Down
10 changes: 5 additions & 5 deletions doc/example.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
.. autosummary::
:toctree: temp/

basic_example.get_weather_data
basic_example.initialize_wind_turbines
basic_example.calculate_power_output
basic_example.plot_or_print
basic_example.run_basic_example
modelchain_example.get_weather_data
modelchain_example.initialize_wind_turbines
modelchain_example.calculate_power_output
modelchain_example.plot_or_print
modelchain_example.run_example
10 changes: 5 additions & 5 deletions doc/example_2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
.. autosummary::
:toctree: temp/

further_example.initialize_wind_farms
further_example.initialize_wind_turbine_cluster
further_example.calculate_power_output
further_example.plot_or_print
further_example.run_example
turbine_cluster_modelchain_example.initialize_wind_farms
turbine_cluster_modelchain_example.initialize_wind_turbine_cluster
turbine_cluster_modelchain_example.calculate_power_output
turbine_cluster_modelchain_example.plot_or_print
turbine_cluster_modelchain_example.run_example
9 changes: 9 additions & 0 deletions doc/examples.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#############
Examples
#############


.. toctree::

modelchain_example_notebook
turbine_cluster_modelchain_example_notebook
9 changes: 0 additions & 9 deletions doc/examples_basic_and_further.rst

This file was deleted.

12 changes: 6 additions & 6 deletions doc/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ Matplotlib can be installed using pip3 though some Linux users reported that it
Examples and basic usage
=========================

The basic usage of the windpowerlib is shown :ref:`here <basic_example_notebook.ipynb>`. The presented example is available as jupyter notebook and python script. You can download them along with example weather data:
The basic usage of the windpowerlib is shown in the :ref:`modelchain_example <basic_example_notebook.ipynb>`. The presented example is available as jupyter notebook and python script. You can download them along with example weather data:

* :download:`Basic example (Python script) <../example/basic_example.py>`
* :download:`Basic example (Jupyter notebook) <../example/basic_example.ipynb>`
* :download:`ModelChain example (Python script) <../example/basic_example.py>`
* :download:`ModelChain example (Jupyter notebook) <../example/basic_example.ipynb>`
* :download:`Example data file <../example/weather.csv>`

To run the examples you first 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 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 <http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/install.html>`_ and
`how to run <http://jupyter-notebook-beginner-guide.readthedocs.io/en/latest/execute.html>`_ jupyter notebooks.

Further functionalities are shown in a second example. As the basic usage example it is available as jupyter notebook and as python script. The weather data in this example is the same as in the example above.
Further functionalities, like the modelling of wind farms and wind turbine clusters, are shown in a second example. As the ModelChain example it is available as jupyter notebook and as python script. The weather data in this example is the same as in the example above.

* :download:`Further example (Python script) <../example/further_example.py>`
* :download:`Further example (Jupyter notebook) <../example/further_example.ipynb>`
* :download:`TurbineClusterModelChain example (Python script) <../example/further_example.py>`
* :download:`TurbineClusterModelChain example (Jupyter notebook) <../example/further_example.ipynb>`
* :download:`Example data file <../example/weather.csv>`

Contributing
Expand Down
2 changes: 1 addition & 1 deletion doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Contents:
:glob:

getting_started
examples_basic_and_further
examples
whats_new
modules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Basic usage\n",
"# ModelChain example\n",
"\n",
"This example shows you the basic usage of the windpowerlib. \n",
"There are mainly three steps. First you have to import your weather data, then you need to specify your wind turbine, and in the last step call the windpowerlib functions to calculate the feedin time series.\n",
"This example shows you the basic usage of the windpowerlib by using the ``ModelChain`` class.\n",
"There are mainly three steps. First you have to import your weather data, then you need to specify your wind turbine, and in the last step call the windpowerlib functions to calculate the feed-in time series.\n",
"\n",
"Before you start you have to import the packages needed for these steps."
]
Expand Down
14 changes: 7 additions & 7 deletions doc/modules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,17 +193,17 @@ Additional functions used in the windpowerlib.
tools.estimate_turbulence_intensity


Basic example
==============
ModelChain example
==================

The basic example consists of the following functions.
The ``modelchain_example`` consists of the following functions.

.. include:: example.rst

Further example
===============
TurbineClusterModelChain example
================================

A further example consists of the following functions as well as uses functions
of the basic example.
The ``turbine_cluster_modelchain_example`` consists of the following functions
as well as it uses functions of the ``modelchain_example``.

.. include:: example_2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Further usage\n",
"# TurbineClusterModelChain example\n",
"\n",
"This example shows you the further usage of the windpowerlib. Functions that are used in the basic usage example, like the initialization of wind turbines, are imported and used without further explanations.\n",
"This example shows you how to calculate the power output of wind farms and wind turbine clusters with the windpowerlib. A cluster can be useful if you want to calculate the feed-in of a region for which you want to use one single weather data point.\n",
"\n",
"In this example the power output of a wind farm containing two different wind turbine types is calulated. Apart from that, this example shows you how to calculate the power output of a wind turbine cluster. A cluster can be useful if you want to calculate the feed-in of a region for which you want to use one single weather data grid point."
"Functions that are used in the ModelChain example, like the initialization of wind turbines, are imported and used without further explanations."
]
},
{
Expand All @@ -17,19 +17,19 @@
"source": [
"### Imports and initialization of wind turbines\n",
"\n",
"The import of weather data and the initialization of wind turbines is done as in the basic_example."
"The import of weather data and the initialization of wind turbines is done as in the ``modelchain_example``."
]
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"__copyright__ = \"Copyright oemof developer group\"\n",
"__license__ = \"GPLv3\"\n",
"\n",
"import basic_example\n",
"import modelchain_example as mc_e\n",
"from windpowerlib.turbine_cluster_modelchain import TurbineClusterModelChain\n",
"from windpowerlib.wind_turbine_cluster import WindTurbineCluster\n",
"from windpowerlib.wind_farm import WindFarm\n",
Expand All @@ -40,7 +40,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 2,
"metadata": {},
"outputs": [
{
Expand All @@ -59,11 +59,11 @@
],
"source": [
"# Get weather data\n",
"weather = basic_example.get_weather_data('weather.csv')\n",
"weather = mc_e.get_weather_data('weather.csv')\n",
"print(weather[['wind_speed', 'temperature', 'pressure']][0:3])\n",
"\n",
"# Initialize wind turbines\n",
"my_turbine, e126 = basic_example.initialize_wind_turbines()\n",
"my_turbine, e126 = mc_e.initialize_wind_turbines()\n",
"print()\n",
"print('nominal power of my_turbine: {}'.format(my_turbine.nominal_power))"
]
Expand All @@ -81,7 +81,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -100,7 +100,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -141,7 +141,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 5,
"metadata": {},
"outputs": [],
"source": [
Expand Down Expand Up @@ -169,7 +169,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand All @@ -194,7 +194,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -262,7 +262,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand All @@ -285,7 +285,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -319,6 +319,13 @@
" example_farm.power_output.plot(legend=True, label='example farm')\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
Expand Down
2 changes: 1 addition & 1 deletion doc/whatsnew/v0-1-0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ Documentation
Other changes
#############
* removed deprecated attributes (.ix)

* renamed examples according to modelchains

Contributors
############
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# Basic usage\n",
"# ModelChain example\n",
"\n",
"This example shows you the basic usage of the windpowerlib. \n",
"There are mainly three steps. First you have to import your weather data, then you need to specify your wind turbine, and in the last step call the windpowerlib functions to calculate the feedin time series.\n",
"This example shows you the basic usage of the windpowerlib by using the ``ModelChain`` class.\n",
"There are mainly three steps. First you have to import your weather data, then you need to specify your wind turbine, and in the last step call the windpowerlib functions to calculate the feed-in time series.\n",
"\n",
"Before you start you have to import the packages needed for these steps."
]
Expand Down
12 changes: 9 additions & 3 deletions example/basic_example.py → example/modelchain_example.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
"""
The ``basic_example`` module shows a simple usage of the windpowerlib.
The ``modelchain_example`` module shows a simple usage of the windpowerlib by
using the :class:`~.modelchain.ModelChain` class.
There are mainly three steps. First you have to import your weather data, then
you need to specify your wind turbine, and in the last step call the
windpowerlib functions to calculate the feed-in time series.
"""

Expand Down Expand Up @@ -227,7 +233,7 @@ def plot_or_print(my_turbine, e126):
print(e126.power_curve)


def run_basic_example():
def run_example():
r"""
Run the basic example.
Expand All @@ -239,4 +245,4 @@ def run_basic_example():


if __name__ == "__main__":
run_basic_example()
run_example()

0 comments on commit c1892d3

Please sign in to comment.