Skip to content

Commit 7e45e91

Browse files
committed
[ref #9] Improve Usage notebook; update documentation
1 parent 67546f3 commit 7e45e91

File tree

5 files changed

+166
-5
lines changed

5 files changed

+166
-5
lines changed

Usage.ipynb

Lines changed: 124 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
{
22
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"id": "intermediate-triangle",
6+
"metadata": {},
7+
"source": [
8+
"# Albatross Usage Information\n",
9+
"\n",
10+
"_Before using this notebook, make sure to follow the [installation](https://github.com/camirmas/albatross#installation) instructions._\n",
11+
"\n",
12+
"**Full installation and module documentation can be found at https://albatross-wind.readthedocs.io/en/latest/index.html**"
13+
]
14+
},
315
{
416
"cell_type": "code",
517
"execution_count": 1,
@@ -12,6 +24,26 @@
1224
"from albatross import WindTurbine, RequestParams"
1325
]
1426
},
27+
{
28+
"cell_type": "markdown",
29+
"id": "involved-hopkins",
30+
"metadata": {},
31+
"source": [
32+
"## The `requests` module\n",
33+
"\n",
34+
"This module is responsible for retrieving WIND Toolkit data.\n",
35+
"\n",
36+
"Full documentation can be found at https://albatross-wind.readthedocs.io/en/latest/requests.html"
37+
]
38+
},
39+
{
40+
"cell_type": "markdown",
41+
"id": "foreign-ethiopia",
42+
"metadata": {},
43+
"source": [
44+
"`get_regions` returns the full set of available regions with their configuration options. Its optional argument determines whether to pretty print the results alongside returning them."
45+
]
46+
},
1547
{
1648
"cell_type": "code",
1749
"execution_count": 2,
@@ -297,6 +329,14 @@
297329
"get_regions(True)"
298330
]
299331
},
332+
{
333+
"cell_type": "markdown",
334+
"id": "broke-salon",
335+
"metadata": {},
336+
"source": [
337+
"`identify_regions` returns the region associated with a given lat/lon point. By default, it does not make any network requests. However, the kwarg `coordinates=True` will make a network request to include all lat/lon data points associated with the region that includes the specified lat/lon point. Note that multiple regions might be returned: that is because some of the WIND Toolkit's bounding boxes overlap in some places."
338+
]
339+
},
300340
{
301341
"cell_type": "code",
302342
"execution_count": 3,
@@ -369,6 +409,14 @@
369409
"identify_regions(lat_lon, coordinates=True)"
370410
]
371411
},
412+
{
413+
"cell_type": "markdown",
414+
"id": "anonymous-arrangement",
415+
"metadata": {},
416+
"source": [
417+
"In order to make a request, let's first define our parameters using a `RequestParams` instance. We can see the valid fields using the class method `get_fields`. Note that the first four fields (`wind_speed`, `wind_direction`, `pressure`, and `temperature`) must be registered with a `height` parameter. "
418+
]
419+
},
372420
{
373421
"cell_type": "code",
374422
"execution_count": 6,
@@ -399,6 +447,14 @@
399447
"RequestParams.get_fields()"
400448
]
401449
},
450+
{
451+
"cell_type": "markdown",
452+
"id": "variable-camcorder",
453+
"metadata": {},
454+
"source": [
455+
"Here's an example point data request. Note that the region 'nw_pacific' is explicitly specified here. This is only necessary the given lat/lon point falls in multiple regions. Normally, the function will infer the region, so if you aren't sure, leave the `region` kwarg out and the function will raise an error with instructions if it encounters multiple regions."
456+
]
457+
},
402458
{
403459
"cell_type": "code",
404460
"execution_count": 7,
@@ -415,6 +471,14 @@
415471
"(data, meta) = request_wtk_point_data(lat_lon, year, rp.params, region='nw_pacific', resolution=\"5min\")"
416472
]
417473
},
474+
{
475+
"cell_type": "markdown",
476+
"id": "streaming-style",
477+
"metadata": {},
478+
"source": [
479+
"The result of this request is a `pandas.DataFrame` with all specified arguments included."
480+
]
481+
},
418482
{
419483
"cell_type": "code",
420484
"execution_count": 8,
@@ -552,6 +616,26 @@
552616
"data"
553617
]
554618
},
619+
{
620+
"cell_type": "markdown",
621+
"id": "subject-tournament",
622+
"metadata": {},
623+
"source": [
624+
"## The `analysis` module \n",
625+
"\n",
626+
"This module is responsible for generating insights from wind data. **This module does not require WIND Toolkit data specifically;** however, if you intend to use your own data, you'll need to specify which fields you want, or meet the field inference requirements as specified in the documentation for each function. In general, unless explicitly overridden, wind speed and direction fields will be **inferred** by looking for data columns that contain the strings `'windspeed'` and `'winddirection'`, respectively.\n",
627+
"\n",
628+
"Full module documentation can be found at https://albatross-wind.readthedocs.io/en/latest/analysis.html"
629+
]
630+
},
631+
{
632+
"cell_type": "markdown",
633+
"id": "attempted-recall",
634+
"metadata": {},
635+
"source": [
636+
"`boxplot` generates boxplots of wind speeds. It returns normal `matplotlib` objects for further modification."
637+
]
638+
},
555639
{
556640
"cell_type": "code",
557641
"execution_count": 9,
@@ -577,6 +661,14 @@
577661
"fig.set_figwidth(8)"
578662
]
579663
},
664+
{
665+
"cell_type": "markdown",
666+
"id": "cordless-iceland",
667+
"metadata": {},
668+
"source": [
669+
"`plot_windrose` generates a windrose plot from the given data. It uses the [windrose](https://github.com/python-windrose/windrose) Python package."
670+
]
671+
},
580672
{
581673
"cell_type": "code",
582674
"execution_count": 10,
@@ -598,6 +690,14 @@
598690
"ax = plot_windrose(data)"
599691
]
600692
},
693+
{
694+
"cell_type": "markdown",
695+
"id": "interracial-gospel",
696+
"metadata": {},
697+
"source": [
698+
"`pdf` generates a Weibull probability density plot from the given data. It returns `matplotlib` objects as well as parameters representing shape (2), location, and scale for the Weibull distribution."
699+
]
700+
},
601701
{
602702
"cell_type": "code",
603703
"execution_count": 11,
@@ -642,6 +742,14 @@
642742
"params"
643743
]
644744
},
745+
{
746+
"cell_type": "markdown",
747+
"id": "charged-given",
748+
"metadata": {},
749+
"source": [
750+
"`get_diurnal_stats` returns basic relevant diurnal wind speed statistics for the given data."
751+
]
752+
},
645753
{
646754
"cell_type": "code",
647755
"execution_count": 13,
@@ -972,6 +1080,14 @@
9721080
"get_diurnal_stats(data)"
9731081
]
9741082
},
1083+
{
1084+
"cell_type": "markdown",
1085+
"id": "aggregate-security",
1086+
"metadata": {},
1087+
"source": [
1088+
"`plot_diurnal_stats` plots basic relevant diurnal wind speed statistics for the given data."
1089+
]
1090+
},
9751091
{
9761092
"cell_type": "code",
9771093
"execution_count": 14,
@@ -995,6 +1111,14 @@
9951111
"(fig, ax, df) = plot_diurnal_stats(data)"
9961112
]
9971113
},
1114+
{
1115+
"cell_type": "markdown",
1116+
"id": "spoken-clinic",
1117+
"metadata": {},
1118+
"source": [
1119+
"`turbulence_std` Calculates the turbulence standard deviation. It requires a `WindTurbine` instance, which provides information about the turbulence intensity based on standard wind turbine specifications according to IEC-61400, Section 6.2."
1120+
]
1121+
},
9981122
{
9991123
"cell_type": "code",
10001124
"execution_count": 15,

albatross/analysis.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ def plot_windrose(data, speed=None, direction=None, **wr_kwargs):
112112

113113
def pdf(data, speed=None, hist_kwargs=None, plot_kwargs=None):
114114
"""
115-
Generates a windrose plot from the given data.
115+
Generates a Weibull probability density plot from the given data.
116116
117117
Args:
118118
data (DataFrame): Wind data

albatross/requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ def request_wtk_point_data(lat_lon, year, params, region=None, resolution=None,
229229

230230
def get_regions(pprint=False):
231231
"""
232-
Returns the full set of regions with their configuration options.
232+
Returns the full set of available regions with their configuration options.
233233
234234
Note that the `year_range` represents an inclusive (beginning, end), where
235235
any specified value within that range is a valid year for that region.

docs/index.rst

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,44 @@
1-
Welcome to albatross's documentation!
2-
=====================================
1+
albatross
2+
=========
3+
4+
``albatross`` is a Python package designed for wind energy analysis and visualization. It utilizes NREL's [Wind Integration National Dataset (WIND) Toolkit](https://www.nrel.gov/grid/wind-toolkit.html) and [REsource eXtraction (rex)](https://github.com/NREL/rex) package, and is inspired in part by a similar package aimed instead at Marine Renewable Energy, [MHKiT](https://github.com/MHKiT-Software/MHKiT-Python).
5+
6+
Features
7+
--------
8+
9+
``albatross`` consists of two primary modules:
10+
11+
* ``requests``:
12+
13+
* Request WIND Toolkit data by lat/lon point via HSDS
14+
* Read WIND Toolkit data from a local HDF5 file
15+
* Identify WIND Toolkit region and associated lat/lon coordinates, given a lat/lon point
16+
17+
* ``analysis``:
18+
19+
* Draw boxplots for inferred windspeed fields (or other specified fields)
20+
* Plot windrose chart for wind speed and direction data
21+
* Fit a Weibull distribution for wind speed data and plot a histogram/line chart showing probability density
22+
* Generate and/or plot diurnal statistics for wind speed data
23+
* Determine turbulence standard deviation using the Normal Turbulence model for wind data and a set of archetype wind turbine configurations
24+
25+
Future enhancements:
26+
27+
* multi-year requests
28+
* allow use of CSV for ``analysis`` module functions
29+
* further incorporate turbulence model statistics
30+
31+
Contents
32+
--------
333

434
.. toctree::
5-
:caption: Contents:
635

736
modules
837

938
.. toctree::
1039
:maxdepth: 1
1140

41+
installation
1242
proposal
1343

1444
Indices and tables

docs/installation.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
### Installation
2+
3+
`albatross` has not yet been hosted on PyPI, so for now, install from Github:
4+
5+
`pip install git+https://github.com/camirmas/albatross`
6+
7+
If you'll be using the `requests` module, you'll also need to [configure HSDS](https://github.com/NREL/hsds-examples#how-to-use).

0 commit comments

Comments
 (0)