Thanks for writing, and welcome to yt. :)
On Fri, Jul 26, 2013 at 6:39 AM, Morgan Presley email@example.com wrote:
I'm trying to access the density for a cell and its six neighbors (in the x,y,z directions), but I can't figure out how I can get the information for the neighboring cells. The problem is that dd[ 'NumberDensity' ] is a one-dimensional array, and I don't know the original 3d shape of the data, so I can't reshape the array into three dimensions. Is there a way to get the indices of a cell's neighbors?
Ah, I think I see. So there are a couple different ways to select data in yt. One of them is the way you've found, which selects regions and then presents those regions as flattened arrays. The reason this is done is because for variable resolution data, there is no well-defined ordering for nested regions that have varying extents and widths for cells.
So for data that you want to analyze in a spatially aware way, we have a couple *different* ways of getting at it. These break down into two types of data-manipulation operations:
1) Defining a field (which is necessarily defined everywhere) that is specified in terms of a difference of adjoining cells. For instance, this would be something like defining a (local) spatial-average or a divergence or a gradient. A variety of these fields exist in yt -- for instance, DivV and gradVelocityX, gradVelocityY, gradVelocityZ (for the components.) If you look in the documentation, this would be found under anything that turns up when searching for ValidateSpatial. 2) Identifying a region of space and requesting a 3D array of *fixed* resolution. These data objects can either provide non-interpolated/non-smoothed data (where if a cell is of coarser resolution it is repeated multiple times) or smoothed data, which would be constructed via cascading interpolation. Examples of this type of thing can be found if you search in the documentation for covering_grid or smoothed_covering_grid. This bootcamp notebook contains an example of a covering grid: https://hub.yt-project.org/nb/vu3lia .
I hope that helps -- let us know if you have any other questions or if there's anything that's unclear.
Thanks for any help! Morgan
yt-users mailing list firstname.lastname@example.org http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org