Find Nearest non-nan Elements in a Dfsu file #388
Replies: 3 comments
-
Hi @Barcelona2019, this is a good idea, the main challenge here is that dfs.find_nearest_elements() rely only on the file header, whereas the method you suggested would rely on data. I wonder if a solution could be to give dfs.find_nearest_elements() an "elements" argument where you specify a subset of elements that the nearest elements should be found within. You could then for each timestep do the following: wet_elements = np.where(~np.isnan(data[0][time_step,:])) Do you think that would work? |
Beta Was this translation helpful? Give feedback.
-
Hi Jesper, Thank you for your work on this thread - I think that would be great! I spent some time and found a clumsy solution with a while loop ----
The above code helps me locate the maximum flood level at (x,y) or its nearest points - but I still think your suggestion would lead to a more elegant solution. |
Beta Was this translation helpful? Give feedback.
-
In order to test this we would need a Dfsu test file where some elements are dry.
|
Beta Was this translation helpful? Give feedback.
-
Is your feature request related to a problem? Please describe.
I am trying to sample modelled flood surfaces at locations where we have surveyed flood marks to compare to, but at some locations (x,y), the .find_nearest_elements gave me nan values - the problem is the surveyed flood marks are almost always on the edge wet/dry boundary.
Describe the solution you'd like
I would like to have a similar function to x.find_nearest_elements, where it finds the nearest non-nan elements, possibly x.find_nearest_nonnan_elements ?
Beta Was this translation helpful? Give feedback.
All reactions