2015-01-17 15:47 GMT-05:00 Nathan Goldbaum <>:

On Sat, Jan 17, 2015 at 12:16 PM, Yang Haifeng <> wrote:
Hi Nathan,

Here is the output of ds.print_stats(). I think it hasn't run off the edge yet. The refine ratio is 2 and top grid is 64*3. ad_c["Density"] will not produce any error.

2015-01-17 12:48 GMT-05:00 Nathan Goldbaum <>:

Hi Haifeng,

On Sat, Jan 17, 2015 at 8:55 AM, Yang Haifeng <> wrote:
Dear yt users,

I am trying to make covering_grid from an enzo simulation. The code is very simple: (somewhat sloppy since it's running with ipython. )


What is the output of "ds.print_stats()" for this dataset?  I'm wondering if your covering grid is running off the edge of the simulation domain.
ad_c=ds.covering_grid(level=3, left_edge=0.4375, dims=[64,64,64])

Ah, I see what's wrong now.  This should be left_edge=[0.4375, 0.4375, 0.4375] (or some other 3-tuple).

I've gone ahead and added some basic input handling code for the covering_grid constructor, so future users will get a less confusing error message:


where the ad_c["x"] will give an Index Error on my desktop. However, the same piece of code runs great in a different machine. The version of yt are the same in both machines, which is 3.0.2. Both of them installed yt through anaconda. The error message I got was following. Thanks for your help!

IndexError                                Traceback (most recent call last)
<ipython-input-6-ff78a8bccc54> in <module>()
----> 1 ad_c["x"]

/home/fxyang/software/anaconda/lib/python2.7/site-packages/yt/data_objects/data_containers.pyc in __getitem__(self, key)
    243             if f in self._container_fields:
    244                 self.field_data[f] = \
--> 245                     self.ds.arr(self._generate_container_field(f))
    246                 return self.field_data[f]
    247             else:

/home/fxyang/software/anaconda/lib/python2.7/site-packages/yt/data_objects/construction_data_containers.pyc in _generate_container_field(self, field)
    587             np.multiply(rv,[2], rv)
    588         elif field == ("index", "x"):
--> 589             x = np.mgrid[self.left_edge[0] + 0.5*[0]:
    590                          self.right_edge[0] - 0.5*[0]:
    591                          self.ActiveDimensions[0] * 1j]

/home/fxyang/software/anaconda/lib/python2.7/site-packages/yt/units/yt_array.pyc in __getitem__(self, item)
    982     def __getitem__(self, item):
--> 983         ret = super(YTArray, self).__getitem__(item)
    984         if ret.shape == ():
    985             return YTQuantity(ret, self.units)

IndexError: too many indices for array


yt-users mailing list

yt-users mailing list


yt-users mailing list

yt-users mailing list