You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
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.
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
Expected behavior
Error when nans in dataset.
Version info (please complete the following information):
The text was updated successfully, but these errors were encountered: