Skip to content

Commit

Permalink
Merge pull request #586 from NREL/develop
Browse files Browse the repository at this point in the history
* Speed up angle wrap functions and improve API (#505)

* replace wrap functions with faster implementations

* slight change to unit test as 180 -> -180

* Update doc string to reflect accurate return type

* Use executable book project for documentation

* Add a gh-pages deploy action

* Add more content

* Add a logo

* Add a brief description of each example

List examples in numeric order

Small cleanup to Examples listing

* Add initial API documentation

* Add input file reference

* Use autodoc and autosummary instead of autoapi

Remove TOC from intro page

* Locally install the current repo

* Configure autodocs better

Include undocumented objects as well as all members of an object

Add all default autodoc options to config

* Link to API docs in references to Python objects

* Git-ignore docs build

* Add instructions for building documentation

And other minor changes

* Add Google Analytics tracker

* Update README with documentation links

* List floris packages in API docs

* Enforce building docs from the develop branch

* Add a method to show mpl plots

This means users don’t have to also import matplotlib.pyplot as plt only to run plt.show()

* Update documentation references list (#519)

* initial entry for cumulative curl

* copy in v2 references

* add cc references

* add cc refs

* replace references to zrefs with references.bib

* API improvements

* Add a subtract overload to CutPlane

Also replaces another method CutPlane.subtract to do something similar. That one made assumptions about the order and expected operations. The new subtract method expects all preprocessing to be down outside of the class.

* Fix incorrect yaw angles in fi.calculate_wake

In subsequent function calls, the yaw angles are not reset when they are all zeros. This means that if initially the yaw angles are non-zero and then they’re all-zero, the non-zero yaw settings are retained.

* Remove requirement to use codecov token to upload reports (#532)

* remove potentially error causing line

* Update codecov upload action to v3

Co-authored-by: Rafael M Mudafort <rafael.mudafort@nrel.gov>

* Update API in examples

And clean up examples imports

* Use standard conventions in argument case

minSpeed, maxSpeed => min_speed, max_speed

* Add function to label turbines on CutPlane plots

* Rotate turbine lines and ID annotations with wind

* Configure isort and apply rules (#535)

* Configure isort and apply to floris.simulation

* Apply isort to floris.tools

* Apply isort to shared modules

* Apple isort to examples and tests

* Increase line length to 100

* Add isort description in docs

* Add weights to AEP wind rose function (#541)

* Add weights to get_farm_AEP_wind_rose_class

* updating layout passed to floris_interface in example

* Remove typecast to int for turbine weighting

---------

Co-authored-by: bayc <christopher.j.bay@gmail.com>
Co-authored-by: Rafael M Mudafort <rafael.mudafort@nrel.gov>

* Add parallel computing interface for farm simulation and yaw optimization (#555)

* Add parallel computing class

* Simplify and lighten the way floris information is passed to single-core functions

* Remove unc_options and only pass unc_pmfs internally: all information already contained in that variable.

* Update how wind directions are split up

* Add example for parallel computing

* Introduce separate variable for number of workers

* Expand PCI capabilities with reinitialize, copy. This is needed for some FLASC functionalities like precalculating table of floris solutions

* Allow user to reinitialize atmospheric conditions but then also reload how atmospheric conditions are divided by cores

* Add toggle to silence print statements from Serial Refine and set default in parallel computing. Namely, with 16 workers, you will see 16 times these print statements. This only becomes more with more workers and quickly clutters up the log file.

* Add the option to propagate flow field information from workers to main florisinterface object

* Add parallel processing example

* Remove duplicate example listing

---------

Co-authored-by: Rafael M Mudafort <rafael.mudafort@nrel.gov>

* Feature/update layout vis (#496)

* Update layout visualization functions

* Provide an example of layout visualization

* list 23_visaluze_layout in examples.md

---------

Co-authored-by: Rafael M Mudafort <rafmudaf@gmail.com>

* Add ruff configuration

* Fix all E and F codes

F are pyflakes
E are pycodestyle
https://github.com/charliermarsh/ruff#pyflakes-f

Note: line length errors are not excluded here

* Line length corrections - floris.simulation

Max line length setting is 100

* Line length corrections - floris.tools

* Line length corrections - floris/

* Line length corrections - tests

* Line length corrections - examples

* Line length corrections - profiling

* Fix W codes

Here, it’s only adding a blank line at the end

* Fix C4-comprehensions codes

* Fix I codes

Import formatting. Ruff is not yet at parity with isort, but it is pretty close.

* Include Ruff in CI

Use pre-commit with Actions

Also update the developer dependencies

* Add Ruff usage documentation in developer guide

* Enable and fix pre-commit formatting hooks (#567)

* Enable and fix pre-commit formatting hooks

* Add pre-commit instructions to developer documentation

* Support heterogeneous wind direction definition via FlorisInterface.reinitialize (#453)

* Provide ability to pass het_map to reinitialize

* re-order reinitialize inputs

* Add a new example

* Add an error if het map doesnt match on dimensions to wd

* Add error example to example

* updating format of example

* Add indication final error is on purpose

* line length check

* Comment out forced error

* Add example 16b to docs

* use n directions instead of x

* Add comment

---------

Co-authored-by: Paul <paul.fleming@nrel.gov>
Co-authored-by: bayc <christopher.j.bay@gmail.com>

* Infrastructure improvements (#569)

* Preserve isort formatting - run it last

Also enables splitting imports on trailing comma. If a multi-line import statement is short and includes a trailing comma, it will not be refactored into a single line.

* Use token for codecov upload

* Reduce computational load in an example

Initially, this example slowed the Actions workflow by 2x. This commit reduces the amount of work in the example to speed up the Actions workflow.

* Restrict PyPI deploy workflow to NREL/floris

* Run tests regardless of linting results

* Fail the linter

* Revert "Fail the linter"

This reverts commit d7bfa62.

* Add virtual turbine plotting method (#418)

* Add func calculate_horizontal_plane_with_turbines

* Add demo example

* Correct sort order

* Improve resolution and force matching range

* fix append

* Remove calculate with turbine from floris interfa

* Delete turbine scan example

* Add calc with turbines to visualizations.py

* Add vis with turbine to visualization example

* Support for yaw angles

* Fix handling of yaw angles

* fix outdated layout keyword

* ruff linting

* test pre-commit

* test pre-commit

* Pre-commit fixes

* Fixed doc errors

* Clean out commented code

* Preserve isort formatting - run it last

Also enables splitting imports on trailing comma. If a multi-line import statement is short and includes a trailing comma, it will not be refactored into a single line.

* Use token for codecov upload

* Reduce computational load in an example

Initially, this example slowed the Actions workflow by 2x. This commit reduces the amount of work in the example to speed up the Actions workflow.

* Restrict PyPI deploy workflow to NREL/floris

* Add info on plotting method

* Use coarse mesh for turbine plotting

---------

Co-authored-by: Rafael M Mudafort <rafmudaf@gmail.com>

* Add linear wind condition upsampling method to WindRose (#544)

* Add LinearNDInterpolant to wind_rose

* Change from returning interpolant to immediately interpolating to values

* Add example to docstring

---------

Co-authored-by: Paul <paul.fleming@nrel.gov>
Co-authored-by: Rafael M Mudafort <rafmudaf@gmail.com>

* Improve the documentation navigation menu and organization (#570)

* minor formatting updates

* start overhaul of docuemntation structure

* convert input reference to markdown for consistency

* add a serious placeholder for theory and update the example input file

* remove my notes

* add top-level workflow description for getting started

* add missing period

* Add intro notebook

* Add developer section to menu

* Bug fix: fix toc reference to placeholder page

* Warning fix: use alternate cross reference form

---------

Co-authored-by: Rafael M Mudafort <rafmudaf@gmail.com>

* Feature: External Turbine Library (#568)

* add the external library functionality

* update tests for new functionality

* enable future typing

* fix extra white space

* remove extra parameters

* add missing test file

* fix name bug and address #513

* get tests passing and ensure dictionary entries still work

* address Raf's comment

* add _path to turbine library references

* update typo, FI, and tests for _path

* fix error on case of using turbine dictionary and missing air density

* add additional test for the unique turbine check

* Specify coverage file in Codecov upload action

* Add a link to Discussions from Issues

* Add helpful info to GitHub Issue and PR templates (#597)

---------

Co-authored-by: paulf81 <paul.fleming@nrel.gov>
Co-authored-by: Rob Hammond <13874373+RHammond2@users.noreply.github.com>
Co-authored-by: bayc <christopher.j.bay@gmail.com>
Co-authored-by: Bart Doekemeijer <bart.doekemeijer@shell.com>
Co-authored-by: pjireland <pireland@windesco.com>
  • Loading branch information
6 people committed Mar 7, 2023
2 parents b796bd0 + 9f93ad9 commit 16628a0
Show file tree
Hide file tree
Showing 176 changed files with 6,864 additions and 3,413 deletions.
85 changes: 61 additions & 24 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,70 @@ title: 'Bug report'
labels: "Type: Bug"
---

**Bug description**
<A clear and concise description of the bug.>
<!--
IMPORTANT NOTES
**To Reproduce**
<Update the following list with your specific information.>
Steps to reproduce the behavior:
1. Run '...' case with '...' settings
2. Open '...' output
3. See the error
Thank you for taking the time to report a bug. If you aren't certain whether an issue
is a bug, please first open a Discussion. Before submitting, please reread your
description to ensure that other readers can reasonably understand the issue
you're facing and the impact on your workflow or results.
**Expected behavior**
<A clear and concise description of what you expected to happen.>
This form is written in GitHub's Markdown format. For a reference on this type
of syntax, see GitHub's documentation:
https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
**Screenshots, if applicable**
<Add screenshots to help explain your problem.>
When including code snippets, please paste the text itself and wrap the code block with
ticks (see the other character on the tilde ~ key in a US keyboard) to format it as code.
For example, Python code should be wrapped in ticks like this:
```python
def a_func():
return 1
**Floris Version**
<Please provide as much detail as possible including git commit or version from pip.>
a = 1
b = a_func()
print(a + b)
```
This is preferred over screen shots since it is searchable and others can copy/paste
the text to run it.
-->

**System Information (please complete the following information):**
- OS: <e.g. Ubuntu 14.04 or macOS 10.12>
# Add meaningful title here
<!--
A clear and concise description of the bug including what happened
and what you expected to happen.
-->

## How to reproduce
<!--
Describe how another person with no context can recreate this issue.
It is typically very helpful to reduce the problem as much as possible
and share a minimum working example. See the note above on including
code as text rather than screenshots.
-->

## Relevant output
<!--
Include any output, plots, or other means of communication here to add context to the problem.
-->

## Floris version
<!--
Share your floris version and how you installed it. You can print the floris version from
a Python REPL or script with these commands:
```python
import floris
print(floris.__version__)
```
-->

## System Information
<!-- Add your information here. -->
- OS: <e.g. Ubuntu 20.04 or macOS 10.12>
- Python version: <Result of `python --version`>
- Library versions
* matplotlib
* numpy
* pytest
* scipy
* Sphinx

**Additional context**
<Add any other context about the problem here.>
- Results of `pip freeze`, for example
- matplotlib
- numpy
- numexpr
- scipy
- pandas
5 changes: 5 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Usage question
url: https://github.com/NREL/floris/discussions
about: Have any questions about using FLORIS? Post in Discussions to engage with the NREL team and FLORIS community.
51 changes: 43 additions & 8 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,49 @@ title: 'Feature request'
labels: 'Type: Enhancement'
---

**Is your feature request related to a problem? Please describe.**
<A clear and concise description of the problem.>
<!--
IMPORTANT NOTES
**Describe the solution you'd like**
<A clear and concise description of what you want to happen.>
Thank you for taking the time to suggest a feature. Before submitting,
please reread your description to ensure that other readers can reasonably
understand the motivation and proposed solution.
**Describe alternatives you've considered**
<A clear and concise description of any alternative solutions or features youve considered.>
This form is written in GitHub's Markdown format. For a reference on this type
of syntax, see GitHub's documentation:
https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
**Additional context**
<Add any other context or screenshots about the feature request here.>
When including code snippets, please paste the text itself and wrap the code block with
ticks (see the other character on the tilde ~ key in a US keyboard) to format it as code.
For example, Python code should be wrapped in ticks like this:
```python
def a_func():
return 1
a = 1
b = a_func()
print(a + b)
```
This is preferred over screen shots since it is searchable and others can copy/paste
the text to run it.
-->

# Add meaningful title here
<!--
High level description of the feature request including motivation and background.
-->

## Proposed solution
<!--
Here's an opportunity to prototype a feature. Please include pseudocode, images, or
any other visual aids to communicate the idea.
-->

## Alternatives considered
<!--
Describe workarounds or alternatives even if hacky or incomplete.
-->

## Additional context
<!--
Optional. Provide anything else that helps to communicate the idea here.
-->
73 changes: 58 additions & 15 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,71 @@

<!-- Is this pull request ready to be merged? -->
<!-- i.e. tests pass or are expected to fail; all development is finished; appropriate documentation is included. -->
<!-- If not but opening the pull request will facilitate development, make it a "draft" pull request -->
<!--
IMPORTANT NOTES
**Feature or improvement description**
<!-- A clear and concise description of the new code. -->
Is this pull request ready to be merged?
- Do the existing tests pass and new tests added for new code?
- Is all development in a state where you are proud to share it with others and
willing to ask other people to take the time to review it?
- Is it documented in such a way that a review can reasonably understand what you've
done and why you've done it? Can other users understand how to use your changes?
If not but opening the pull request will facilitate development, make it a "draft" pull request
**Related issue, if one exists**
<!-- Link to a related GitHub Issue. -->
This form is written in GitHub's Markdown format. For a reference on this type
of syntax, see GitHub's documentation:
https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax
**Impacted areas of the software**
<!-- List any modules or other areas which should be impacted by this pull request. This helps to determine the verification tests. -->
When including code snippets, please paste the text itself and wrap the code block with
ticks (see the other character on the tilde ~ key in a US keyboard) to format it as code.
For example, Python code should be wrapped in ticks like this:
```python
def a_func():
return 1
**Additional supporting information**
<!-- Add any other context about the problem here. -->
a = 1
b = a_func()
print(a + b)
```
This is preferred over screen shots since it is searchable and others can copy/paste
the text to run it.
-->

**Test results, if applicable**
<!-- Add the results from unit tests and regression tests here along with justification for any failing test cases. -->

<!-- Release checklist:
# Add meaningful title here
<!--
Be sure to title your pull request so that readers can scan through the list of PR's and understand
what this one involves. It should be a few well selected words to get the point across. If you have
a hard time choosing a brief title, consider splitting the pull request into multiple pull requests.
Keep in mind that the title will be automatically included in the release notes.
-->
Describe your feature here.

## Related issue
<!--
If one exists, link to a related GitHub Issue.
-->

## Impacted areas of the software
<!--
List any modules or other areas which should be impacted by this pull request. This helps to determine the verification tests.
-->

## Additional supporting information
<!--
Add any other context about the problem here.
-->

## Test results, if applicable
<!--
Add the results from unit tests and regression tests here along with justification for any failing test cases.
-->

<!--
__ For NREL use __
Release checklist:
- Update the version in
- [ ] README.md
- [ ] docs/index.md
- [ ] floris/VERSION
- [ ] Verify docs builds correctly
- [ ] Create a tag in the NREL/FLORIS repository
-->
-->
16 changes: 5 additions & 11 deletions .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,11 @@ jobs:
- name: Install project
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
# - name: Lint with flake8
# run: |
# pip install flake8
# # stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
pip install -e ".[develop]"
- uses: pre-commit/action@v3.0.0
- name: Run tests
if: success() || failure() # Run this step even if the linting step fails
run: |
# pytest tests/
# -rA displays the captured output for all tests after they're run
# See the docs: https://doc.pytest.org/en/latest/reference/reference.html#command-line-flags
pytest -rA tests/ --ignore tests/timing.py --ignore tests/profiling.py
Expand All @@ -45,7 +38,8 @@ jobs:
pip install pytest-cov
pytest --cov=./ --cov-report=xml tests/ --ignore tests/reg_tests --ignore tests/timing.py --ignore tests/profiling.py
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.xml
fail_ci_if_error: true
39 changes: 39 additions & 0 deletions .github/workflows/deploy-pages.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: deploy-pages

on:
push:
branches:
- develop
paths:
- docs/**

# This job installs dependencies, builds the book, and pushes it to `gh-pages`
jobs:
deploy-book:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

# Install dependencies
- name: Set up Python 3.8
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
pip install -r docs/requirements.txt
pip install -e .
# Build the book
- name: Build the book
working-directory: ${{runner.workspace}}/floris/docs/
run: |
jupyter-book build .
# Push the book's HTML to github-pages
- name: GitHub Pages action
uses: peaceiris/actions-gh-pages@v3.6.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/_build/html
3 changes: 1 addition & 2 deletions .github/workflows/python-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@ on:

jobs:
deploy:

if: github.repository_owner == 'NREL'
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/quality-metrics-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@ jobs:
- name: Install project
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
pip install -e ".[develop]"
- name: Run the code quality script
run: |
cd profiling
Expand Down
17 changes: 10 additions & 7 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,28 @@ __pycache__/
*.egg-info
dist
build
_build
.pytest_cache

#pip meta data
# pip meta data
pip-wheel-metadata

# macOS files
.DS_Store

# ide settings and files
# IDE settings and files
.idea
.vscode

# Other
.pytest_cache
examples/cp_ct_cq_lut.p
# Documentation output
_site/
.jekyll-cache/
_build
_autosummary/

# Output from examples
examples/cp_ct_cq_lut.p
examples/hist.hist
examples/SLSQP.out

# Log files
*.log
*.log

0 comments on commit 16628a0

Please sign in to comment.