gxpy -gxdb.create_line_name

TimNixon
TimNixon Posts: 7 Calcite Rank Badge
edited February 2023 in GeoStudio
Hi All

I have been using a script that imports LiDAR data to a gdb. It has stopped working recently due to a line that creates the line name to write, as follows:

with gxdb.Geosoft_gdb.open(saveFileName) as gdb:
line_name = gxdb.create_line_name(lineName, gxdb.LINE_TYPE_RANDOM, 0)
gdb.write_line(line_name, xyz, channel_names)


lineName is generated from the LiDAR .asc file name as a string (with extension removed).

The problem is that line_name ends up being an empty string and the write_line fails.

No matter what i put in the args for gxdb.create_line, the line_name is always blank.

Any clue why??

Many thanks.

Best Answer

Answers

  • @TimNixon I have tried everything I can to get a blank return, but I always get something back. Perhaps put some prints to give me an idea of the what the lineName looks like?
    print(lineName) line_name = gxdb.create_line_name(lineName, gxdb.LINE_TYPE_RANDOM, 0) print(line_name)
    Geosoft logo
  • Hi Ian, thanks for looking at this.

    print(lineName) returns '1_1' (I am trying short file names to test)

    print(line_name) returns '' (ie. empty string, visible in Spyder's variable explorer).
  • Tim, sorry works here with 9.5 as "D1_1" is returned. I suspect something else is messed up with your installation, or we are both missing something obvious here.

    I suggest you change the line to: line_name = 'D' + lineName

    This will move you past this failure and on to the next and maybe that will give us another clue.

    Are you using 9.4 or 9.5?
    Geosoft logo
  • Ian, still getting an error.

    GdbException: Invalid line name 'D1'. Use create_line_name() to create a valid name.

    I will try to update gxpy and see if that makes a difference.
This discussion has been closed.