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

Release v0.8.1 #363

Merged
merged 4 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
18 changes: 12 additions & 6 deletions nlmod/read/regis.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def get_regis(
remove_nan_layers=True,
drop_layer_dim_from_top=True,
probabilities=False,
nodata=-9999,
dbrakenhoff marked this conversation as resolved.
Show resolved Hide resolved
):
"""Get a regis dataset projected on the modelgrid.

Expand Down Expand Up @@ -158,6 +159,17 @@ def get_regis(
# rename bottom to botm, as it is called in FloPy
ds = ds.rename_vars({"bottom": "botm"})

# slice data vars
if variables is not None:
if probabilities:
variables = variables + ("sdh", "sdv")
ds = ds[list(variables)]

# since version REGIS v02r2s2 (22.07.2024) NaN values are replaced by -9999
# we set these values to NaN again
for var in variables:
ds[var] = ds[var].where(ds[var] != nodata)

if remove_nan_layers:
# only keep layers with at least one active cell
ds = ds.sel(layer=~(np.isnan(ds["botm"])).all(ds["botm"].dims[1:]))
Expand All @@ -168,12 +180,6 @@ def get_regis(
if drop_layer_dim_from_top:
ds = remove_layer_dim_from_top(ds)

# slice data vars
if variables is not None:
if probabilities:
variables = variables + ("sdh", "sdv")
ds = ds[list(variables)]

ds.attrs["gridtype"] = "structured"
ds.attrs["extent"] = extent
for datavar in ds:
Expand Down
2 changes: 1 addition & 1 deletion nlmod/version.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from importlib import metadata
from platform import python_version

__version__ = "0.8.0"
__version__ = "0.8.1"


def show_versions() -> None:
Expand Down