A set of functions for working with voxels.
Count
Count(inputVoxel) -> Number
Function bundle: Core
Returns the number of entries in a voxel.
Parameter
- inputVoxel: Voxel - The input voxel.
Return value: Number
Example
Count($voxel);
// returns 3DefaultValue
DefaultValue(inputVoxel, fieldName, defaultValue) -> Any
Function bundle: Core
Returns a specified default value if a field name in a voxel does not exist or the value of the specified field is null or an empty text value.
Parameters
- inputVoxel: Voxel - The input voxel to check.
- fieldName: Text - The field name to check.
- defaultValue: Any - This value is returned if the field name does not exist or the value of the specified field is
nullor an empty text value.
Return value: Any
Returns the value for the specified field if defined. Otherwise, returns the value specified in default.
Example
Return "n/a" if voxel attribute does not exist or is empty
DefaultValue($voxel, "sea_temp", "n/a")
// Returns the sea_temp value if available
// or n/a if not availableGetKeys
GetKeys(inputVoxel) -> Array<Text>
Function bundle: Core
Returns an array of all keys in the voxel, sorted alphabetically.
Parameter
- inputVoxel: Voxel - The voxel to get keys from.
Example
Returns an array of keys from the voxel, in alphabetical order.
GetKeys($voxel)
// returns ["Voxel.CurrentVariable", "Voxel.Depth", "Voxel.Position"]GetValues
GetValues(inputVoxel) -> Array<Any>
Function bundle: Core
Returns an array of all values in the voxel, ordered to match the alphabetical sorting of their keys.
Parameter
- inputVoxel: Voxel - The voxel to get values from.
Example
Gets values from the voxel
GetValues($voxel)
// returns ["Most likely lithological class", 0.75, [166,63,102]]HasKey
HasKey(inputVoxel, key) -> Boolean
Function bundle: Core
Indicates whether a voxel has the input key.
Parameters
Return value: Boolean
Example
Returns true if the voxel has a field named sea
HasKey($voxel, 'sea_temp');HasValue
HasValue(inputVoxel, fieldName) -> Boolean
Function bundle: Core
Indicates whether a voxel has a given field and if that field has a value.
Parameters
Return value: Boolean
Additional resources
Example
Return false if voxel attribute does not exist or is empty
iif(HasValue($voxel, "sea_temp"), ($voxel.sea_temp - 32) * 5/9, false)
// Returns the temp in celsius if sea_temp is available