[yt-users] iterating through data in AMRCoveringGrid

Elizabeth Tasker taskere at mcmaster.ca
Fri May 13 09:30:24 PDT 2011


Hi,

I want to write a script in yt that reads in data from a simulation 
output, extracts a 3-dimensional grid from it of a set size at a fixed 
resolution and then iterate through the data points calculating various 
properties.

I think I can do this using covering_grid using the example in the cookbook:

cube = pf.h.covering_grid(4,
                          left_edge=[16.4299, 10.8963, 16.0],
                          right_edge=[18.4299, 12.8963, 16.02],
                          dims=[258,258,4],
                          fields=["PotentialField"])

But I'm now not sure how to get to the data! I'd like to write a loop in 
the form:

k = 0, 3
j=0, 257
i = 0, 257
 something = data(i,j,k)*etc


I feel this should be obvious but I can't figure out the AMRCoveringGrid 
object!

Thanks,

Elizabeth



More information about the yt-users mailing list