_create_surf_distancelog gives different results than _get_surfacepicks and _points.snapsurface.
Possible error: Wrong alignment of active values in the surface and the distance calculations:
If _points.snapsurface is run with activeonly=True then 5485 values are reported. That is where _create_surf_distancelog stops when calculating the difference.
The code:
import roxar
import xtgeo
TRAJNAME = "Imported trajectory"
LOGRUNNAME = "planned"
CAT = "DepthSurface"
print(xtgeo.__version__)
well_name = 'FB2I-1V3'
surf_name = 'Heimdal_top'
surf = xtgeo.surface_from_roxar(project, surf_name,CAT)
#The preferred way (for me) to calculate a distance from a well to a surface
well1 = xtgeo.well_from_roxar(project, well_name, trajectory=TRAJNAME, logrun=LOGRUNNAME, lognames=['MD log'])
well1.create_surf_distance_log(surf,'diff')
well1.dataframe.to_csv('well1.csv')
#Where does it cross according to get_surface_picks?
picks1 = well1.get_surface_picks(surf)
print(picks1.dataframe)
#A workaround using xtgeo.points. Gives same results as get_surface_picks()
well2 = xtgeo.well_from_roxar(project, well_name, trajectory=TRAJNAME, logrun=LOGRUNNAME, lognames=['MD log'])
points = xtgeo.Points() #Empty point set
points.dataframe = well2.dataframe.copy()
zorig = points.dataframe['Z_TVDSS'].copy() #The original TVDSS.
points.snap_surface(surf, activeonly=False) #Now the surface TVDSS is put into the Z_TVDSS-column
#Using activeonly=True gives just 5485 values but then the next line will give wrong results.
#Is this what happens in _create_surf_distance_log_ ?
points.dataframe['diff'] = points.dataframe['Z_TVDSS'] -zorig #Calculate the difference
points.dataframe.to_csv('well2.csv')
_create_surf_distancelog gives different results than _get_surfacepicks and _points.snapsurface.
Possible error: Wrong alignment of active values in the surface and the distance calculations: If _points.snapsurface is run with activeonly=True then 5485 values are reported. That is where _create_surf_distancelog stops when calculating the difference.
The code:
The printout: 2.15.2 X_UTME Y_UTMN Z_TVDSS DIRECTION WELLNAME 0 475590.725685 6.565440e+06 1726.864474 1 FB2I-1V3 1 475482.763505 6.565435e+06 1733.803068 -1 FB2I-1V3 2 475201.817559 6.565473e+06 1741.790771 1 FB2I-1V3 3 474380.514290 6.565967e+06 1740.946156 -1 FB2I-1V3
The difference in the resulting files