Skip to content

Commit

Permalink
try
Browse files Browse the repository at this point in the history
  • Loading branch information
visr committed Sep 24, 2024
1 parent a9fb8d1 commit d49d634
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion python/ribasim/ribasim/delwaq/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _make_boundary(data, boundary_type):
.reset_index(drop=True)
)
# Convert Arrow time to Numpy to avoid needing tzdata somehow
piv.time = piv.time.astype("datetime64[ns]").dt.strftime("%Y-%m-%d %H:%M:%S")
piv.time = piv.time.astype("datetime64[ns]").dt.strftime("%Y/%m/%d-%H:%M:%S")

Check warning on line 78 in python/ribasim/ribasim/delwaq/generate.py

View check run for this annotation

Codecov / codecov/patch

python/ribasim/ribasim/delwaq/generate.py#L78

Added line #L78 was not covered by tests
boundary = {
"name": bid,
"substances": list(map(_quote, piv.columns[1:])),
Expand Down Expand Up @@ -251,18 +251,25 @@ def _setup_boundaries(model):
substances = set()

if model.level_boundary.concentration.df is not None:
model.level_boundary.concentration.df["concentration"].fillna(

Check warning on line 254 in python/ribasim/ribasim/delwaq/generate.py

View check run for this annotation

Codecov / codecov/patch

python/ribasim/ribasim/delwaq/generate.py#L254

Added line #L254 was not covered by tests
np.nan, inplace=True
)
for _, rows in model.level_boundary.concentration.df.groupby(["node_id"]):
boundary, substance = _make_boundary(rows, "LevelBoundary")
boundaries.append(boundary)
substances.update(substance)

if model.flow_boundary.concentration.df is not None:
model.flow_boundary.concentration.df["concentration"].fillna(

Check warning on line 263 in python/ribasim/ribasim/delwaq/generate.py

View check run for this annotation

Codecov / codecov/patch

python/ribasim/ribasim/delwaq/generate.py#L263

Added line #L263 was not covered by tests
np.nan, inplace=True
)
for _, rows in model.flow_boundary.concentration.df.groupby("node_id"):
boundary, substance = _make_boundary(rows, "FlowBoundary")
boundaries.append(boundary)
substances.update(substance)

if model.basin.concentration.df is not None:
model.basin.concentration.df["concentration"].fillna(np.nan, inplace=True)

Check warning on line 272 in python/ribasim/ribasim/delwaq/generate.py

View check run for this annotation

Codecov / codecov/patch

python/ribasim/ribasim/delwaq/generate.py#L272

Added line #L272 was not covered by tests
for _, rows in model.basin.concentration.df.groupby(["node_id"]):
for boundary_type in ("Drainage", "Precipitation"):
nrows = rows.rename(columns={boundary_type.lower(): "concentration"})
Expand Down

0 comments on commit d49d634

Please sign in to comment.