-
Notifications
You must be signed in to change notification settings - Fork 4
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
Feat/316 forcing vectorquantities #381
Conversation
…ndaries * VectorQuantityUnitPairs object represents both the "vector=" headerline and *all* coupled vector elements's QuantityUnitPairs below. * `ScalarOrVectorQUP = Union[QuantityUnitPair, VectorQuantityUnitPairs]` for convenience. * same approach taken as was already done for the original QuantityUnitPair creation and the vertPositionIndex modification, namely via a root_validator (pre=True) in both TimeSeries and T3D. * the actual root_validator `_validate_vectordefinition_and_update_quantityunitpairs()` has been placed in `class ForcingBase` to share all code. * unit tests added, both reading from file and constructing in memory.
tests/data/input/dflowfm_individual_files/FlowFM_boundaryconditions3d_and_vectors.bc
Outdated
Show resolved
Hide resolved
hydrolib/core/io/bc/models.py
Outdated
# created VectorQUPs. | ||
quantityunitpairs_with_vectors = [] | ||
|
||
# If one quantity is "time", it must be the first one. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the first quantity always be "time"? So shouldn't we raise an error if the first quantity is not "time"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not required by D-HYDRO. We only use it in hydrolib-core as the only pragmatic way to detect where the vector elements start.
* VectorQuantityUnitPairs now has Config, validate_assignment = True to re-run validators when its children quantityunitpair list gets re-assigned. * Some extra vector validation is now directly in VectorQuantityUnitPairs, when creating these objects from scratch (as opposed to reading from file) * the original vector validator that used to be in ForcingBase was now moved to dedicated class VectorQUPValidation, used by both TimeSeries and T3D. * This new class VectorQUPValidation also has separate subroutine for validating number of vector elements, again useful when constructing TimeSeries or T3D from scratch (as opposed to reading from file) * some extra unit tests asserting errors when quantity names are wrong or wrong amount. * test_bc, cleanup: time unit "m" -> parameter.
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Review OK! As discussed, I will create a separate issue for a refactoring of vector implementation.
Fixes #316.