[yt-users] Counting the number of cells

Matthew Turk matthewturk at gmail.com
Thu Jul 26 15:41:06 PDT 2012


Hi Jeff and Devan,

Right now until data is loaded, a data object doesn't know its own
size.  (This changes in the geometry refactor.)  However, this should
get you what you want:

reg.quantities["TotalQuantity"]("Ones")

A bit obtuse, but will give you a cell count.

(FWIW, you can get all of the data that comes from stats/print_stats
yourself by looking at level_stats on the hierarchy object.)

-Matt

On Thu, Jul 26, 2012 at 6:32 PM, j s oishi <jsoishi at gmail.com> wrote:
> Hi Britton,
>
> Thanks for the message. Unfortunately, this needs to be within the
> api, in an analysis module, without loading any data. It also needs to
> be done on a particular AMRRegion that gets fed in to the (new)
> module.
>
> thanks,
>
> j
>
> On Thu, Jul 26, 2012 at 3:20 PM, Devan Conroy
> <devan.conroy at 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
>> yt-users at lists.spacepope.org
>> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org
>>
> _______________________________________________
> yt-users mailing list
> yt-users at lists.spacepope.org
> http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org



More information about the yt-users mailing list