Skip to content

Commit

Permalink
Raise error when Identity has no fillvalue provided and there are nan…
Browse files Browse the repository at this point in the history
…s in data
  • Loading branch information
louisPoulain committed Sep 13, 2024
1 parent 4d61174 commit 5e15e2f
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mlpp_lib/normalizers.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ def f(ds: xr.Dataset) -> xr.Dataset:
ds = ds[self.identity_vars].copy()
if self.fillvalue:
ds = ds.fillna(self.fillvalue)
else:
if ds.isnull().any():
raise ValueError("Missing values found in the data. Please proivde a fill value.")
return ds.astype("float32")

return tuple(f(ds) for ds in datasets)
Expand Down

0 comments on commit 5e15e2f

Please sign in to comment.