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

Refactor examples #843

Merged
merged 128 commits into from
Apr 5, 2024
Merged

Refactor examples #843

merged 128 commits into from
Apr 5, 2024

Conversation

paulf81
Copy link
Collaborator

@paulf81 paulf81 commented Mar 13, 2024

Refactor examples for v4

This pull request refactors the examples around the v4 structures and style and in general cleans up the examples folder, which had become a sort of unsorted list of examples. Specifically,

  • Examples are now organized into top level over-arching examples in the root examples folders, and then examples grouped by topic in subfolders
  • The top level examples are completely redone to incrementally introduce FLORIS, in a way consistent with v4
  • Each example now includes a self-describing docstring at the top of each
  • Every example is refactored for v4 code and style, as well as overall improvements, style, spelling, ruff, etc

In addition to these changes, some supporting changes were made to the code

  • Spelling errors of the word heterogeneous are fixed throughout the code
  • A bug in 'mixed' operation model (which masked yaw_angles > 0, when it should've been != ) is fixed, which was identified in making one of the examples
  • several additional properties were added to FlorisModel, adding to layout_x and layout_y, these are wind_directions, wind_speeds, turbulence_intensities, n_findex and n_turbines. This change makes the examples more readable without the core.flowfield intermediates
  • A bug in ParallelFlorisModel is fixed (sum -> nansum, fixed concatenating parallel results)

Finally, changes to CI include:

  • CI running of examples update to include checking examples in subfolders

@misi9170 and @rafmudaf and @ejsimley I think this is now ready to review. We talked about automatically generating html versions of the examples and so far this is proving difficult, so maybe that could still be done, but as part of another pull request

@paulf81 paulf81 added examples Changes to FLORIS examples v4 Focus of FLORIS v4 labels Mar 13, 2024
@paulf81 paulf81 added this to the v4.0 milestone Mar 13, 2024
@paulf81 paulf81 self-assigned this Mar 13, 2024
Copy link
Collaborator

@misi9170 misi9170 Apr 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aren't examples 002--004 here covered by the 002_visualizations.py example in the main examples/ directory?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically, yes, there a little more blocked out, but it's true not strictly necessary, but maybe convenient to have such a single-purpose example? Also up for discussion...

Copy link
Collaborator

@misi9170 misi9170 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @paulf81 , I have made a bunch of minor comments, but overall this looks good.

I think the changes outside of the examples (heterogeneous, bugfixes to ParallelFlorisModel, MixedOperationTurbine bugfix).

On the @propertys available on FlorisModel, do we need to check that these are matched on UncertainFlorisModel (I see that you've already updated ParallelFlorisModel)?

@paulf81 paulf81 requested a review from misi9170 April 4, 2024 03:54
@paulf81 paulf81 merged commit 53c1de2 into NREL:v4 Apr 5, 2024
8 checks passed
@paulf81 paulf81 deleted the refactor_examples branch April 5, 2024 04:39
@misi9170 misi9170 mentioned this pull request Apr 8, 2024
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Changes to FLORIS examples v4 Focus of FLORIS v4
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants