Deltares / Deltares/imod-python

transport balance loading goes wrong when species list is unordered.

Open
#756 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

needs tests
Dominant language
Python
Stars
41
Forks
12
Avg merge
21h 8m
Merged PRs (30d)
1

Description

Consider a transport model with 5 species a, b,c,d and e.
When loading the balances of this model we must indicate in which balances we are interested. However, the following test fails:
`
@pytest.mark.usefixtures("flow_transport_simulation")
def test_transport_balance_loading_order_mixup(tmp_path, flow_transport_simulation):

flow_transport_simulation.write(tmp_path)
flow_transport_simulation.run()

balance_ordered = flow_transport_simulation.open_transport_budget(species_ls=["a", "b", "d"])
balance_unordered = flow_transport_simulation.open_transport_budget(species_ls=["d", "b", "a"])


assert np.all(balance_ordered.sel(species = "a")["ssm"].values == balance_unordered.sel(species = "a")["ssm"].values)

`

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the pytest case test_transport_balance_loading_order_mixup with the flow_transport_simulation fixture. Read the open_transport_budget calls and compare the selected "a" balance for ordered and unordered species lists; the issue is done when the ssm values match in both cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.