Skip to content
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions nlmod/read/regis.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ def get_regis(
variables = variables + ("sdh", "sdv")
ds = ds[list(variables)]

# the 'c' value is specified as a timedelta[ns] and should be converted to a float in days.
# this needs to be done before the NaN replacement of -9999 values.
if "c" in variables and ds["c"].dtype.type is np.timedelta64:
ds["c"] = ds["c"] / np.timedelta64(1, "D")

# since version REGIS v02r2s2 (22.07.2024) NaN values are replaced by -9999
# we set these values to NaN again
if nodata is not None:
Expand All @@ -198,6 +203,8 @@ def get_regis(
ds[datavar].attrs["units"] = "mNAP"
elif datavar in ["kh", "kv"]:
ds[datavar].attrs["units"] = "m/day"
elif datavar in ["c"]:
ds[datavar].attrs["units"] = "days"

# set the crs to dutch rd-coordinates
ds.rio.write_crs(28992, inplace=True)
Expand Down