waves.utilities.library#
Provides a consistent way to read and write YAML data, largely based on WOMBAT's library module.
All library data should adhere to the following directory structure within a library path:
├── project
├── config <- Project-level configuration files
├── port <- Port configuration files
├── plant <- Wind farm layout files
├── cables <- Export and Array cable configuration files
├── substations <- Substation configuration files
├── turbines <- Turbine configuration and power curve files
├── vessels <- Land-based and offshore servicing equipment configuration files
├── weather <- Weather profiles
├── results <- The analysis log files and any saved output data
Functions
|
Loads and returns the contents of the YAML file. |
|
Converts a user-input string to a |
Classes
|
Customized |
- class waves.utilities.library.CustomSafeLoader(stream)[source]#
Customized
yaml.SafeLoader
that adds custom constructors for consistent data loading in safe mode.
- waves.utilities.library.resolve_path(value)[source]#
Converts a user-input string to a
Path
object and resolves it.- Return type:
Path
- Parameters:
value (str | Path) -- A string or Path to a configuration library.
- Raises:
TypeError -- Raised if the input to
value
is not either astr
orpathlib.Path
.:- Returns:
Path -- The resolved Path object version of the input library path.
- waves.utilities.library.load_yaml(path, fname)[source]#
Loads and returns the contents of the YAML file.
- Return type:
Any
- Parameters:
path (str | Path) -- Path to the file to be loaded.
fname (str | Path) -- Name of the file (ending in .yaml) to be loaded.
- Returns:
Any -- Whatever content is in the YAML file.