• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

WISDEM / WEIS / 17924227114

22 Sep 2025 06:04PM UTC coverage: 58.0% (-0.6%) from 58.572%
17924227114

Pull #430

github

dzalkind
Activate test mode for overrides example
Pull Request #430: Support for WindIO 2.0 and WISDEM 4.0

674 of 767 new or added lines in 17 files covered. (87.87%)

125 existing lines in 8 files now uncovered.

7913 of 13643 relevant lines covered (58.0%)

0.58 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.9
/weis/inputs/validation.py
1
import os
1✔
2
import jsonmerge
1✔
3
import wisdem.inputs
1✔
4
import wisdem.inputs.validation as wisval
1✔
5
import rosco.toolbox.inputs
1✔
6
from openfast_io.FileTools import remove_numpy
1✔
7

8
froot_wisdem           = os.path.dirname(wisdem.inputs.__file__)
1✔
9
fschema_model_wisdem   = os.path.join(froot_wisdem, 'modeling_schema.yaml')
1✔
10
fschema_opt_wisdem     = os.path.join(froot_wisdem, 'analysis_schema.yaml')
1✔
11

12
froot_rosco            = os.path.dirname(rosco.toolbox.inputs.__file__)
1✔
13
fschema_model_rosco    = os.path.join(froot_rosco, 'toolbox_schema.yaml')
1✔
14

15
froot           = os.path.dirname(os.path.realpath(__file__))
1✔
16
fdefaults_geom  = os.path.join(froot, 'geometry_defaults.yaml')
1✔
17
fschema_geom    = os.path.join(froot, 'geometry_schema.yaml')
1✔
18
fschema_model   = os.path.join(froot, 'modeling_schema.yaml')
1✔
19
fschema_opt     = os.path.join(froot, 'analysis_schema.yaml')
1✔
20

21
fschema_openfast       = os.path.join(froot, 'openfast_schema.yaml')
1✔
22
#---------------------
23
def load_default_geometry_yaml():
1✔
NEW
24
    return wisval.load_yaml(fdefaults_geom)
×
25

26
def get_geometry_schema():
1✔
27
    wisdem_schema = wisval.get_geometry_schema()
1✔
28
    weis_schema   = wisval.load_yaml(fschema_geom)
1✔
29
    merged_schema = jsonmerge.merge(wisdem_schema, weis_schema)
1✔
30
    return merged_schema
1✔
31

32
def load_geometry_yaml(finput):
1✔
33
    merged_schema = get_geometry_schema()
1✔
34
    return wisval._validate(finput, merged_schema, defaults=True, restrictive=False)
1✔
35

36
def write_geometry_yaml(instance, foutput):
1✔
37
    merged_schema = get_geometry_schema()
×
NEW
38
    wisval._validate(instance, merged_schema, restrictive=False, removal=False, defaults=False)
×
39
    sfx_str = '.yaml'
×
40
    if foutput[-5:] == sfx_str:
×
41
        sfx_str = ''
×
NEW
42
    wisval.write_yaml(instance, foutput+sfx_str)
×
43
    
44
def get_modeling_schema():
1✔
45
    wisdem_schema = wisval.load_yaml(fschema_model_wisdem)
1✔
46
    rosco_schema  = wisval.load_yaml(fschema_model_rosco)
1✔
47
    openfast_schema = wisval.load_yaml(fschema_openfast)
1✔
48
    weis_schema   = wisval.load_yaml(fschema_model)
1✔
49

50
    # Merge ROSCO options and update modeling
51
    merged_rosco_schema = jsonmerge.merge(rosco_schema['properties']['controller_params'], weis_schema['properties']['ROSCO'])
1✔
52
    merged_rosco_schema['properties']['linmodel_tuning'] = rosco_schema['properties']['linmodel_tuning']
1✔
53
    weis_schema['properties']['ROSCO'].update(merged_rosco_schema)
1✔
54

55
    # Update WEIS schema with OpenFAST schema
56
    weis_schema['properties']['OpenFAST'].update( openfast_schema['properties']['OpenFAST'] )
1✔
57
    
58
    # Update WEIS schema with WISDEM schema
59
    merged_schema = jsonmerge.merge(weis_schema, wisdem_schema)
1✔
60

61
    return merged_schema
1✔
62

63
def load_modeling_yaml(finput):
1✔
64
    weis_schema = get_modeling_schema()
1✔
65
    return wisval._validate(finput, weis_schema, defaults=True, restrictive=False)
1✔
66

67
def write_modeling_yaml(instance, foutput):
1✔
68
    weis_schema = get_modeling_schema()
1✔
69
    
70
    instance2 = wisval.simple_types(instance)
1✔
71
    instance2 = remove_numpy(instance2)
1✔
72

73
    wisval._validate(instance2, weis_schema, restrictive=False, removal=True, defaults=False, rank_0=True)
1✔
74

75
    # Ensure the output filename does not end with .yaml or .yml
76
    if foutput.endswith(".yaml"):
1✔
NEW
77
        foutput = foutput[:-5]
×
78
    elif foutput.endswith(".yml"):
1✔
NEW
79
        foutput = foutput[:-4]
×
80
    sfx_str = "-modeling.yaml"
1✔
81

82
    wisval.write_yaml(instance2, foutput + sfx_str)
1✔
83
    return foutput + sfx_str
1✔
84
    
85
def get_analysis_schema():
1✔
86
    wisdem_schema = wisval.load_yaml(fschema_opt_wisdem)
1✔
87
    weis_schema   = wisval.load_yaml(fschema_opt)
1✔
88
    merged_schema = jsonmerge.merge(wisdem_schema, weis_schema)
1✔
89
    return merged_schema
1✔
90

91
def load_analysis_yaml(finput):
1✔
92
    merged_schema = get_analysis_schema()
1✔
93
    return wisval._validate(finput, merged_schema, defaults=True, restrictive=True)
1✔
94

95
def write_analysis_yaml(instance, foutput):
1✔
96
    merged_schema = get_analysis_schema()
1✔
97

98
    wisval._validate(instance, merged_schema, restrictive=True, removal=True, defaults=False, rank_0=True)
1✔
99

100
    # Ensure the output filename does not end with .yaml or .yml
101
    if foutput.endswith(".yaml"):
1✔
NEW
102
        foutput = foutput[:-5]
×
103
    elif foutput.endswith(".yml"):
1✔
NEW
104
        foutput = foutput[:-4]
×
105

106
    sfx_str = "-analysis.yaml"
1✔
107
    wisval.write_yaml(instance, foutput + sfx_str)
1✔
108
    return foutput + sfx_str
1✔
109
    
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc