Open coline-mathias opened 2 months ago
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.
https://github.com/DHI/mikeio/blob/08f52ac9fb6f2c91599f56a5f62a277b296c7dde/mikeio/spatial/_FM_geometry.py#L688 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.
Attaching a smaller file of the AOI to make it easer to reproduce. subset.zip
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 :
System information:
Thank you very much,
Coline