Hi Devan,

The pf hierarchy contains data on the number of cells at each level. One way to get the total number of cells in the simulation is below. It is quite possible that there is a more elegant way to do this, but this worked for me:

from yt.mods import *
from yt.utilities.definitions import MAXLEVEL

def cellCounter(filePath):
   pf = load(filePath)
   hir = pf.h

   sumCells = 0

   for i in range(MAXLEVEL):
      sumCells = sumCells + hir.level_stats['numcells'][i]

   return sumCells


On Fri, Jul 27, 2012 at 12:29 PM, Devan Conroy <devan.conroy@student.fairfield.edu> wrote:
Hi all,

My name is Devan Conroy and I am working at SLAC as a summer intern in the SULI program with Jeff Oishi.  I am trying to figure out how to count the number of cells in the grid when loading in data.  I tried using (len(DataIn)), but got the error: object of type 'AMRRegion' has no len(). 

Any suggestions?

Thank you,
Devan Conroy

Devan Conroy
Fairfield University 2013
Mathematics Major
Computer Science/French Minor

yt-users mailing list