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

Point incorrectly considered outside domain #685

Open
coline-mathias opened this issue Apr 10, 2024 · 2 comments
Open

Point incorrectly considered outside domain #685

coline-mathias opened this issue Apr 10, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@coline-mathias
Copy link

coline-mathias commented Apr 10, 2024

Describe the bug
Hello, I just encountered a bug in mikeio-1.7.1 when trying to extract data in specific points. All the points work fine except one of them, for which data.sel() raises OutsideDomainError. I checked on a plot, and this point is in the middle of the domain, not especially close to a boundary or anything.

I tried to uninstall and reinstall mikeio, without any change.

To Reproduce
Below is an example with two points : for the first one the extraction is successful, the second one raises OutsideDomaineError. However, mesh.contains(pt) returns True.

pts = [(439166.047, 6921703.975), (439297.166, 6921728.645)]
output_file= "SW.dfsu"
data = mikeio.read(output_file, items=['Sign. Wave Height', 'Mean Wave Direction', 'Peak Wave Period', 'Surface elevation'])
mesh = mikeio.Mesh(output_file)
for pt in pts :
print(mesh.contains(pt))
data_pt = data.sel(x=pt[0], y=pt[1])

Link to SW data file : https://creocean.fromsmash.com/vZre2O85U0-ct

Expected behavior
I would have expected both points to be corrrectly extracted from data file.

Screenshots
Position of the two points tested above :
image

System information:

  • Python version : '3.11.5 | packaged by Anaconda, Inc. | (main, Sep 11 2023, 13:26:23) [MSC v.1916 64 bit (AMD64)]'
  • MIKE IO version: 1.7.1

Thank you very much,

Coline

@ecomodeller
Copy link
Member

ecomodeller commented Apr 10, 2024

Our current strategy to find the correct element (trying to be as fast as possible) is not correct in areas with such a mixed element sizes.

The failing point is not inside the any of the 10 closest elements and then wrongly categorized as outside the domain.
image

n=min(self.n_elements, 10), # TODO is 10 enough?

You can tell from the comment, that I was a bit unsure on how to handle this, but this example indicates that 10 is not enough😳

Thanks @coline-mathias for reporting.

@ecomodeller ecomodeller added the bug Something isn't working label Apr 10, 2024
@ecomodeller
Copy link
Member

Attaching a smaller file of the AOI to make it easer to reproduce.
subset.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants