Authoring a Lambda
Spatial lambdas are typically composed of three main components:
1. Input Definition
Specify the dataset(s) and region of interest (bounding box or selection) to process.
2. Compute Function
Write code that iterates through voxels and applies your logic. For example, summing the ore_grade property forvoxels above a grade threshold.
3. Output
Return a summary value (e.g., total_volume) or create a new dataset (e.g., filtered voxels). Lambdas can alsoattach files or emit logs during execution.
Sample Python Lambda
Here's a basic example that sums the volume of high-grade voxels:
def lambda_handler (context, voxel_reader, voxel_writer):
total_volume = 0.0
for voxel in voxel_reader:
if voxel.properties.get('grade',0.0) >= 0.5:
total_volume += voxel.size
return {'total_volume': total_volume}