# Voxel Math

Posts: 21
Hi, I am trying to write some python code to do the following.

1) Open a geosurface file
2) Iterate through the surfaces in the file
a) extract the extents of the surface
b) create a voxel covering the extents, all value = zeros
c) use voxel math to change all cells inside the surface to 1 and outside to DUMMY
d) save the voxel for future use

I have been able to implement all of the steps except 2)c). The GXVOX math method is a bit opaque and is quite different from the GDB and GRID math.

From gxapi.GXVO
>>>>
classmethod math(master, mastervar, output, outvar, formula, lst)¶
Produces a new voxes using a formula on existing voxels/Grids

Parameters:
master (str) – Master GXVOX Name
mastervar (str) – Master GXVOX Variable Name
output (str) – Output GXVOX Name
outvar (str) – Output GXVOX Variable Name
formula (str) – Formula
lst (GXLST) – List of Voxels/Grids to use as inputs
Returns:
VOXEL handle

Return type:
GXVOX
>>>>

Are the mastervar and outvar strings the variable names that will be in the formula (ie V0 and V1)?
Is the formula string the formula that would be written into the Voxel Math window (ie V1 = V0 + 2)?
In the GXLST we have a list of pairs, name and value. Is the name the variable name (ie G1 (for grid), V1 (for voxel), S1 (for surface)) and the value is the file name? For a surface we need to specify the Geosurface filename and the Surface name. In the Voxel Math window this shows up as a decorator. Should our surface name string in the list have the format ".geosoft_surface(SURFACE=)"
Does the list need to include the mastervar and outvar items. Can the mastervar and outvar point to the same voxel (ie we will overwrite the voxel during the process)?

Thanks
Sean
Tagged: