[yt-dev] Issue #1327: Covering Grid is not working (yt_analysis/yt)

Yi-Hao Chen issues-reply at bitbucket.org
Thu Mar 2 11:18:39 PST 2017


New issue 1327: Covering Grid is not working
https://bitbucket.org/yt_analysis/yt/issues/1327/covering-grid-is-not-working

Yi-Hao Chen:

Using the sample data and example script in the documentation, it seems that covering_grid is not working under the "tip" version of the code. 

It works under the "stable" branch.

```
#!python

In [1]: import yt

In [2]: ds = yt.load('Enzo_64/DD0043/data0043')
yt : [INFO     ] 2017-03-02 13:01:44,769 Parameters: current_time              = 645.817072369
yt : [INFO     ] 2017-03-02 13:01:44,769 Parameters: domain_dimensions         = [64 64 64]
yt : [INFO     ] 2017-03-02 13:01:44,770 Parameters: domain_left_edge          = [ 0.  0.  0.]
yt : [INFO     ] 2017-03-02 13:01:44,770 Parameters: domain_right_edge         = [ 1.  1.  1.]
yt : [INFO     ] 2017-03-02 13:01:44,771 Parameters: cosmological_simulation   = 1
yt : [INFO     ] 2017-03-02 13:01:44,771 Parameters: current_redshift          = 0.00139308806408
yt : [INFO     ] 2017-03-02 13:01:44,771 Parameters: omega_lambda              = 0.7
yt : [INFO     ] 2017-03-02 13:01:44,771 Parameters: omega_matter              = 0.3
yt : [INFO     ] 2017-03-02 13:01:44,771 Parameters: hubble_constant           = 0.71

In [3]: all_data_level_0 = ds.covering_grid(level=0, left_edge=[0,0.0,0.0],dims=[64, 64, 64])

In [4]: print(all_data_level_0['density'].shape)
Parsing Hierarchy : 100%|████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 752/752 [00:00<00:00, 5132.73it/s]
yt : [INFO     ] 2017-03-02 13:02:05,512 Gathering a field list (this may take a moment.)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-4-4b159ea40f36> in <module>()
----> 1 print(all_data_level_0['density'].shape)

/home/ychen/src/yt_yihaochen/yt/data_objects/data_containers.pyc in __getitem__(self, key)
    279                 return self.field_data[f]
    280             else:
--> 281                 self.get_data(f)
    282         # fi.units is the unit expression string. We depend on the registry
    283         # hanging off the dataset to define this unit object.

/home/ychen/src/yt_yihaochen/yt/data_objects/construction_data_containers.pyc in get_data(self, fields)
    629                 raise
    630         if len(part) > 0: self._fill_particles(part)
--> 631         if len(fill) > 0: self._fill_fields(fill)
    632         for a, f in sorted(alias.items()):
    633             self[a] = f(self)

/home/ychen/src/yt_yihaochen/yt/data_objects/construction_data_containers.pyc in _fill_fields(self, fields)
    677             fill_region(input_fields, output_fields, self.level,
    678                         self.global_startindex, chunk.icoords, chunk.ires,
--> 679                         domain_dims, refine_by)
    680         for name, v in zip(fields, output_fields):
    681             fi = self.ds._get_field_info(*name)

/home/ychen/src/yt_yihaochen/yt/utilities/lib/misc_utilities.pyx in yt.utilities.lib.misc_utilities.fill_region (yt/utilities/lib/misc_utilities.c:16208)()
    796                     if i < 0 or i >= ofield.shape[0]: continue
    797                     for oj in range(3):
--> 798                         j = nj + (oj - 1)
    799                         if j < 0 or j >= ofield.shape[1]: continue
    800                         for ok in range(3):

TypeError: only length-1 arrays can be converted to Python scalars
```




More information about the yt-dev mailing list