gxapi syntax: GXVV.add, subtract, multiply, divide

DavidHoward
DavidHoward Posts: 10 Calcite Rank Badge
edited February 2023 in GeoStudio
What is usage syntax for these methods?
Documentation for add shows (others are similar):
add(vv_y, vv_z): Add two VVs: VV_A + VV_B = VV_C
Parameters:
vv_y (GXVV) – GXVV B
vv_z (GXVV) – GXVV C (returned), C = A + B
So where does A go?

Best Answer

Answers

  • Many thanks, Jacques. This is what I have working for all methods but how do I create an empty vv rather than by my workaround? It looks as though the method does not automatically create vv_C, which has to be defined first.

    David
    #read two channels as a vv, ... myVv_A = gdb.read_channel_vv(line, aChannel) myVv_B = gdb.read_channel_vv(line, bChannel) #instantiate C. How does one create an empty vv???? myVv_C = myVv_A # workaround to force creation of C. myVv_A.gxvv.add (myVv_B.gxvv, myVv_C.gxvv) gdb.write_channel_vv(line, 'sum', myVv_C)
  • Hi @DavidHoward ,

    By constructing an empty VV of the same type as A and B. E.g.:
    
    import geosoft.gxpy.vv as gxvv
    ...
    myVv_C= gxvv.GXvv(dtype=myVv_A.dtype)
    
    Cheers,
    Jacques
  • JacquesBeaurain
    JacquesBeaurain Posts: 29 Calcite Rank Badge
    edited December 2017
    I should have added that your workaround to "force" the creation of C would in fact not be doing that. It would just create a local reference variable that also pointed at A. Then the line:

    myVv_A.gxvv.add (myVv_B.gxvv, myVv_C.gxvv)

    Would have the same effect as calling:

    myVv_A.gxvv.add (myVv_B.gxvv, myVv_A.gxvv)

    Jacques
  • Thanks again, Jacques.
This discussion has been closed.