equinor / xtgeo

XTGeo Python class library for subsurface Surfaces, Cubes, Wells, Grids, Points, etc
https://xtgeo.readthedocs.io/en/latest/
GNU Lesser General Public License v3.0
110 stars 58 forks source link

Let `RegularSurface.compare_topology()` allow a precision level #1257

Open jcrivenaes opened 1 month ago

jcrivenaes commented 1 month ago

With regards to: https://github.com/equinor/xtgeo/blob/f208649c02cbc21545d99d5ac35d15da5680d161/src/xtgeo/surface/regular_surface.py#L1422

The comparison of e.g. xori, yori requires now an exact match. However, there may be numerical differences, or it may be that the user requires a more lose match for some reasons.

The proposal is to add an absolute tolerance, like

def compare_topology(self, other, strict=True, abs=0.1)

In this case, abs=0.01 will mean that an xori value of 450000 will allow a range 449999.09 to 450000.1

Possibly also consider a relative tolerance.