Skip to content

Commit

Permalink
Merge pull request #405 from NREL/develop
Browse files Browse the repository at this point in the history
v3.1
  • Loading branch information
rafmudaf authored Apr 6, 2022
2 parents df4622f + ca6362f commit a23241b
Show file tree
Hide file tree
Showing 72 changed files with 3,896 additions and 35,434 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/check-working-examples.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Check Examples APIs

on: [push, pull_request]

jobs:

examples-check:
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: [3.9]
os: [ubuntu-latest] #, macos-latest, windows-latest]
fail-fast: False

steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install project
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -e .
pip install nbconvert # For converting Jupyter notebook to python script in the next step
- name: Run examples
# Run all examples and test that they finish successfully. Do not evaluate the results.
run: |
cd examples/
error_found=0 # 0 is false
error_results="Error in example:"
# Run each Python script example
for i in *.py; do
# Skip these examples since they have additional dependencies
if [[ $i == *11* ]]; then
continue
fi
if [[ $i == *16* ]]; then
continue
fi
if ! python $i; then
error_results="${error_results}"$'\n'" - ${i}"
error_found=1
fi
done
# Run all Jupyter notebooks
for i in *.ipynb; do
# Convert this notebook to a Python script
if ! jupyter nbconvert --to script $i; then
# On conversion error, report and go to the next notebook
error_results="${error_results}"$'\n'" - Error converting ${i} to Python script"
continue
fi
# Get the basename of the notebook since the converted script will have the same basename
script_name=`basename $i .ipynb`
# Run the converted script
if ! python "${script_name}.py"; then
error_results="${error_results}"$'\n'" - ${i}"
error_found=1
fi
done
if [[ $error_found ]]; then
echo "${error_results}"
fi
exit $error_found
42 changes: 23 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,26 @@
FLORIS is a controls-focused wind farm simulation software incorporating
steady-state engineering wake models into a performance-focused Python
framework. It has been in active development at NREL since 2013 and the latest
release is [FLORIS v3.0](https://github.com/NREL/floris/releases/tag/v3.0)
in March 2022. The new ``v3`` version of the repository
contains an architectural redesign of the software to enable improved
performance in AEP calculation and controls optimization.
release is [FLORIS v3.1](https://github.com/NREL/floris/releases/latest)
in March 2022.

We are actively seeking beta testers for the new framework. If you are interested
in using FLORIS to conduct studies of a wind farm or extending FLORIS to include
your own wake model, please get in touch! Join the conversations at
[GitHub Discussions](https://github.com/NREL/floris/discussions/categories/v3-design-discussion).
The software is in active development and engagement with the development team
is highly encouraged. If you are interested in using FLORIS to conduct studies
of a wind farm or extending FLORIS to include your own wake model, please join
the conversation in [GitHub Discussions](https://github.com/NREL/floris/discussions/categories/v3-design-discussion)!

For more context and background on previous work in FLORIS, see the
documentation at http://floris.readthedocs.io/.
Since FLORIS v3, the documentation is migrating to https://nrel.github.io/floris,
but this is a work in progress. For context and background on previous work in
FLORIS, see the legacy documentation at http://floris.readthedocs.io/.

---

## Installation

> :exclamation: **It is highly recommended that you install FLORIS V3 into a new clean virtual environment**. Installing into the existing V2 environment has been seen to cause conflicts. Further, if you wish to use pyoptsparse with FLORIS, it is recommended to install pyoptsparse into your environment prior to FLORIS
**If upgrading from v2, it is highly recommended to install FLORIS V3 into a new virtual environment**.
Installing into a Python environment that contains FLORIS v2 may cause conflicts.
If you intend to use [pyOptSparse](https://mdolab-pyoptsparse.readthedocs-hosted.com/en/latest/) with FLORIS,
it is recommended to install that package first before installing FLORIS.

FLORIS can be installed by downloading the source code or via the PyPI
package manager with `pip`.
Expand All @@ -30,12 +33,13 @@ The simplest method is with `pip` by using this command:
pip install floris
```

Developers and anyone who intends to inspect the source code,
install FLORIS by downloading the git repository
Developers and anyone who intends to inspect the source code
can install FLORIS by downloading the git repository
from GitHub with ``git`` and use ``pip`` to locally install it.
It is recommended to use a Python virtual environment such as [conda](https://docs.conda.io/en/latest/miniconda.html)
It is highly recommended to use a Python virtual environment manager
such as [conda](https://docs.conda.io/en/latest/miniconda.html)
in order to maintain a clean and sandboxed environment. The following
commands in a terminal or shell will download and install **FLORIS v3.0**.
commands in a terminal or shell will download and install FLORIS.

```bash
# Download the source code from the `main` branch
Expand All @@ -44,10 +48,10 @@ commands in a terminal or shell will download and install **FLORIS v3.0**.
# If using conda, be sure to activate your environment prior to installing
# conda activate <env name>

# If you would like to use pyoptspare, recommend installing before FLORIS
# If using pyOptSpare, install it first
conda install -c conda-forge pyoptsparse

# Install into your Python environment
# Install FLORIS
pip install -e floris
```

Expand All @@ -72,11 +76,11 @@ and importing FLORIS:

DATA
ROOT = PosixPath('/Users/rmudafor/Development/floris')
VERSION = '3.0'
VERSION = '3.1'
version_file = <_io.TextIOWrapper name='/Users/rmudafor/Development/fl...

VERSION
3.0
3.1

FILE
~/floris/floris/__init__.py
Expand Down
101 changes: 98 additions & 3 deletions docs/_devdocs/index.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,104 @@
---
layout: default
title: Architecture
title: Workflow
nav_order: 1
---

# FLORIS architecture and developer documentation
# Developer workflows and interaction

Look out for updates here in the next release!
FLORIS is maintained at NREL's National Wind Technology Center.
We are excited about community contribution, and this page outlines
processes and procedures to follow when contributing to the
source code. For technical questions regarding FLORIS usage, please
post your questions to [GitHub Discussions](https://github.com/NREL/floris/discussions).

## Git and GitHub

The majority of the collaboration and development for FLORIS takes place
in the [GitHub repository](http://github.com/nrel/floris). There,
[issues](http://github.com/nrel/floris/issues) and
[pull requests](http://github.com/nrel/floris/pulls) are managed,
questions and ideas are [discussed](https://github.com/NREL/floris/discussions),
and [new versions](http://github.com/nrel/floris/releases)
are released. It is the best mechanism for engaging with the NREL team
and other developers throughout the FLORIS community.

FLORIS development should follow "Git Flow" when interacting with the GitHub
repository. Git Flow is a git workflow outlining safe methods of pushing and
pulling commits to a shared repository. Maintaining this workflow is critical
to prevent remote changes from blocking your local development. The Git Flow
process is detailed nicely [here](http://nvie.com/posts/a-successful-git-branching-model).

### Syncing a local repository with NREL/FLORIS
The "main" FLORIS repository is continuously updated along with ongoing
research at NREL. From time to time, developers of FLORIS using their own
"local" repositories (versions of the software that exist on a local computer)
may want to sync with NREL/FLORIS. To do this, use the following git commands:

```bash

# Move into the FLORIS source code directory;
# this may be named differently on your computer.
cd floris/

# Find the remote name that corresponds to
# NREL/FLORIS; usually "origin" or "upstream".
git remote -v

# Fetch the changes on all remotes.
git fetch --all

# Decide which branch to sync with
# NREL/FLORIS. Generally, this will be "main".
git checkout main
git pull origin main

# Update any local working branches with the
# latest from NREL/FLORIS.
git checkout feature/working_branch
git merge main
```

Note that the example above is a general case and may need to be modified
to fit a specific use case or purpose. If significant development has
happened locally, then [merge conflicts](https://www.atlassian.com/git/tutorials/using-branches/merge-conflicts)
are likely and should be resolved as early as possible.

## Testing

In order to maintain a level of confidence in the software, FLORIS is expected
to maintain a reasonable level of test coverage. To that end, unit
tests for a the low-level code in the `floris.simulation` package are included.

The full testing suite can by executed by running the command ``pytest`` from
the highest directory in the repository. A testing-only class is included
to provide consistent and convenient inputs to modules at
`floris/tests/conftest.py`.

### Unit Tests

Unit tests are integrated into FLORIS with the
[pytest](https://docs.pytest.org/en/latest/) framework. These can be executed
by running the command `pytest tests/*_unit_test.py` from the highest
directory in the repository.

### Regression Tests

Regression tests are included in FLORIS through the same
[pytest](https://docs.pytest.org/en/latest/) framework as the unit tests.
Functionally, the only difference is that the regression tests take more
time to execute and exercise a large portion of the software. These can be
executed by running the command `pytest tests/*_regression_test.py` from the
highest directory in the repository.

### Continuous Integration

Continuous integration is configured with [GitHub Actions](https://github.com/nrel/floris/actions)
and executes all of the existing tests for every push-event. The configuration file
is located at `floris/.github/workflows/continuous-integration-workflow.yaml`.

## Deploying to pip

Generally, only NREL developers will have appropriate permissions to deploy
FLORIS updates. When the time comes, here is a great reference on doing it
is available [here](https://medium.freecodecamp.org/how-to-publish-a-pyton-package-on-pypi-a89e9522ce24).
Loading

0 comments on commit a23241b

Please sign in to comment.