gxpy
gxpy copied to clipboard
gxgrd.Grid.minimum_curvature deletes input unexpectedly
In the example below, input.gdb will be deleted unexpectedly
from geosoft import gxpy
path = r"input.gdb"
channel = 'MAG_RES'
with gxpy.gx.GXpy() as context:
with geosoft.gxpy.gdb.Geosoft_gdb.open(str(path)) as gdb:
geosoft.gxpy.grid.Grid.minimum_curvature((gdb, channel), cs=1)
This seems to be caused by lines 664:680 of grid.py setting the gdb.close(discard = True) when the input data is a tuple.
# create a database from the data
xc, yc = ('x', 'y')
discard = False
if callable(data):
gdb = gdb_from_callback(data)
vc = 'v'
discard = False
elif isinstance(data, tuple):
gdb = data[0]
vc = data[1]
if len(data) == 4:
xc = data[2]
yc = data[3]
else:
xc, yc, _ = gdb.xyz_channels
discard = False
GXDEV-38
fixed in 2024.1