Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dict key validation & updated documentation #417

Merged
merged 10 commits into from
Oct 8, 2023
Merged

Added dict key validation & updated documentation #417

merged 10 commits into from
Oct 8, 2023

Conversation

kanekosh
Copy link
Contributor

@kanekosh kanekosh commented Sep 17, 2023

Purpose

Key validation

With this PR, OAS will check a user-defined dicts (mesh dict or surface dict) and warn if the user provides a key that is not implemented or used in OAS.

For example, some examples and tests provide the chord key when creating a mesh, but the key chord does not exist and therefore never used. I fixed them to root_chord, the one actually used.
I also removed unused keys from other tests.

Documentation update

The current documentation and docstrings say the chord_cp variable is the actual chord value in meters, but what the code (ScaleX component) actually does is that it applies the chord scaler to the initial mesh. Therefore chord_cp is actually a dimensionless chord scaler.
This PR fixes the documentation and docstrings.

Also, I updated the surface dict documentation.

(It's a little too late but I probably should've opened two separate PRs for this...)

Expected time until merged

Type of change

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (non-backwards-compatible fix or feature)
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no API changes)
  • Documentation update
  • Maintenance update
  • Other (please describe)

Testing

I added a new test to check the chord values before and after ScaleX is applied.

Checklist

  • I have run flake8 and black to make sure the Python code adheres to PEP-8 and is consistently formatted
  • I have formatted the Fortran code with fprettify or C/C++ code with clang-format as applicable
  • I have run unit and regression tests which pass locally with my changes
  • I have added new tests that prove my fix is effective or that my feature works
  • I have added necessary documentation

@kanekosh kanekosh requested a review from a team as a code owner September 17, 2023 22:27
@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

Merging #417 (76c8f30) into main (f2f974f) will increase coverage by 0.00%.
The diff coverage is 96.15%.

@@           Coverage Diff           @@
##             main     #417   +/-   ##
=======================================
  Coverage   94.50%   94.51%           
=======================================
  Files         103      104    +1     
  Lines        6448     6469   +21     
=======================================
+ Hits         6094     6114   +20     
- Misses        354      355    +1     
Files Coverage Δ
openaerostruct/geometry/geometry_group.py 100.00% <100.00%> (ø)
openaerostruct/geometry/geometry_mesh.py 98.63% <ø> (ø)
...rostruct/geometry/geometry_mesh_transformations.py 99.67% <100.00%> (ø)
openaerostruct/integration/aerostruct_groups.py 97.54% <100.00%> (+0.03%) ⬆️
openaerostruct/utils/check_surface_dict.py 100.00% <100.00%> (ø)
openaerostruct/geometry/utils.py 62.59% <92.30%> (+0.81%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

eytanadler
eytanadler previously approved these changes Sep 18, 2023
Copy link
Collaborator

@eytanadler eytanadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for fixing these!

@ewu63
Copy link
Collaborator

ewu63 commented Sep 19, 2023

In addition, I found that some examples and tests provide the chord key when creating a mesh, but the key chord does not exist and therefore never used. I fixed them to root_chord, the one actually used.

Should there be some sort of key validation then? To ensure we aren't passing in dict entries that are silently inactive?

@kanekosh
Copy link
Contributor Author

In addition, I found that some examples and tests provide the chord key when creating a mesh, but the key chord does not exist and therefore never used. I fixed them to root_chord, the one actually used.

Should there be some sort of key validation then? To ensure we aren't passing in dict entries that are silently inactive?

That's true, I'll add it.

@kanekosh kanekosh marked this pull request as draft September 19, 2023 21:50
@kanekosh kanekosh changed the title Fix chord variable documentation and examples Added dict key validation & updated documentation Oct 8, 2023
@kanekosh kanekosh marked this pull request as ready for review October 8, 2023 18:56
@kanekosh kanekosh requested a review from eytanadler October 8, 2023 18:56
@kanekosh
Copy link
Contributor Author

kanekosh commented Oct 8, 2023

Added key validation as @nwu63 suggested, ready for the 2nd review

eytanadler
eytanadler previously approved these changes Oct 8, 2023
Copy link
Collaborator

@eytanadler eytanadler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this tedious work. Only one very minor spelling correction, and otherwise looks good!

User-defined surface dict
"""

# NOTE: make sure this is consistend to the documentation's surface dict page
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consistend -> consistent

@kanekosh
Copy link
Contributor Author

kanekosh commented Oct 8, 2023

Thanks for the quick review!

@kanekosh kanekosh merged commit afcc73f into main Oct 8, 2023
8 checks passed
@kanekosh kanekosh deleted the fix_chord branch June 3, 2024 17:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants