gxpy icon indicating copy to clipboard operation
gxpy copied to clipboard

gxgrd.Grid.minimum_curvature deletes input unexpectedly

Open TheZappie opened this issue 3 years ago • 3 comments

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)

TheZappie avatar Nov 21 '22 11:11 TheZappie

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

Tdarnell avatar May 18 '23 09:05 Tdarnell

GXDEV-38

serban-seeq avatar Dec 04 '23 22:12 serban-seeq

fixed in 2024.1

serban-seeq avatar Dec 08 '23 16:12 serban-seeq