How to grid a .gdb channel in python.

JustinAnning Posts: 4 Calcite Rank Badge
edited March 2023 in Oasis montaj
I can write a python script to create a geosoft grid using the surfer API however can some generous person point to or give an example how to grid from a python script using the geosoft gxapi or gxpy? I don't understand why this basic step is not in the tutorial.


  • DumitruIon
    DumitruIon Posts: 6 Calcite Rank Badge
    Hello Justin,

    I am not familiar with Python, but probably you may find a way to further translate a Geosoft script (gs file).
    My suggestion is to play with Script->Record Script (for example, recording on a simple case, and then inspect the output gs file with a simple text editor. That would outline the logic of the process, what parameters you may want to set, like which database, channel, cellsize, output grid filename and type, gridding parameters, etc.

    Then you can edit this gs according to your specific preferences needs. Of course you can create such script programmatically (maybe with an Excel VBA macro or Python, and why not with Surfer scripting).

    The example below was created to exemplify the output I get from recording a script of "Grid and Image"->"Gridding-> "Direct Gridding..."

    Best regards,
    Dumitru content:

    / LOG OPENED : Tue May 18 06:42:35 2021
    CURRENT        CURRENT        Database,"d:\test_gridding\mag_data.gdb"
    SETINI         DIRECT_GRIDDING.GRID="D:\\test\\test_dirgrd.grd(GRD)"
    GX             geogxnet.dll(Geosoft.GX.GridUtils.DirectGridding;Run)
    / LOG CLOSED : Tue May 18 06:43:48 2021

  • JustinAnning
    Thanks, Ill get familiar with the geosoft scripting and see where it leads.