Skip to content

Commit

Permalink
Merge pull request #156 from NREL/develop
Browse files Browse the repository at this point in the history
FLASC v1.5
  • Loading branch information
christiannvaughn authored Dec 21, 2023
2 parents 49631a0 + b3080f1 commit 06f9009
Show file tree
Hide file tree
Showing 102 changed files with 10,827 additions and 10,454 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,4 @@ body:
validations:
required: false
required: false
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ blank_issues_enabled: false
contact_links:
- name: GitHub Discussions
url: https://github.com/NREL/flasc/discussions/new
about: Discuss potential issues or ideas here prior to opening a GitHub Issue
about: Discuss potential issues or ideas here prior to opening a GitHub Issue
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/documentation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Documentation
description: Report incorrect documentation or describe new documentation
title: "[Documentation]: <title>"
labels: "Type: Documentation"
body:
body:
- type: textarea
id: doc-issue
attributes:
Expand All @@ -18,4 +18,4 @@ body:
label: URL
description: If this issue references online documentation, enter the complete url here.
placeholder:
https://nrel.github.io/flasc//<full link here>.html
https://nrel.github.io/flasc//<full link here>.html
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Feature
description: Submit a detailed feature request
title: "[Feature]: <title>"
labels: 'Type: Enhancement'
body:
body:
- type: textarea
id: feature-description
attributes:
Expand All @@ -17,4 +17,4 @@ body:
id: relevant-links
attributes:
label: Related URLs
description: If this feature request is derived from a GitHub Issue or Discussion, enter the url here.
description: If this feature request is derived from a GitHub Issue or Discussion, enter the url here.
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@
- [ ] docs/source/conf.py
- [ ] flasc/VERSION
- [ ] Create a tag in the NREL/FLASC repository
-->
-->
4 changes: 2 additions & 2 deletions .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ jobs:
run: |
python -m pip install --upgrade pip
pip install -e ".[develop]"
- uses: pre-commit/action@v3.0.0
- name: Run tests and collect coverage
run: |
# -rA displays the captured output for all tests after they're run
Expand All @@ -35,11 +36,10 @@ jobs:
pip install pytest
pip install pytest-cov
pytest --cov=./ --cov-report=xml tests/
- name: Upload coverage to Codecov
- name: Upload coverage to Codecov
if: ${{ env.CODECOV_TOKEN }} # Don't attempt to upload if the codecov token is not configured
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true

2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ _build
docs/build
SMARTEOLE_WakeSteering_ReadMe.xlsx
SMARTEOLE_WakeSteering_Map.pdf
SMARTEOLE-WFC-open-dataset.zip
SMARTEOLE-WFC-open-dataset.zip
26 changes: 26 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-executables-have-shebangs
- id: check-yaml
args: [--unsafe]
- id: check-merge-conflict
- id: check-symlinks
- id: mixed-line-ending

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.7
hooks:
# Run the linter.
- id: ruff
types_or: [ python, pyi, jupyter ]
args: [ --fix ]
# Run the formatter.
- id: ruff-format
types_or: [ python, pyi, jupyter ]
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@

## Description

FLASC provides a **rich suite of analysis tools** for SCADA data filtering, analysis,
wind farm model validation, field experiment design, and field experiment monitoring.
FLASC provides a **rich suite of analysis tools** for SCADA data filtering, analysis,
wind farm model validation, field experiment design, and field experiment monitoring.

The repository is centrally built around NRELs in-house ``FLORIS`` wind farm model, available at
**https://github.com/nrel/floris**. FLASC also largely relies on the ``energy ratio``, among others,
to quantify wake losses in synthetic and historical data, to perform turbine northing calibrations,
**https://github.com/nrel/floris**. FLASC also largely relies on the ``energy ratio``, among others,
to quantify wake losses in synthetic and historical data, to perform turbine northing calibrations,
and model parameter estimation.

For technical questions or concerns, please email paul.fleming@nrel.gov.
Expand All @@ -27,7 +27,9 @@ For technical questions or concerns, please email paul.fleming@nrel.gov.
We recommend installing this repository in a separate virtual environment.
After creating a new virtual environment, clone this repository to your local
system and install it locally using ``pip``. The command for this is ``pip install -e flasc``.


If installing for develop, follow the developer [install instructions](https://nrel.github.io/flasc/installation.html)

## Documentation

Documentation is provided via the included examples folders as well as [online documentation](https://nrel.github.io/flasc/).
Expand Down
14 changes: 7 additions & 7 deletions docs/data_processing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ This function also deals with 360-degree wrapping for nacelle headings and
wind direction measurements, as specified by the ``circular_cols`` option.

After each turbine's measurements are sampled onto a common time vector, they
can straightforwardly be appended into a single, wide-formatted table
can straightforwardly be appended into a single, wide-formatted table
(which in Python is a ``pd.DataFrame``). A common way to format a long table
into a wide table, assuming they all share the same ``date`` vector, is:

Expand All @@ -98,7 +98,7 @@ Data filtering
==============

With the SCADA data now in a wide-formatted Pandas DataFrame, the flasc
data filtering tools can readily be applied. The files in
data filtering tools can readily be applied. The files in
``examples_artifical_data/raw_data_processing`` demonstrate how the SCADA data files are
processed.

Expand All @@ -109,7 +109,7 @@ a_00_initial_download.py
The first script, ``a_00_initial_download.py``, simply demonstrates how the raw data is imported. This
basically compromises of the previous two steps, being data downloading and
formatting it into a wide table format. Data is typically saved within flasc
using the
using the
`feather format <https://arrow.apache.org/docs/python/feather.html>`_, which
is known for its excellent IO speed and its efficient storage, being often a
factor 10 smaller than a similar .csv file.
Expand Down Expand Up @@ -317,7 +317,7 @@ turbine 3 and a comparable signal of the met mast. Here, that signal is the
wind direction, which should be comparable between the two turbines.
Note that we have not yet calibrated the turbine's wind direction to
true north, so we may have an offset anywhere between -180 and +180 deg
compared to the met mast signal. The algorithm in
compared to the met mast signal. The algorithm in
``a_06a_determine_timeshift_datasources.py`` accommodates for that by
calculating and subtracting the mean difference in wind directions over
the entire time period. The assign the measurement(s) to compare in
Expand All @@ -338,7 +338,7 @@ a_06b_apply_timeshift_dfs.py (optional)
+++++++++++++++++++++++++++++++++++++++
The optimal time shift found in ``a_06a_determine_timeshift_datasources.py``
is used in this script to shift the time vector of one of the two dataframes
so that they are synchronized with the other dataframe.
so that they are synchronized with the other dataframe.

+++++++++++++++++++++++++++++++++++++
a_07a_estimate_wd_bias_per_turbine.py
Expand Down Expand Up @@ -379,7 +379,7 @@ the average difference between the wind direction signals of the calibrated
turbine and any other (uncalibrated) turbine, and that becomes the bias
correction that the turbine needs. We can determine the shift between
two turbine's wind direction signals using the ``match_y_curves_by_offset``
function, as demonstrated in the example script
function, as demonstrated in the example script
``a_07a_estimate_wd_bias_per_turbine.py``.

For more information how the subtleties about calculating the energy ratio,
Expand Down Expand Up @@ -414,4 +414,4 @@ the example and documentation surrounding the energy ratio analysis suite.
:align: center


.. seealso:: `Return to table of contents <index.html>`_
.. seealso:: `Return to table of contents <index.html>`_
2 changes: 1 addition & 1 deletion docs/energy_ratio.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ Key syntax for computing energy ratios is provided in the examples:
Within the set of analysis of the smarteole dataset are also exmaples of using flasc's energy ratio calculations. See for example:

- [Baseline Energy Ratio Analysis](https://github.com/NREL/flasc/blob/main/examples_smarteole/05_baseline_energy_ratio_analysis.ipynb)
- [Wake Steering Energy Ratio Analysis](https://github.com/NREL/flasc/blob/main/examples_smarteole/06_wake_steering_energy_ratio_analysis.ipynb)
- [Wake Steering Energy Ratio Analysis](https://github.com/NREL/flasc/blob/main/examples_smarteole/06_wake_steering_energy_ratio_analysis.ipynb)
4 changes: 2 additions & 2 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ clock or timezone.
Raw data processing
===================
Once the artificial dataset has been generated, it should be filtered and
postprocessed using the steps described in
postprocessed using the steps described in
`Raw data processing <data_processing.html>`_. This will filter the SCADA data
for measurement outliers and deal with northing calibration.

Expand All @@ -53,4 +53,4 @@ analyses. See `Data analysis <data_analysis.html>`_ for examples on how to
derive useful information from the data, such as for model tuning and model
validation.

.. seealso:: `Return to table of contents <index.html>`_
.. seealso:: `Return to table of contents <index.html>`_
6 changes: 3 additions & 3 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

Welcome to the documentation of the NREL FLASC repository!

FLASC provides a rich suite of analysis tools for SCADA data filtering &
analysis, wind farm model validation, field experiment design, and field
FLASC provides a rich suite of analysis tools for SCADA data filtering &
analysis, wind farm model validation, field experiment design, and field
experiment monitoring. The repository is centrally built around NRELs
in-house [FLORIS](https://github.com/NREL/floris/discussions/)
wake modeling utility.
Expand All @@ -14,4 +14,4 @@ losses in synthetic and historical data, to perform turbine northing
calibrations, and for model parameter estimation.

The FLASC repository is intended as a community driven toolbox, available on
its [GitHub Repository](https://github.com/NREL/flasc).
its [GitHub Repository](https://github.com/NREL/flasc).
2 changes: 1 addition & 1 deletion docs/licensing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ For more information, contact the NREL FLASC team at
limitations under the License.
.. seealso:: `Return to table of contents <index.html>`_
.. seealso:: `Return to table of contents <index.html>`_
4 changes: 2 additions & 2 deletions docs/overview.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Overview

FLASC provides a rich suite of analysis tools for SCADA data filtering &
analysis, wind farm model validation, field experiment design, and field
FLASC provides a rich suite of analysis tools for SCADA data filtering &
analysis, wind farm model validation, field experiment design, and field
experiment monitoring. The repository is centrally built around NRELs
in-house [floris](https://github.com/nrel/floris) wake modeling utility.
FLASC also largely relies on the energy ratio to, among others, quantify wake
Expand Down
6 changes: 3 additions & 3 deletions docs/references.bib
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ @article{Doekemeijer2022a
note = "In review",
}

@article{Bay2022a,
author={C J Bay and P A Fleming and B M Doekemeijer and J King and M Churchfield and R Mudafort},
@article{Bay2022a,
author={C J Bay and P A Fleming and B M Doekemeijer and J King and M Churchfield and R Mudafort},
TITLE = {Addressing Deep Array Effects and Impacts to Wake Steering with the Cumulative-Curl Wake Model},
JOURNAL = {Wind Energy Science Discussions},
VOLUME = {2022},
Expand All @@ -20,4 +20,4 @@ @article{Bay2022a
__URL = {https://wes.copernicus.org/preprints/wes-2021-32/},
__DOI = {10.5194/wes-2021-32},
note = {In preparation},
}
}
2 changes: 1 addition & 1 deletion docs/total_uplift.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

Total uplift in energy production can be computed from one dataframe to another. It uses a similar input as the [energy ratio](energy_ratio) but returns a single value representing the total uplift, rather then binned by wind direction.

Currently the main example usage of the total uplift function is at the end of [smarteole example 06](https://github.com/NREL/flasc/blob/main/examples_smarteole/06_wake_steering_energy_ratio_analysis.ipynb)
Currently the main example usage of the total uplift function is at the end of [smarteole example 06](https://github.com/NREL/flasc/blob/main/examples_smarteole/06_wake_steering_energy_ratio_analysis.ipynb)
Original file line number Diff line number Diff line change
Expand Up @@ -11,72 +11,65 @@
# the License.


import os
import matplotlib.pyplot as plt
import numpy as np

from flasc.utilities_examples import load_floris_artificial as load_floris
from flasc.visualization import (
plot_floris_layout,
plot_layout_only,
plot_layout_with_waking_directions,
shade_region
shade_region,
)

from flasc.utilities_examples import load_floris_artificial as load_floris


# Example demonstrates some methods for visualizing the layout of the farm
# represented within the FLORIS interface


if __name__ == "__main__":

# Set up FLORIS interface
print('Initializing the FLORIS object for our demo wind farm')
print("Initializing the FLORIS object for our demo wind farm")
fi, _ = load_floris()

# Defines alternative names for each turbine with 1-index
turbine_names = ['Turbine-%d' % (t + 1) for t in range(len(fi.layout_x))]

turbine_names = ["Turbine-%d" % (t + 1) for t in range(len(fi.layout_x))]

# Plot using default 0-indexed labels (includes power/thrust curve)
plot_floris_layout(fi, plot_terrain=False)
plot_floris_layout(fi, plot_terrain=False)

# Plot using default given 1-indexed labels (includes power/thrust curve)
plot_floris_layout(fi, plot_terrain=False, turbine_names=turbine_names)
plot_floris_layout(fi, plot_terrain=False, turbine_names=turbine_names)

# Plot only the layout with default options
plot_layout_only(fi)

# Plot only the layout with custom options
plot_layout_only(fi,
{
'turbine_names':turbine_names,
'color':'g'
}
)
plot_layout_only(fi, {"turbine_names": turbine_names, "color": "g"})

# Plot layout with wake directions and inter-turbine distances labeled
plot_layout_with_waking_directions(fi)

# Plot layout with wake directions and inter-turbine distances labeled
# (using custom options)
plot_layout_with_waking_directions(fi,
limit_num = 3, # limit to 3 lines per turbine
layout_plotting_dict = {'turbine_names':turbine_names,
'turbine_indices':range(2,len(fi.layout_x))},
wake_plotting_dict={'color':'r'}
plot_layout_with_waking_directions(
fi,
limit_num=3, # limit to 3 lines per turbine
layout_plotting_dict={
"turbine_names": turbine_names,
"turbine_indices": range(2, len(fi.layout_x)),
},
wake_plotting_dict={"color": "r"},
)

# Demonstrate shading of an arbitrary region
points_for_demo = np.array([[600, 0], [1400, 0], [1200, 1000]])
ax = plot_layout_only(fi)
shade_region(
points_for_demo,
points_for_demo,
show_points=True,
plotting_dict_region={"color":"blue", "label":"Example region"},
plotting_dict_points={"color":"blue", "marker":"+", "s":50},
ax=ax
plotting_dict_region={"color": "blue", "label": "Example region"},
plotting_dict_points={"color": "blue", "marker": "+", "s": 50},
ax=ax,
)

plt.show()
Loading

0 comments on commit 06f9009

Please sign in to comment.