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

Validation upon initialisation of TimeSeries is not strict enough #305

Open
veenstrajelmer opened this issue Aug 16, 2022 · 2 comments
Open
Labels
domain: validation type: bug Something isn't working
Milestone

Comments

@veenstrajelmer
Copy link
Collaborator

Describe the bug
Initialisation of TimeSeries does not fail when supplying incorrect number of QuantityUnitPairs for the amount of columns.

To Reproduce

from hydrolib.core.io.bc.models import QuantityUnitPair, TimeInterpolation, TimeSeries
steric = TimeSeries(
    name="east2_0001",
    quantityunitpair=[#QuantityUnitPair(quantity="time", unit="seconds since 2022-01-01 00:00:00 +00:00"),
                      QuantityUnitPair(quantity="waterlevel", unit="m")],
    timeinterpolation=TimeInterpolation.linear,
    datablock=[[0, 1.1], [3600, 2.3], [7200, 3.5], [10800, 2.4], [86400, -0.123]],
)

Expected behavior
Since there is only QuantityUnitPair supplied and there are two columns, the initialization of TimeSeries should fail I think.

Screenshots
If applicable, add screenshots to help explain your problem.

Version info (please complete the following information):

  • OS: Windows, Anaconda, Spyder
  • Version: 0.3.0

Additional context
Add any other context about the problem here.

@veenstrajelmer
Copy link
Collaborator Author

The title might have to be appended with: 'or validation is not carried out upon initialisation'. I realized I am not sure about this. If it is not validated, is it possible to call the validator manually?

@arthurvd arthurvd added this to the Release 0.4 milestone Sep 20, 2022
@arthurvd arthurvd added the type: bug Something isn't working label Sep 20, 2022
@arthurvd arthurvd modified the milestones: Release 0.4, Release 0.5 Jan 23, 2023
@arthurvd
Copy link
Member

arthurvd commented Apr 4, 2023

The validator for this issue might be simple, but the validation while constructing an object in memory will be tricky: when adding a QUPair column, the datablock is temporarily invalid (chicken-egg problem). Relates to #207 which is for reading faulty input, whereas this issue is for constructing (temporarily) faulty input..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain: validation type: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants