Giter VIP home page Giter VIP logo

Comments (4)

gbarter avatar gbarter commented on September 27, 2024

Thank you for catching this and bringing it to our attention. The code in the example is more up-to-date with best practices of grabbing information from the yaml files. I am updating the language in the example tutorial accordingly (#526 ), thanks to your prompt.

from wisdem.

Tianmaru avatar Tianmaru commented on September 27, 2024

Ok, thank you, I will refer to the example code then. I think I got it to work, but I noticed that the validation method will fail if the file path is provided as a PosixPath instead of a string:

WARNING: Be sure to pip install simpy and marmot-agents for offshore BOS runs
Traceback (most recent call last):
  File <path>, line 22, in <module>
    data = load_geometry_yaml(baseyaml)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File <path>, line 128, in load_geometry_yaml
    return validate_with_defaults(finput, fschema_geom)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "lib/python3.12/site-packages/wisdem/inputs/validation.py", line 122, in validate_with_defaults
    DefaultValidatingDraft7Validator(yaml_schema).validate(myobj)
  File "lib/python3.12/site-packages/jsonschema/validators.py", line 438, in validate
    raise error
jsonschema.exceptions.ValidationError: PosixPath('/home/user/project/nrel5mw.yaml') is not of type 'object'

Also, would it be possible to include e.g. the reference turbines in the distribution to make them accessible via importlib.resources? Or does it mean legal trouble to redistribute the models?

from wisdem.

gbarter avatar gbarter commented on September 27, 2024

I'm not sure what the suggested action is on the yaml read functions. Is this just for your own script? Seems like you can just convert to a string before passing to the function?

On the reference turbine files, you are asking for the files to be installed as package data files instead of just files in this example directory?

from wisdem.

Tianmaru avatar Tianmaru commented on September 27, 2024

Sure, I also ended up converting the Path object to a string myself - however, keep in mind that unfamiliar users like myself would expect Path objects to work for file paths, and the error message isn't clearly stating that the yaml validation function is expecting the file paths to be provided only as strings, leaving the impression that the validation function might be broken.

Regarding the turbine reference files: yes, I think that is what me from a month ago was suggesting - I am not really sure about the benefits anymore though.

from wisdem.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.