Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FLASC v1.5 #156

Merged
merged 84 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
f951f90
Merge remote-tracking branch 'upstream/main' into main
misi9170 Oct 21, 2022
d79d1ff
Merge remote-tracking branch 'upstream/main' into main
misi9170 Nov 21, 2022
9324e5f
Merge remote-tracking branch 'upstream/main' into main
Jun 21, 2023
f98046c
Merge remote-tracking branch 'upstream/main' into main
Jul 17, 2023
61b3085
Split interpolation into 2D and 3D grid, and general pandas improveme…
Bartdoekemeijer Sep 13, 2023
67b2f8e
Initial commits
paulf81 Sep 28, 2023
e11f600
Small changes
paulf81 Sep 28, 2023
b270a20
Clean up example
paulf81 Sep 28, 2023
a6aee90
Clean up and add docstrings
paulf81 Sep 28, 2023
2307462
Add a test
paulf81 Sep 28, 2023
1e39afa
Add ephem to requirements
paulf81 Sep 28, 2023
eb31438
Merge branch 'develop' into feature/add_day_night
paulf81 Oct 16, 2023
6aa37d9
Merge branch 'develop' into feature/add_day_night
paulf81 Oct 19, 2023
f3db141
Merge pull request #130 from NREL/main
misi9170 Oct 29, 2023
ff693f9
Merge remote-tracking branch 'upstream/main' into main
misi9170 Oct 29, 2023
efeeab7
Merge branch 'main' into develop
paulf81 Nov 7, 2023
1eac712
Merge branch 'develop' into feature/add_day_night
paulf81 Nov 7, 2023
eeb1e00
add night day demo
paulf81 Nov 8, 2023
776c3b8
Update notebook
paulf81 Nov 13, 2023
5ddd708
Merge branch 'main' into develop
paulf81 Nov 13, 2023
385014d
Merge branch 'main' into develop
paulf81 Nov 14, 2023
1f026b7
Merge branch 'main' into develop
paulf81 Nov 14, 2023
929b94a
Merge pull request #124 from Bartdoekemeijer/improve_speed_ftools_int…
misi9170 Dec 4, 2023
bc26466
Merge branch 'main' into develop
paulf81 Dec 4, 2023
3b6da3c
Merging develop branch back in.
misi9170 Dec 5, 2023
717d66e
convert to degrees.
misi9170 Dec 5, 2023
792ef85
Convert to degress (notebook).
misi9170 Dec 5, 2023
8aa3157
option for specifying sunset and sunrise, minor plotting improvements.'
misi9170 Dec 5, 2023
c03f0fe
Cleaning up example.
misi9170 Dec 5, 2023
ccaeb96
Update select_best_velocity_parameter() name to better reflect use fo…
misi9170 Dec 5, 2023
deea7da
Fix in day night vis.
misi9170 Dec 6, 2023
eaf6147
Merge pull request #127 from paulf81/feature/add_day_night
paulf81 Dec 6, 2023
a040947
Add initial pyproject toml
paulf81 Dec 6, 2023
0d50c20
Further condition ruff
paulf81 Dec 6, 2023
d2d517f
Ruff format and lint
paulf81 Dec 7, 2023
066284d
Ruff format and lint
paulf81 Dec 7, 2023
e141237
ruff format and lint
paulf81 Dec 7, 2023
db1a282
ruff format and lint
paulf81 Dec 7, 2023
ec33932
Ruff format and lint
paulf81 Dec 7, 2023
a6e1ab2
ruff format and linting
paulf81 Dec 8, 2023
6ee5069
ruff format and linting
paulf81 Dec 8, 2023
e00e310
ruff format and linting
paulf81 Dec 8, 2023
7db1fe1
ruff format and lint
paulf81 Dec 8, 2023
fa6210b
Ruff format and linting
paulf81 Dec 8, 2023
b6ab988
Ruff format and linting
paulf81 Dec 8, 2023
1778d73
ruff format and linting
paulf81 Dec 8, 2023
a05baa0
Include notebooks in ruff
paulf81 Dec 8, 2023
c59492b
ruff format and linting
paulf81 Dec 8, 2023
618e478
ruff format and linting
paulf81 Dec 8, 2023
1f0166e
Add ruff pre-commit instructions and documentation
paulf81 Dec 8, 2023
2f6ea17
ruff format init
paulf81 Dec 8, 2023
a5f680f
fix init imports
paulf81 Dec 8, 2023
fdcbbb4
fix long line
paulf81 Dec 8, 2023
423eb78
ignore unused imports in __init__
paulf81 Dec 12, 2023
f0212b9
fix long line
paulf81 Dec 12, 2023
1ba14b3
formatting
paulf81 Dec 12, 2023
a4ca481
update version.py
paulf81 Dec 12, 2023
4371054
disable long line checks
paulf81 Dec 12, 2023
8121ec0
remove l as variable
paulf81 Dec 12, 2023
d497ef3
clean up
paulf81 Dec 12, 2023
88fc151
formatting
paulf81 Dec 12, 2023
f5ea8f9
formatting
paulf81 Dec 12, 2023
6fcefc6
formatting
paulf81 Dec 12, 2023
7995352
ignore long lines
paulf81 Dec 12, 2023
692c3c6
formatting
paulf81 Dec 12, 2023
efaf44c
ruff formatting / linting
paulf81 Dec 12, 2023
20cddf1
Ruff format and linting
paulf81 Dec 12, 2023
723388b
Update version
paulf81 Dec 12, 2023
4c6b835
update ipy
paulf81 Dec 12, 2023
1f8b2eb
exclude notebooks
paulf81 Dec 12, 2023
c0c2ddc
ruff lint format
paulf81 Dec 12, 2023
a1eba38
ruff lint and format
paulf81 Dec 12, 2023
98b8c2b
Merge pull request #143 from paulf81/feature/add_ruff_2
paulf81 Dec 15, 2023
806854c
Back-version sqlalchemy
paulf81 Dec 15, 2023
ab942a8
Merge pull request #152 from paulf81/resolve_dependency_issue
paulf81 Dec 15, 2023
8cc35f1
Merge branch 'main'
paulf81 Dec 15, 2023
e2d4e74
Delete temp
paulf81 Dec 15, 2023
c82eaa8
fix file
paulf81 Dec 15, 2023
6ff2c10
Ignore rule E712
paulf81 Dec 15, 2023
a6f7a28
fix notebooks
paulf81 Dec 15, 2023
4980ac6
Merge pull request #154 from paulf81/feature/run_all_examples
paulf81 Dec 15, 2023
3ab0fb2
Feature/add uplift example (#155)
paulf81 Dec 19, 2023
5e4f7a1
Merge remote-tracking branch 'upstream/main'
misi9170 Dec 21, 2023
b3080f1
Bring develop up to main and align.
misi9170 Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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