[yt-users] Covering Grid Array Order

Matthew Turk matthewturk at gmail.com
Wed Dec 2 15:27:18 PST 2009


Hi Rick,

> I'm looking at the fixed resolution extraction example, and I'm wondering:
> what ordering (row or column) will the final will have?

The "cube" object in that example can also return the x, y, z fields.
If you add this code in to the example:

for xi in [0, -1]:
    for yi in [0, -1]:
        for zi in [0, -1]:
            print xi, yi, zi,
            print cube['x'][xi,yi,zi],
            print cube['y'][xi,yi,zi],
            print cube['z'][xi,yi,zi]

the results give back:

0 0 0 0.00390625 0.00390625 0.00390625
0 0 -1 0.00390625 0.00390625 0.99609375
0 -1 0 0.00390625 0.99609375 0.00390625
0 -1 -1 0.00390625 0.99609375 0.99609375
-1 0 0 0.99609375 0.00390625 0.00390625
-1 0 -1 0.99609375 0.00390625 0.99609375
-1 -1 0 0.99609375 0.99609375 0.00390625
-1 -1 -1 0.99609375 0.99609375 0.99609375

So the set of array indices [0,0,0] is the lowest value in all three
coordinates and the set of array indices [-1, -1, -1] is the maximum
in all three coordinates.  These correspond to the coordinate system
Enzo uses.  Does that answer your question?

-Matt



More information about the yt-users mailing list