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

WISDEM / WEIS / 12551706651

30 Dec 2024 08:42PM UTC coverage: 78.866% (+0.7%) from 78.185%
12551706651

Pull #330

github

dzalkind
Count elements in each design variable
Pull Request #330: Mpi v2

57 of 178 new or added lines in 6 files covered. (32.02%)

20 existing lines in 4 files now uncovered.

21558 of 27335 relevant lines covered (78.87%)

0.79 hits per line

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

80.0
/weis/inputs/validation.py
1
import os
1✔
2
import jsonmerge
1✔
3
import wisdem.inputs
1✔
4
from wisdem.inputs.validation import load_yaml, write_yaml, _validate, simple_types, DefaultValidatingDraft7Validator
1✔
5
import rosco.toolbox.inputs
1✔
6
from weis.aeroelasticse.FileTools import remove_numpy
1✔
7

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

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

17
froot           = os.path.dirname(os.path.realpath(__file__))
1✔
18
fdefaults_geom  = os.path.join(froot, 'geometry_defaults.yaml')
1✔
19
fschema_geom    = os.path.join(froot, 'geometry_schema.yaml')
1✔
20
fschema_model   = os.path.join(froot, 'modeling_schema.yaml')
1✔
21
fschema_opt     = os.path.join(froot, 'analysis_schema.yaml')
1✔
22
#---------------------
23
def load_default_geometry_yaml():
1✔
24
    return load_yaml(fdefaults_geom)
×
25

26
def get_geometry_schema():
1✔
27
    wisdem_schema = load_yaml(fschema_geom_wisdem)
1✔
28
    weis_schema   = 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 _validate(finput, merged_schema, defaults=True)
1✔
35

36
def write_geometry_yaml(instance, foutput):
1✔
37
    merged_schema = get_geometry_schema()
×
38
    _validate(instance, merged_schema, defaults=False)
×
39
    sfx_str = '.yaml'
×
40
    if foutput[-5:] == sfx_str:
×
41
        sfx_str = ''
×
42
    write_yaml(instance, foutput+sfx_str)
×
43

44
def get_modeling_schema():
1✔
45
    wisdem_schema = load_yaml(fschema_model_wisdem)
1✔
46
    rosco_schema  = load_yaml(fschema_model_rosco)
1✔
47
    weis_schema   = load_yaml(fschema_model)
1✔
48
    merged_rosco_schema = jsonmerge.merge(rosco_schema['properties']['controller_params'], weis_schema['properties']['ROSCO'])
1✔
49
    merged_rosco_schema['properties']['linmodel_tuning'] = rosco_schema['properties']['linmodel_tuning']
1✔
50
    weis_schema['properties']['WISDEM'].update( wisdem_schema['properties']['WISDEM'] )
1✔
51
    weis_schema['properties']['ROSCO'].update(merged_rosco_schema)
1✔
52
    return weis_schema
1✔
53

54
def load_modeling_yaml(finput):
1✔
55
    weis_schema = get_modeling_schema()
1✔
56
    return _validate(finput, weis_schema, defaults=True)
1✔
57

58
def write_modeling_yaml(instance, foutput):
1✔
59
    weis_schema = get_modeling_schema()
1✔
60
    _validate(instance, weis_schema, defaults=False)
1✔
61
    sfx_str = ".yaml"
1✔
62
    if foutput[-5:] == sfx_str:
1✔
63
        foutput = foutput[-5:]
×
64
    elif foutput[-4:] == ".yml":
1✔
65
        foutput = foutput[-4:]
×
66
    sfx_str = "-modeling.yaml"
1✔
67
    instance2 = simple_types(instance)
1✔
68
    instance2 = remove_numpy(instance2)
1✔
69
    write_yaml(instance2, foutput+sfx_str)
1✔
70

71
def get_analysis_schema():
1✔
72
    wisdem_schema = load_yaml(fschema_opt_wisdem)
1✔
73
    weis_schema   = load_yaml(fschema_opt)
1✔
74
    merged_schema = jsonmerge.merge(wisdem_schema, weis_schema)
1✔
75
    return merged_schema
1✔
76

77
def load_analysis_yaml(finput):
1✔
78
    merged_schema = get_analysis_schema()
1✔
79
    return _validate(finput, merged_schema, defaults=True)
1✔
80

81
def write_analysis_yaml(instance, foutput):
1✔
82
    merged_schema = get_analysis_schema()
1✔
83
    _validate(instance, merged_schema, defaults=False)
1✔
84
    sfx_str = ".yaml"
1✔
85
    if foutput[-5:] == sfx_str:
1✔
86
        foutput = foutput[-5:]
×
87
    elif foutput[-4:] == ".yml":
1✔
88
        foutput = foutput[-4:]
×
89
    sfx_str = "-analysis.yaml"
1✔
90
    write_yaml(instance, foutput+sfx_str)
1✔
91

92
def re_validate_modeling(modeling_dict):
1✔
UNCOV
93
    fschema = get_modeling_schema()
×
UNCOV
94
    yaml_schema = load_yaml(fschema) if isinstance(fschema, type("")) else fschema
×
UNCOV
95
    DefaultValidatingDraft7Validator(yaml_schema).validate(modeling_dict)
×
96

97
def re_validate_analysis(analysis_dict):
1✔
98
    fschema = get_analysis_schema()
×
99
    yaml_schema = load_yaml(fschema) if isinstance(fschema, type("")) else fschema
×
100
    DefaultValidatingDraft7Validator(yaml_schema).validate(analysis_dict)
×
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