create_surf_distance_log acting funny
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 122
- Forks
- 67
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 19
Description
create_surf_distance_log gives different results than get_surface_picks and points.snap_surface.
Possible error: Wrong alignment of active values in the surface and the distance calculations:
If points.snap_surface is run with activeonly=True then 5485 values are reported. That is where create_surf_distance_log 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')
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

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the discrepancy with the supplied script, starting with Well.create_surf_distance_log and comparing its active-value handling with get_surface_picks and Points.snap_surface(activeonly=True). Use the reported 5485-value result and the generated CSV files to trace the alignment; done means the distance log and the two comparison approaches produce consistent results.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100