Skip to content

Commit

Permalink
Add WEIS file readers and writers (#2188)
Browse files Browse the repository at this point in the history
* FEA: Add python package outline

* REF: Rename python distribution/package to `openfast_python` / `openfast`

* FEA: Move OpenFAST readers/writers over from WEIS

* DEP: Add `pcrunch` dependency

* REF: Update import paths from `weis` to `openfast`

* DOC: Add contributors from WEIS to `authors` in `pyproject.toml`

* DOC: Add brief explanation of `openfast` package to sub-readme

* OPS: Fix format for authors names/emails

* TST: Copy test from WEIS

* OPS: Move `pyproject.toml` to top level

* OPS: Publish `openfast` package to PyPI on release

* TST: Add test data for `openfast` python package

* REF: Remove extra python files

* DOC: Adjust readme wording

* DOC: Use link to specific git ref instead of `main` branch in readme

* OPS: Add note about not relying on the `octue-openfast` package

* OPS: Allow workflow dispatch of `deploy` workflow

* WIP: Temporarily change name of python package

* Deleting files related to running OpenFAST, Restructuring to be IO reading and writing only

* setting ROSCO as optional, removing lin

* updating the test files before move to r-test

* removing rosco and pcrunch as deps

* OpenFAST Output & Lin reader

* Adding Oputput reader to test

* Pointing test to one r-test case, removing test_data

* Changing library name to openfast_io

* OPS: Move poetry files into distribution root and rename package

* REF: Rename package to `openfast_io`

* DEP: Add `rosco` as optional dependency

* DOC: Add installation instructions to python package readme

* DOC: Fix docker commands for GHCR images

* DOC: Add python package installation to docs

* DOC: Update python package readme

* WIP: Temporarily rename python package

* OPS: Set working directory for python package build and publish

* WIP: Temporarily change python package version

* FIX: Update python package import paths

* WIP: Increment temporary version number

* replaced references to weis within code.

* added Apache-2.0 license to pyproject.toml

---------

Co-authored-by: Mayank Chetan <[email protected]>
  • Loading branch information
cortadocodes and mayankchetan authored May 21, 2024
1 parent c867e1a commit 397d1b9
Show file tree
Hide file tree
Showing 20 changed files with 22,625 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
# This workflow builds an OpenFAST docker image for the linux/amd64 and linux/aarch64 architectures on merge into
# `main` from a release candidate branch. The image is tagged both with "latest" and the version extracted from the
# release candidate branch's name (e.g. "rc-3.5.3") before being pushed to the `nrel/openfast` repository. The build
# cache is stored in GitHub actions.
name: build-docker-image-automatic
# This workflow uploads the `openfast` python package to PyPI before building an OpenFAST docker image for the
# linux/amd64 and linux/aarch64 architectures on release. The image is tagged both with "latest" and the version
# extracted from the release candidate branch's name (e.g. "rc-3.5.3") before being pushed to the `nrel/openfast`
# repository. The build cache is stored in GitHub actions.
name: deploy

on:
workflow_dispatch:

release:
types:
- released

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

steps:
- name: Checkout Repository
uses: actions/checkout@v4

- name: Install Poetry
uses: snok/[email protected]

- name: Build a binary wheel and a source tarball
run: poetry build
working-directory: openfast_python

- name: Publish package distributions to PyPI
uses: pypa/[email protected]
with:
packages-dir: openfast_python/dist


docker-build-and-push:
runs-on: ubuntu-latest
timeout-minutes: 300
env:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ vs-build/
.fortls
.devcontainer
.idea
.env

# backup files
*.asv
Expand Down
23 changes: 23 additions & 0 deletions docs/source/install/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ code,** refer to the table in the :ref:`download_binaries` or :ref:`use_docker`
sections and read the corresponding documentation for specific instructions.
For instructions on compiling, see :ref:`compile_from_source`.

To manipulate OpenFAST files using python, see :ref:`python_wrapper`.


.. _download_binaries:

Download binaries
Expand Down Expand Up @@ -209,6 +212,26 @@ You can also build your own custom images using our `Dockerfile` or base your im
`here <https://github.com/OpenFAST/openfast/blob/main/share/docker/README.md>`_ for more information on this.


.. _python_wrapper
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:

.. code-block::
pip install openfast_io
or

.. code-block::
poetry add openfast_io
For more information and installation options, see `here <https://github.com/OpenFAST/openfast/blob/main/openfast_python/README.md>`_.


.. _compile_from_source:

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

> [!CAUTION]
> The `openfast_io` package on PyPI is currently called `octue-openfast` but will soon be renamed.
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
Run either
```shell
pip install openfast_io
```
or
```shell
poetry add openfast_io
```

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

0 comments on commit 397d1b9

Please sign in to comment.