How do I create a STL file from a 2 dimensional grid of data
Photo Credit: Courtesy of 3DStockPhoto ( image)

for that you can use openSCAD. Data can be represented as a multi-array and we can iterate on it via for loop

// data structure is x,y,z where z is value 

for(a=[0:1:6])  translate([arrayOfData[a][0], arrayOfData[a][1],0])  cylinder(arrayOfData[a][2],2,.5,false);

And where you get the model it can be intersected with a cube to get the desired shape.

<a href=enter image description here">