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

[BUGFIX] Add demo_cp_ct_surface location to data files. #1095

Merged
merged 8 commits into from
Apr 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .github/workflows/check-working-examples.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install project
run: |
python -m pip install --upgrade pip
pip install -e .
pip install .
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.
Expand All @@ -30,7 +30,7 @@ jobs:
run: |

mkdir -p temp1/temp2/temp3
cp -r examples/ temp1/temp2/temp3/.
cp -rL examples temp1/temp2/temp3/.
cd temp1/temp2/temp3/examples/

error_found=0 # 0 is false
Expand Down
6 changes: 5 additions & 1 deletion .github/workflows/continuous-integration-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,15 @@ jobs:
- name: Install project
run: |
python -m pip install --upgrade pip
pip install -e ".[develop]"
pip install ".[develop]"
- uses: pre-commit/[email protected]
- name: Run tests
if: success() || failure() # Run this step even if the linting step fails
run: |
mkdir -p temp1/temp2/temp3
cp -rL tests temp1/temp2/temp3/.
cd temp1/temp2/temp3/

# -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 Down
2 changes: 1 addition & 1 deletion .github/workflows/quality-metrics-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Install project
run: |
python -m pip install --upgrade pip
pip install -e ".[develop]"
pip install ".[develop]"
- name: Run the code quality script
run: |
cd profiling
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ include = ["floris*"]
[tool.setuptools.package-data]
floris = [
"turbine_library/*.yaml",
"turbine_library/*.csv",
"turbine_library/demo_cp_ct_surfaces/*.npz",
"core/wake_velocity/turbopark_lookup_table.mat",
"default_inputs.yaml"
]
Expand Down
8 changes: 7 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
from __future__ import annotations

import copy
from pathlib import Path

import numpy as np
import pytest

import floris
from floris.core import (
Core,
FlowField,
Expand Down Expand Up @@ -138,6 +140,10 @@ def print_test_values(
ROTOR_DIAMETER = 126.0
TURBINE_GRID_RESOLUTION = 2

DEMO_CP_CT_5MW_FILE = (
Path(floris.__file__).resolve().parent /
"turbine_library/demo_cp_ct_surfaces/nrel_5MW_demo_cp_ct_surface.npz"
)

## Unit test fixtures

Expand Down Expand Up @@ -401,7 +407,7 @@ def __init__(self):
"beta": -0.45891,
"cd": 0.0040638,
"cl_alfa": 4.275049,
"cp_ct_data_file": "demo_cp_ct_surfaces/nrel_5MW_demo_cp_ct_surface.npz"
"cp_ct_data_file": DEMO_CP_CT_5MW_FILE
}

self.turbine_floating = copy.deepcopy(self.turbine)
Expand Down
3 changes: 2 additions & 1 deletion tests/convert_v3_to_v4_test.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import os
from pathlib import Path

import floris
from floris import FlorisModel


CONVERT_FOLDER = Path(__file__).resolve().parent / "v3_to_v4_convert_test"
FLORIS_FOLDER = Path(__file__).resolve().parent / ".." / "floris"
FLORIS_FOLDER = Path(floris.__file__).resolve().parent


def test_v3_to_v4_convert():
Expand Down
7 changes: 7 additions & 0 deletions tests/data/wrg_test.wrg
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
2 3 0.0 0.0 1000.0
0 0 0 90 9.5 2.25 0 12 116 106 273 86 93 228 61 76 220 54 74 220 66 79 220 121 98 244 177 107 279 84 89 232 43 70 195 36 75 188 53 100 201 98 111 267
0 1000 0 90 9.6 2.31 0 12 116 107 341 86 93 228 61 76 220 54 74 220 66 79 220 121 98 244 177 107 279 84 89 232 43 70 195 36 75 188 53 100 201 98 111 267
0 2000 0 90 9.7 2.36 0 12 116 106 409 86 93 228 61 76 220 54 74 220 66 79 220 121 98 244 177 107 279 84 89 232 43 70 195 36 75 188 53 100 201 98 111 267
1000 0 0 90 9.6 2.34 0 12 116 106 273 86 93 228 61 76 220 54 82 407 66 79 220 121 98 244 177 107 279 84 89 232 43 70 195 36 75 188 53 100 201 98 111 267
1000 1000 0 90 9.6 2.40 0 12 116 107 341 86 93 228 61 76 220 54 82 407 66 79 220 121 98 244 177 107 279 84 89 232 43 70 195 36 75 188 53 100 201 98 111 267
1000 2000 0 90 9.7 2.46 0 12 116 106 409 86 93 228 61 76 220 54 82 407 66 79 220 121 98 244 177 107 279 84 89 232 43 70 195 36 75 188 53 100 201 98 111 267
7 changes: 3 additions & 4 deletions tests/wind_rose_wrg_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,19 @@
import numpy as np
import pytest

import floris
from floris import (
FlorisModel,
UncertainFlorisModel,
WindRoseWRG,
)


WRG_FILE_FILE = (
Path(__file__).resolve().parent / "../examples/examples_wind_resource_grid/wrg_example.wrg"
)

TEST_DATA = Path(__file__).resolve().parent / "data"
YAML_INPUT = TEST_DATA / "input_full.yaml"

WRG_FILE_FILE = TEST_DATA / "wrg_test.wrg"

def test_load_wrg():
WindRoseWRG(WRG_FILE_FILE)

Expand Down