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
109 stars 56 forks source link

Refactor `XYZ` base class methods dependent on derived classes #1162

Open mferrera opened 5 months ago

mferrera commented 5 months ago

Some methods in XYZ have a dependency on instances of classes derived from it. For example,

https://github.com/equinor/xtgeo/blob/6addf60ff8b63e757bccc9082888f5a5c346bd21/src/xtgeo/xyz/_xyz_oper.py#L120

This function is "part of" the XYZ class but expects poly to be a Polygons instance, which is a class derived from XYZ.

Not clear if just making these abstract methods in XYZ is the best choice, there might be a better one.

There might be other cases of this in which _xyz_something.py modules are imported into subclass modules.