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 error for nans in TimeSeries/T3D/etc missing #433

Closed
veenstrajelmer opened this issue Dec 15, 2022 · 1 comment · Fixed by #460
Closed

Validation error for nans in TimeSeries/T3D/etc missing #433

veenstrajelmer opened this issue Dec 15, 2022 · 1 comment · Fixed by #460
Labels
type: enhancement Improvements to existing functionality
Milestone

Comments

@veenstrajelmer
Copy link
Collaborator

veenstrajelmer commented Dec 15, 2022

Describe the bug
When writing a TimeSeries (or ForcingModel) containing nans, there is no validation error. However, the FM kernel is not able to handle nan values and it will crash with some erro. Therefore, nans in the file are not valid FM input, so should be validated by hydrolib-core.

To Reproduce

from pathlib import Path
import numpy as np
import hydrolib.core.dflowfm as hcdfm

datablock = np.random.uniform(low=-40, high=130.3, size=(4,2))*np.nan
datablock_list = datablock.tolist()

steric = hcdfm.TimeSeries(
    name="east2_0001",
    quantityunitpair=[hcdfm.QuantityUnitPair(quantity="time", unit="seconds since 2022-01-01 00:00:00 +00:00"),
                      hcdfm.QuantityUnitPair(quantity="waterlevel", unit="m")],
    timeinterpolation=hcdfm.TimeInterpolation.linear,
    datablock=datablock_list, 
    )
bc_east = hcdfm.ForcingModel()
bc_east.forcing.append(steric)
bc_east.save(filepath=Path("./steric_east2_hydrolib.bc"))

Expected behavior
Error when nans in dataset.

Version info (please complete the following information):

  • OS: Windows, Spyder
  • Version 0.3.1 (main branch of today)
@arthurvd arthurvd added this to To do in HYDROLIB-core via automation Mar 7, 2023
@arthurvd arthurvd added the type: enhancement Improvements to existing functionality label Mar 7, 2023
@arthurvd arthurvd added this to the Release 0.5 milestone Mar 7, 2023
@tim-vd-aardweg tim-vd-aardweg moved this from To do to In progress in HYDROLIB-core Mar 7, 2023
@tim-vd-aardweg tim-vd-aardweg self-assigned this Mar 9, 2023
@tim-vd-aardweg
Copy link
Contributor

tim-vd-aardweg commented Mar 10, 2023

Discussed this issue with @arthurvd. Even though we know the requested change should be applied to more FM files, for now we will only fix the NaN validation in datablocks. We can create separate issues for the other files/locations.

@tim-vd-aardweg tim-vd-aardweg moved this from In progress to Ready to review in HYDROLIB-core Mar 10, 2023
@tim-vd-aardweg tim-vd-aardweg removed their assignment Mar 10, 2023
@arthurvd arthurvd moved this from Ready to review to Review in progress in HYDROLIB-core Mar 13, 2023
@arthurvd arthurvd moved this from Review in progress to Reviewer follow up in HYDROLIB-core Mar 13, 2023
@tim-vd-aardweg tim-vd-aardweg moved this from Reviewer follow up to In progress in HYDROLIB-core Mar 14, 2023
@tim-vd-aardweg tim-vd-aardweg moved this from In progress to Ready to review in HYDROLIB-core Mar 14, 2023
@arthurvd arthurvd moved this from Ready to review to Review in progress in HYDROLIB-core Mar 15, 2023
@arthurvd arthurvd moved this from Review in progress to Test in HYDROLIB-core Mar 15, 2023
@veenstrajelmer veenstrajelmer moved this from Test to Ready to merge in HYDROLIB-core Mar 17, 2023
HYDROLIB-core automation moved this from Ready to merge to Done Mar 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Improvements to existing functionality
Projects
HYDROLIB-core
  
Done
Development

Successfully merging a pull request may close this issue.

3 participants