No project description provided
Project description
windIO Converter
A python package for converting windIO files/data-structures.
It includes conversion of the
- windIO file/data-structure it self
- From windIO to other formats
- To windIO from other formats
- HAWC2 to windIO
→
- HAWC2 to windIO
It also includes a modules for reading, writing and interacting with the resulting data format. It includes:
Installation
The windio_converter can be installed directly from PyPi with the command:
pip install windio_converter
Installation from source
It can also be install from source using git+ by:
pip install git+https://gitlab.windenergy.dtu.dk/AESOpt/windio-converter.git
This will prompt for the your username and password for Gitlab-Wind unless you already has setup a Personal Access Token.
Dependencies
The windio_converter aims to have a limited number of dependencies and particularly non "pure python" packages, to ensure that it is as easy as possible to install.
Dependencies which include compiled code are:
numpyscipy
The dependencies which are pure python is:
jmespath: A query language for JSON-like data. Makes it easy to extract data from deeply nesteddict's andlist's.ruamel.yaml: Reading and writing YAML files, which is the basis for windIO. This version is pure-python, but with the option to use thePyYAMLC-implementation if speed is important. It also allows to set/get/remove comments in the YAML file from python.aesoptparam: Module for declaring model parameters and settings, which integrates features such as: input type, documentation, validation, parameter linking, etc. It is an extension of the param which allows nested models, data units and more.
Simple example
Below is a simple example of loading a windIO file and converting it to a HAWC2. The example below assumes that you have a windIO file. For a fully functional example see the code below for the IEA-22-280-RWT which is provided as a part of the module.
Converting your own windIO model
# Loading the main converter
from windio_converter import windio_to_hawc2
# Loading reader and writers for windIO and HAWC2
from windio_converter.io import WindIO_dict, HAWC2_dict
# Create the base windIO dict
wio_dict = WindIO_dict()
# Load the windIO file into the dict
filename = "your-windio-file.yaml"
wio_dict.read_yaml(filename)
# Create the converter instance
converter = windio_to_hawc2(
wio_dict.as_dict(), # First argument is the windIO dict to be converted
init_rotor_speed=0.7, # Only required input, the initial rotor-speed
filenames=dict(base_name="your-turbine-base-name") # Optionally setting the base-name for all files
)
# Run the converter (creating a python build dict)
hawc2_pydict = converter.convert()
# Use the python dict to create a HAWC2_dict instance
hawc2_dict = HAWC2_dict(hawc2_pydict)
# You can add additional settings for your HAWC2 file here
#hawc2_dict["htc"].add("simulation")["time_stop"] = 200
# Write the resulting HAWC2 files
hawc2_dict.write_hawc2("your-output-directory")
Working example
Below is a fully working example converting the IEA-22-280-RWT from windIO to HAWC2
# Loading the main converter
from windio_converter import windio_to_hawc2
# Loading reader and writers for windIO and HAWC2
from windio_converter.io import WindIO_dict, HAWC2_dict
# For creating platform independent paths
import os
# Path location for test data
from windio_converter.test import test_path
# Create the base windIO dict
wio_dict = WindIO_dict()
# Load the windIO file into the dict
filename = os.path.join(test_path, "data", "IEA_22MW", "windIO", "IEA-22-280-RWT.yaml")
wio_dict.read_yaml(filename)
# Create the converter instance
converter = windio_to_hawc2(
wio_dict.as_dict(), # First argument is the windIO dict to be converted
init_rotor_speed=0.7, # Only required input, the initial rotor-speed
filenames=dict(base_name="IEA-22MW") # Optionally setting the base-name for all files
)
# Run the converter (creating a python build dict)
hawc2_pydict = converter.convert()
# Use the python dict to create a HAWC2_dict instance
hawc2_dict = HAWC2_dict(hawc2_pydict)
# You can add additional settings for your HAWC2 file here
#hawc2_dict["htc"].add("simulation")["time_stop"] = 200
# Write the resulting HAWC2 files to the execution directory
hawc2_dict.write_hawc2()
Documentation
The documentation with more extensive examples and all features can be found in the documentation here: https://aesopt.pages.windenergy.dtu.dk/windio-converter
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file windio_converter-0.2.8-py3-none-any.whl.
File metadata
- Download URL: windio_converter-0.2.8-py3-none-any.whl
- Upload date:
- Size: 1.1 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1eb1ed36c324d7514d7f53e6df9a6972c48c0ffb0dbf39aa6856fea829c9e16d
|
|
| MD5 |
efae306e84abcb791849b2479965a820
|
|
| BLAKE2b-256 |
0bce08f0d4e075f3262c666a54bd1acf9dbdba1390943050b361895de9f82a60
|