Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
89 commits
Select commit Hold shift + click to select a range
6097a73
Merge branch 'OpenFAST:dev' into dev
mayankchetan Aug 5, 2024
c94e789
update openfast_io to dev, add working main for reader & writer
mayankchetan Aug 5, 2024
3313e72
update lib name to openfast_io
mayankchetan Aug 5, 2024
f506755
add main func to turbsim_file
mayankchetan Aug 5, 2024
c54da68
check if r-test is cloned
mayankchetan Aug 6, 2024
7faa58b
handle blank line before END in certain input files
mayankchetan Aug 6, 2024
8f031f6
genralizing map++ read write
mayankchetan Aug 6, 2024
e18a220
adding moordyn outputs, TODO: flexi outputs
mayankchetan Aug 6, 2024
cd13555
inital add of ExtPtfm & Superelement
mayankchetan Aug 6, 2024
847d5ab
squashed bugs in ExpPtfm
mayankchetan Aug 6, 2024
93eeaa4
squashed bugs in inflow, ad15, olaf
mayankchetan Aug 6, 2024
c73c16e
Abs paths to aux files
mayankchetan Aug 7, 2024
9303fd5
adding double quotes to PrescribedCircFile
mayankchetan Aug 7, 2024
72d2f73
pytest to exercise most OpenFAST modules
mayankchetan Aug 7, 2024
e5cee24
addressing AD15 warning about input format
mayankchetan Aug 7, 2024
4a4d897
removing module versions on inputfile headers
mayankchetan Aug 7, 2024
684952d
renaming folders to follow best practices
mayankchetan Aug 15, 2024
62ce628
updates to .toml & poetry lock
mayankchetan Aug 19, 2024
a0bed7c
update .gitignore for python
mayankchetan Aug 19, 2024
09775e1
testing GH Actions for test pypi upload
mayankchetan Aug 19, 2024
611f269
hatch testing
mayankchetan Aug 19, 2024
bf28ac6
cd since not in main folder
mayankchetan Aug 19, 2024
a6edae7
change workdie
mayankchetan Aug 19, 2024
2f49937
change version
mayankchetan Aug 19, 2024
ab95661
change version
mayankchetan Aug 19, 2024
d628e47
change version
mayankchetan Aug 19, 2024
839e4b5
prepping to add pytest to cmake
mayankchetan Aug 23, 2024
df70883
prepping to add pytest to cmake
mayankchetan Aug 23, 2024
1b9ed0b
working pytest with cmakegit status! :D
mayankchetan Aug 23, 2024
e5a5abd
oops
mayankchetan Aug 23, 2024
0ef25bc
adding openfast_io GH Actions
mayankchetan Aug 23, 2024
9a44fa8
working GH A
mayankchetan Aug 24, 2024
852471b
Install the openfast_io library in GH Action
mayankchetan Aug 24, 2024
f3136d9
correcting path to openfast_io from runner workspace
mayankchetan Aug 24, 2024
19501cc
add log file
mayankchetan Aug 24, 2024
53147f4
adding log files to openfast_io pytest
mayankchetan Aug 24, 2024
bd8fef2
lets get dll location
mayankchetan Aug 24, 2024
36d43d3
artifact name conflict
mayankchetan Aug 25, 2024
721b529
fixed DLL paths in all three test approaches
mayankchetan Aug 26, 2024
7086f90
commenting out furl
mayankchetan Aug 26, 2024
ac925e9
remove openfast_io from rtest-interfaces
mayankchetan Aug 26, 2024
692ddb2
revert artifacts being saved
mayankchetan Aug 26, 2024
8830377
Merge pull request #3 from mayankchetan/switch2Hatch
mayankchetan Aug 26, 2024
02cd902
Merge branch 'OpenFAST:dev' into dev
mayankchetan Aug 26, 2024
d0ef089
updating warning wrt OLAF and UA use
mayankchetan Aug 26, 2024
8bade4c
Merge branch 'dev' into of_io_update
mayankchetan Aug 26, 2024
98b7511
API updates without ADsk & SED
mayankchetan Aug 27, 2024
d3f0c30
added SED & ADsk to read/write, updated outlist reading
mayankchetan Aug 28, 2024
bb7f142
expanding tests to (almost) all openfast glue-code r-tests
mayankchetan Aug 28, 2024
c546c3b
arbritrary comment lines in AF files
mayankchetan Aug 29, 2024
eba1c17
Merge branch 'OpenFAST:dev' into dev
mayankchetan Aug 30, 2024
c3d9859
Merge branch 'dev' into of_io_update
mayankchetan Aug 30, 2024
8789357
adding large angle yaw & bug fix for AD15 nac yaw, thanks to @DanZ
mayankchetan Aug 30, 2024
c766414
remove AD14, change AeroDyn15 --> AeroDyn, and some cleanup
mayankchetan Sep 3, 2024
f6e8883
Merge branch 'OpenFAST:dev' into dev
mayankchetan Sep 5, 2024
662ee35
remove old test
mayankchetan Sep 5, 2024
8ee7a03
Merge branch 'dev' into of_io_update
mayankchetan Sep 5, 2024
1b4da49
Merge branch 'OpenFAST:dev' into dev
mayankchetan Sep 5, 2024
0075994
Merge branch 'dev' into of_io_update
mayankchetan Sep 5, 2024
3d709e9
AF coord changes + SubDyn api removal
mayankchetan Sep 6, 2024
794dfcb
bug fix with FocalDistanceX in inflowind reader
mayankchetan Sep 6, 2024
8342fee
adding fst_vt compare, significant testing robustness increase
mayankchetan Sep 7, 2024
862b4b5
bug fixes caught by fst_vt compare
mayankchetan Sep 7, 2024
7ba57ed
new tests for lib robustness, verifying fst_vt
mayankchetan Sep 9, 2024
e163016
remove np.float_ for numpy >2.0
mayankchetan Sep 9, 2024
3fdc278
Merge branch 'OpenFAST:dev' into dev
mayankchetan Sep 24, 2024
fd44c2a
Merge branch 'dev' into of_io_update
mayankchetan Sep 24, 2024
e734408
extinflow
mayankchetan Sep 24, 2024
44aae75
Merge branch 'OpenFAST:dev' into dev
mayankchetan Oct 1, 2024
be70790
Merge branch 'dev' into of_io_update
mayankchetan Oct 1, 2024
1c96c43
first pypi test
mayankchetan Oct 8, 2024
dce15ea
adding keyring dependancy fot hatch
mayankchetan Oct 9, 2024
71c417d
Merge branch 'OpenFAST:dev' into dev
mayankchetan Dec 5, 2024
7c0e80a
Merge branch 'dev' into of_io_update
mayankchetan Dec 5, 2024
d34b19b
Merge branch 'OpenFAST:dev' into dev
mayankchetan Dec 23, 2024
9cb6084
Merge branch 'dev' into of_io_update
mayankchetan Dec 23, 2024
d4bb80d
updating yaw friction model
mayankchetan Dec 23, 2024
1e81a9a
updating keyring
mayankchetan Dec 23, 2024
663e2c1
reverting project tomel
mayankchetan Dec 23, 2024
9ffa4c7
version change 4 test
mayankchetan Dec 23, 2024
2f44ccd
testing pipi on main repo
mayankchetan Dec 23, 2024
bbe7c56
worflow dispatch based
mayankchetan Dec 23, 2024
1c93ded
Merge branch 'OpenFAST:dev' into dev
mayankchetan Dec 23, 2024
357e6ff
Merge branch 'dev' into of_io_update
mayankchetan Dec 23, 2024
fd07cf6
print summary of turbsim
mayankchetan Dec 23, 2024
00db7af
updating docs
mayankchetan Dec 23, 2024
4c76a0e
Revert "updating docs"
mayankchetan Dec 23, 2024
80bb3af
updating docs and actions
mayankchetan Dec 23, 2024
cc4ba09
matching comments to r-test dev
mayankchetan Dec 24, 2024
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
48 changes: 47 additions & 1 deletion .github/workflows/automated-dev-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,8 @@ jobs:
- name: Run Interface / API tests
working-directory: ${{runner.workspace}}/openfast/build
run: |
ctest -VV -L "cpp|python|fastlib"
ctest -VV -L "cpp|python|fastlib" \
-LE "openfast_io"
- name: Failing test artifacts
uses: actions/upload-artifact@v4
if: failure()
Expand Down Expand Up @@ -601,6 +602,51 @@ jobs:
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/UAE_VI
!${{runner.workspace}}/openfast/build/reg_tests/glue-codes/openfast/WP_Baseline

rtest-openfast_io:
runs-on: ubuntu-22.04
needs: build-openfast-release
steps:
- name: Cache the workspace
uses: actions/cache@v4
with:
path: ${{runner.workspace}}
key: build-openfast-release-${{ github.sha }}
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Install dependencies
run: |
pip install -r requirements.txt
sudo apt-get update -y
sudo apt-get install -y libopenblas-dev libopenblas-openmp-dev
sudo apt-get install -y libhdf5-dev libnetcdf-dev libopenmpi-dev libyaml-cpp-dev
- name: Install openfast_io
working-directory: ${{runner.workspace}}/openfast/openfast_io
run: |
pip install -e .
- name: Configure Tests
working-directory: ${{runner.workspace}}/openfast/build
run: |
cmake \
-DPython_ROOT_DIR:STRING=${{env.pythonLocation}} \
-DBUILD_TESTING:BOOL=ON \
-DCTEST_PLOT_ERRORS:BOOL=ON \
${GITHUB_WORKSPACE}
cmake --build . --target regression_test_controllers
- name: Run openfast_io tests
working-directory: ${{runner.workspace}}/openfast/build
run: |
ctest -VV -j4 \
-L openfast_io
- name: Failing test artifacts
uses: actions/upload-artifact@v4
if: failure()
with:
name: rtest-openfast_io
path: |
${{runner.workspace}}/openfast/build/reg_tests/openfast_io


rtest-OF-simulink:
runs-on: ubuntu-22.04
Expand Down
71 changes: 54 additions & 17 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,38 +6,75 @@ name: deploy

on:
workflow_dispatch:

release:
types:
- released


jobs:
publish-to-pypi:
publish-to-pypi-test:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read

if: github.event_name == 'workflow_dispatch'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.12'
cache: 'pip'

- name: Install Poetry
uses: snok/install-poetry@v1.3.4
- name: Install Hatch
uses: pypa/hatch@install

- name: Build a binary wheel and a source tarball
run: poetry build
working-directory: openfast_python
- name: Install dependencies
run: pip install keyring[file]

- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@v1.8.14
- name: Build package
run: hatch build
working-directory: openfast_io

- name: Publish to PyPI test
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TEST_TOKEN }}
run: hatch publish -r test
working-directory: openfast_io

publish-to-pypi:
runs-on: ubuntu-latest
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v3

- name: Set up Python
uses: actions/setup-python@v4
with:
packages-dir: openfast_python/dist
python-version: '3.12'
cache: 'pip'

- name: Install Hatch
uses: pypa/hatch@install

- name: Install dependencies
run: pip install keyring[file]

- name: Build package
run: hatch build
working-directory: openfast_io

- name: Publish to PyPI
env:
HATCH_INDEX_USER: __token__
HATCH_INDEX_AUTH: ${{ secrets.PYPI_TOKEN }}
run: hatch publish
working-directory: openfast_io

docker-build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 300
if: github.event_name == 'release'
timeout-minutes: 500
env:
DOCKERFILE_PATH: share/docker/Dockerfile
DOCKERHUB_REPOSITORY: nrel/openfast
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,7 @@ vs-build/
#Simulink cache files
varcache
*.slxc

# Python cache files
openfast_io/dist/
openfast_io/openfast_io/_version.py
22 changes: 17 additions & 5 deletions docs/source/install/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -217,17 +217,29 @@ You can also build your own custom images using our `Dockerfile` or base your im
Install the ``openfast_io`` python wrapper
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The ``openfast_io`` python package is a wrapper comprising readers and writers for converting OpenFAST files to/from
python objects. You can install it with:
python objects.

.. code-block::
To use `openfast_io` as a library for incorporation into other scripts or tools, it is available via (assuming that you have already setup your python environment):

.. code-block:: bash

pip install openfast_io

or
These instructions are for interaction directly with the `openfast_io` source code.

1. Follow this step only if you have not cloned the OpenFAST repo:

.. code-block:: bash

git clone https://github.com/OpenFAST/OpenFAST.git
cd OpenFAST

.. code-block::
2. Assuming you are within the OpenFAST directory:

.. code-block:: bash

poetry add openfast_io
cd openfast_io
pip install -e .

For more information and installation options, see the `OpenFAST Python readme <https://github.com/OpenFAST/openfast/blob/main/openfast_python/README.md>`_.

Expand Down
51 changes: 51 additions & 0 deletions openfast_io/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# OpenFAST python readers/writers

This package is a python wrapper comprising readers and writers for converting OpenFAST files to/from python objects. It
was originally written for [WEIS](https://github.com/WISDEM/WEIS/tree/77a878d7989b8c1d07d2244135ccd308a193a924/weis/aeroelasticse) and has been ported over to OpenFAST to make it more widely accessible.

## Installation
Installation with [Anaconda](https://www.anaconda.com) is the recommended approach because of the ability to create self-contained environments suitable for testing and analysis.

### Installation as a "library"

To use `openfast_io` as a library for incorporation into other scripts or tools, it is available via (assuming that you have already setup your python environment):

```shell
pip install openfast_io
```

### Installation as an editable library

These instructions are for interaction directly with the `openfast_io` source code.

0. Follow this step only if you have not cloned the OpenFAST repo.
```shell
git clone https://github.com/OpenFAST/OpenFAST.git
cd OpenFAST
```

1. Assuming you are within the OpenFAST directory.
```shell
cd openfast_io
pip install -e .
```

2. To test `openfast_io`, OpenFAST must be compiled within the build folder, then run:

```shell
cd tests
pytest test_of_io_pytest.py
```

### Extra options
[ROSCO](https://github.com/NREL/ROSCO) can be installed as an optional dependency. Run either
```shell
pip install openfast_io[rosco]
```

## Development and testing
To contribute to the development of `openfast_io`, install additioal depemndancies using:

```shell
pip install -e ".[all]"
```
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ def toDataFrame(self):
return df


def load_ascii_output(filename):
def load_ascii_output(filename, headerLines = 8, descriptionLine = 4, attributeLine = 6, unitLine = 7, delimiter = None):
with open(filename) as f:
info = {}
info['name'] = os.path.splitext(os.path.basename(filename))[0]
header = [f.readline() for _ in range(8)]
info['description'] = header[4].strip()
info['attribute_names'] = header[6].split()
info['attribute_units'] = [unit[1:-1] for unit in header[7].split()] #removing "()"
data = np.array([line.split() for line in f.readlines()], dtype=float)
header = [f.readline() for _ in range(headerLines)]
info['description'] = header[descriptionLine].strip()
info['attribute_names'] = header[attributeLine].strip().split(delimiter)
info['attribute_units'] = [unit[1:-1] for unit in header[unitLine].strip().split(delimiter)] #removing "()"
data = np.array([line.split(delimiter) for line in f.readlines()], dtype=float)
return data, info

def load_binary_output(filename):
Expand Down Expand Up @@ -211,16 +211,20 @@ def fread(fid, n, type):


if __name__=="__main__":
d,i = load_binary_output('Test18.T1.outb')
types = []
for j in range(39):
types.append('f8')
print(type(i['attribute_names']))

print(np.dtype({'names':tuple(i['attribute_names']), 'formats': tuple(types) }))
print(type(d))
print(np.array(d,dtype=np.dtype({'names':tuple(i['attribute_names']), 'formats': tuple(types) })))
from openfast_io.FileTools import check_rtest_cloned

parent_dir = os.path.dirname( os.path.dirname( os.path.dirname( os.path.realpath(__file__) ) ) ) + os.sep

of_outputfile = os.path.join(parent_dir, 'reg_tests', 'r-test', 'glue-codes',
'openfast', '5MW_Land_BD_DLL_WTurb', '5MW_Land_BD_DLL_WTurb.outb')

check_rtest_cloned(of_outputfile)

d,i,p = load_binary_output(of_outputfile)

print(tuple(i['attribute_names']))
print(type(d))
print(i)
print(len(i['attribute_names']))
print(np.shape(d))
Loading