Deltares / Deltares/imod-python
all-zeros result from imod.evaluate.streamfunction_line
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 41
- Forks
- 12
- Avg merge
- 21h 8m
- Merged PRs (30d)
- 1
Description
In GitLab by @claumedimont on Jun 1, 2023, 18:13
The imod.evaluate.streamfunction_line takes two xarray.DataArrays as parameters: fff and frf. From a cross-section model, I only obtained the frf and flf arrays with dimensions (time: 278, layer: 39, y: 1, x: 258). I needed to create the fff array, which at first I did with fff = xr.zeros_like(flf).
The issue came when I tried to obtain the streamfunction using the obtained frf and the created fff. In the code that calculates the streamfunction, the flux on the edges is interpolated to the cell center (lines 66-67 in https://gitlab.com/deltares/imod/imod-python/-/blob/master/imod/evaluate/streamfunction.py). As the created fff only has 1 cell in the y-direction, this shift introduces nan along the entire cross section, resulting in all-zeros in the result.
The solution was to convert the fff into an array with 2 cells in the y-direction.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in imod/evaluate/streamfunction.py at the interpolation noted around lines 66-67, and reproduce the case with fff having one y cell and frf shaped (time, layer, y, x). Check how the shifted edge flux produces NaN values and an all-zero result. Done means the reported cross-section input no longer silently returns all zeros, with a regression test for the one-cell y dimension.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100