Skip to content

Commit eceb7f2

Browse files
authored
Merging dev to main after renaming of python_toolbox to openfast_toolbox (#1)
* AeroAcoustics: reorganizing folder * Fix collections.Iterable being deprecated * GH: testing for python version 3.12 * Lin: not using distutils (deprecated python 3.12) * GH: using unittest instead of pytest * GH: adding windows and mac for github action * Renaming pyFAST to openfast_toolbox * Changed io paths in README * Removing gitignore of out files for examples * Rename of repo in readme * Readding aeroacoustic examples
1 parent 4895691 commit eceb7f2

File tree

378 files changed

+10506
-10138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

378 files changed

+10506
-10138
lines changed

.github/workflows/development-pipeline.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,47 @@ on:
1111
# strategy:
1212
# matrix:
1313
# os: [macOS-10.14, ubuntu-18.04]
14+
# runs-on: ubuntu-latest
15+
# strategy:
16+
# matrix:
17+
# python-version: [3.7, 3.8, 3.9, 3.11, 3.12] #
1418

1519
jobs:
1620
build-and-test:
17-
runs-on: ubuntu-latest
1821
strategy:
1922
matrix:
20-
python-version: [3.7, 3.8, 3.9, 3.11] #
23+
include:
24+
- os: ubuntu-latest
25+
python-version: 3.7
26+
python: xvfb-run python3
27+
pip_arg: ""
28+
- os: ubuntu-latest
29+
python-version: 3.8
30+
python: xvfb-run python3
31+
pip_arg: ""
32+
- os: ubuntu-latest
33+
python-version: 3.9
34+
python: xvfb-run python3
35+
pip_arg: ""
36+
- os: ubuntu-latest
37+
python-version: 3.11
38+
python: xvfb-run python3
39+
pip_arg: ""
40+
- os: ubuntu-latest
41+
python-version: 3.12
42+
python: xvfb-run python3
43+
pip_arg: ""
44+
- os: macos-11
45+
python-version: 3.11
46+
python: python3
47+
pip_arg: ""
48+
- os: windows-2019
49+
python-version: 3.11
50+
python: python
51+
pip_arg: --user
52+
runs-on: ${{ matrix.os }}
53+
54+
2155
steps:
2256
- name: Checkout
2357
uses: actions/checkout@main
@@ -30,10 +64,7 @@ jobs:
3064
- name: Install dependencies
3165
run: |
3266
python -m pip install --upgrade pip
33-
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
34-
pip install pytest
35-
pip install pytest-cov
3667
pip install -e .
37-
- name: Test with pytest
68+
- name: Tests
3869
run: |
39-
pytest
70+
python -m unittest discover

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
3+
test:
4+
python -m unittest discover

README.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# pyfast
1+
# openfast_toolbox
22

33
[![Build status](https://github.com/openfast/python-toolbox/workflows/Development%20Pipeline/badge.svg)](https://github.com/OpenFAST/python-toolbox/actions?query=workflow%3A%22Development+Pipeline%22)
44
[![Python: 3.6+](https://img.shields.io/badge/python-3.6%2B-informational)](https://www.python.org/)
@@ -22,21 +22,21 @@ pytest
2222

2323
The repository contains a set of small packages:
2424

25-
- input\_output: read/write OpenFAST/FAST.Farm/OLAF input and output files (see [README](pyFAST/input_output))
26-
- postpro: postprocess OpenFAST outputs (extract radial data, compute fatigue loads) (see [examples](pyFAST/postpro/examples))
27-
- linearization: tools to deal with OpenFAST linearization, e.g. generate a Campbell diagram (see [examples](pyFAST/linearization/examples/))
25+
- input\_output: read/write OpenFAST/FAST.Farm/OLAF input and output files (see [README](openfast_toolbox/io))
26+
- postpro: postprocess OpenFAST outputs (extract radial data, compute fatigue loads) (see [examples](openfast_toolbox/postpro/examples))
27+
- linearization: tools to deal with OpenFAST linearization, e.g. generate a Campbell diagram (see [examples](openfast_toolbox/linearization/examples/))
2828
- aeroacoustics: tools for aeroacoustics (generate BL files and plot outputs)
29-
- case\_generation: tools to generate and run a set of input of OpenFAST input files (see [examples](pyFAST/case_generation/examples))
29+
- case\_generation: tools to generate and run a set of input of OpenFAST input files (see [examples](openfast_toolbox/case_generation/examples))
3030

3131

3232
## QuickStart and main usage
3333

3434
### Read and write files
35-
Find examples scripts in this [folder](pyFAST/input_output/examples) and the different fileformats [here](pyFAST/input_output).
35+
Find examples scripts in this [folder](openfast_toolbox/io/examples) and the different fileformats [here](openfast_toolbox/io).
3636

3737
Read an AeroDyn file (or any OpenFAST input file), modifies some values and write the modified file:
3838
```python
39-
from pyFAST.input_output import FASTInputFile
39+
from openfast_toolbox.io import FASTInputFile
4040
filename = 'AeroDyn.dat'
4141
f = FASTInputFile(filename)
4242
f['TwrAero'] = True
@@ -46,15 +46,15 @@ f.write('AeroDyn_Changed.dat')
4646

4747
Read an OpenFAST binary output file and convert it to a pandas DataFrame
4848
```python
49-
from pyFAST.input_output import FASTOutputFile
49+
from openfast_toolbox.io import FASTOutputFile
5050
df = FASTOutputFile('5MW.outb').toDataFrame()
5151
time = df['Time_[s]']
5252
Omega = df['RotSpeed_[rpm]']
5353
```
5454

5555
Read a TurbSim binary file, modify it and write it back
5656
```python
57-
from pyFAST.input_output import TurbSimFile
57+
from openfast_toolbox.io import TurbSimFile
5858
ts = TurbSimFile('Turb.bts')
5959
print(ts.keys())
6060
print(ts['u'].shape)
@@ -63,27 +63,27 @@ tw.write('NewTurbulenceBox.bts')
6363
```
6464

6565
### Polar/airfoil manipulation
66-
Find examples scripts in this [folder](pyFAST/polar/examples).
66+
Find examples scripts in this [folder](openfast_toolbox/polar/examples).
6767

6868

6969
Read a CSV file with `alpha, Cl, Cd, Cm`, and write it to AeroDyn format (also computes unsteady coefficients)
7070
```python
71-
from pyFAST.airfoils.Polar import Polar
72-
polar = Polar('pyFAST/airfoils/data/DU21_A17.csv', fformat='delimited')
71+
from openfast_toolbox.airfoils.Polar import Polar
72+
polar = Polar('openfast_toolbox/airfoils/data/DU21_A17.csv', fformat='delimited')
7373
ADpol = polar.toAeroDyn('AeroDyn_Polar_DU21_A17.dat')
7474
```
7575

7676
### Write a set of OpenFAST input file for multiple simulations
77-
Find examples scripts in this [folder](pyFAST/case_generation/examples).
77+
Find examples scripts in this [folder](openfast_toolbox/case_generation/examples).
7878

7979
### Postprocessing
8080

8181
Below are different scripts to manipulate OpenFAST outputs:
8282

83-
- [Extract average radial data](pyFAST/postpro/examples/Example_RadialPostPro.py).
84-
- [Interpolate data at different radial positions](pyFAST/postpro/examples/Example_RadialInterp.py).
85-
- [Compute damage equivalent loads](pyFAST/postpro/examples/Example_EquivalentLoad.py).
86-
- [Change column names and units](pyFAST/postpro/examples/Example_Remap.py).
83+
- [Extract average radial data](openfast_toolbox/postpro/examples/Example_RadialPostPro.py).
84+
- [Interpolate data at different radial positions](openfast_toolbox/postpro/examples/Example_RadialInterp.py).
85+
- [Compute damage equivalent loads](openfast_toolbox/postpro/examples/Example_EquivalentLoad.py).
86+
- [Change column names and units](openfast_toolbox/postpro/examples/Example_Remap.py).
8787

8888

8989
## Future work and friend projects

data/NREL5MW/5MW_Land_Lin_Rotating/postpro_MultiLinFiles_OneOP.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22
Script to postprocess linearization files from OpenFAST for one operating point.
33
44
Adapted from:
5-
https://github.com/OpenFAST/python-toolbox/blob/dev/pyFAST/linearization/examples/ex2a_MultiLinFiles_OneOP.py
5+
https://github.com/OpenFAST/python-toolbox/blob/dev/openfast_toolbox/linearization/examples/ex2a_MultiLinFiles_OneOP.py
66
77
"""
88
import os
99
import glob
1010
import numpy as np
11-
import pyFAST
12-
import pyFAST.linearization as lin
11+
import openfast_toolbox
12+
import openfast_toolbox.linearization as lin
1313

1414
## Script Parameters
1515
fstFile = './Main.fst' # Main .fst file, .lin files will be sought for with same basename

data/linearization_outputs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
The outputs in this directory should match the ones given by the example script:
2-
pyFAST/linearization/runCampbell.
2+
openfast_toolbox/linearization/runCampbell.
33

44
Using the 5MW Land turbine, at given operating points.
55

developper_notes.md

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# Developer Notes
2+
3+
4+
5+
## Release Steps
6+
Typically releases are done for each new version of OpenFAST
7+
8+
1. Create a pull request from main to dev
9+
2. Make sure the input files in the `data` directory are compatible with the new OpenFAST version
10+
3. Change the file VERSION (and/or setup.py) and push to the pull request
11+
4. Merge pull request to main
12+
5. Tag the commit using `git tag -a vX.X.X` and push to remote: `git push --tags``.
13+
6. Upload to pypi and conda (see below)
14+
7. Merge main to dev
15+
16+
17+
## Upload a new version for pip
18+
Detailled steps are provided further below.
19+
20+
### Summary
21+
Remember to change VERSION file and/or setup.py
22+
```bash
23+
python setup.py sdist
24+
twine upload dist/* # upload to pypi
25+
```
26+
27+
28+
29+
### (Step 0 : create an account on pypi)
30+
31+
### Step 1: go to your repo
32+
Go to folder
33+
```bash
34+
cd path/to/python-toolbox
35+
```
36+
37+
### Step 2: change version in setup.py and tag it
38+
change VERSION in setup.py
39+
```
40+
git add setup.py VERSION
41+
git commit "Version X.X.X"
42+
git tag -a
43+
```
44+
45+
### Step 3: Create a source distribution
46+
```bash
47+
python setup.py sdist
48+
```
49+
50+
### Step 4: Install twine
51+
```bash
52+
pip install twine
53+
```
54+
55+
### Step 5: Ubplot to pypi
56+
Run twine to upload to Pypi (will ask for username and password)
57+
```bash
58+
twine upload dist/*
59+
```
60+
61+
### After clone / first time
62+
Add `.gitconfig` to your path, to apply filters on jupyter notebooks
63+
```bash
64+
git config --local include.path ../.gitconfig
65+
```
66+
67+
68+
69+
## Upload a new version to Conda
70+
TODO TODO TODO
71+
72+
conda-forge,
73+
make a pull request there.
74+
- setup build script (https://conda-forge.org/docs/maintainer/adding_pkgs.html).
75+
see e.g. FLORIS (https://github.com/conda-forge/floris-feedstock/blob/master/recipe/meta.yaml).
76+
- make a pull request to https://github.com/conda-forge/staged-recipes/

openfast_toolbox/__init__.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
"""Initialize everything"""
2+
import os
3+
from openfast_toolbox.common import *
4+
# Make main io tools available
5+
from .io import read
6+
from .io.fast_input_file import FASTInputFile
7+
from .io.fast_output_file import FASTOutputFile
8+
from .io.fast_input_deck import FASTInputDeck
9+
10+
# Add version to package
11+
with open(os.path.join(os.path.dirname(__file__), "..", "VERSION")) as fid:
12+
__version__ = fid.read().strip()
13+
14+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .aa_tools import *
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Examples provided in this directory need to be adapted to specific use cases.
2+
3+
Examples starting with an underscore `(_*.py)` are currently not expected to be "runable" out of the box.

0 commit comments

Comments
 (0)