Welcome to Golden Software Support

How can I extract values Z with XY coordinates?

Comments

5 comments

  • Official comment
    Avatar
    Drew Dudley

    Hello Wim,

    Thank you for posting your question on the Surfer Scripter forum. It is not currently possible to access the Point Sample command from Scripter. I have added a vote upon your behalf to our suggestion file for future versions of  Surfer to have this type of functionality. 

    Thanks!

    Drew

    Comment actions Permalink
  • Avatar
    Drew Dudley

    Hi Carlos,

    Thank you for posting your question. You can use GridResiduals2 to extract the 16 XY points from the grid file. For example, the following snippet will work:  

    'Uses Grid Residuals and stores the residuals in Column D

    Set Wks = SurferApp.GridResiduals2(InGrid:=GridFile, DataFile:="c:\temp\book1.xlsx", DataFileOptions:="sheet=sheet2", xCol:=1, yCol:=2, zCol:=3, ResidCol:=4)

    Please see this Surfer help page for more details.

    Thanks!

    Drew

    1
    Comment actions Permalink
  • Avatar
    Wim Criel

    Hi Drew,

    I have been looking how to use the 'point sample' in scripter, but so far I couldn't find how to call this new function.

    Kind regards,

    Wim

    0
    Comment actions Permalink
  • Avatar
    Drew Dudley

    Hi Wim,


    As a follow-up, a colleague brought to my attention that this can be done using the GridResiduals.bas script as a work around, with a few edits. You can find the GridResiduals.bas in Surfer's sample directory at C:\Program Files\Golden Software\Surfer 15\Samples\Scripts

    You will need to add a column of 0's to the worksheet prior to running the script and multiply by -1 to the results of the Grid Residual script. See this Knowledge Base article for more information about adding the column and multiplying by -1: https://support.goldensoftware.com/hc/en-us/articles/226662668-How-can-I-find-the-Z-value-of-a-known-XY-point-in-Surfer-. 

    Thanks!

    Drew

    0
    Comment actions Permalink
  • Avatar
    Wim Criel

    Hi Drew,

    Thank you for your answer.

    We are currently using the grid residuals method, but 'Point sample' looked more elegant to use for an update of our script.

    Kind regards,

    Wim

    0
    Comment actions Permalink

Please sign in to leave a comment.