Re: [yt-dev] About Covering Problem while plotting 3D surface and sketchfab pictures
Hi Matt, I ran the script accordingly and the results came out: Not smoothed 143496 0 Smoothed 143496 0 and "143496" is exact the total number of my grids. Is there any clue to this problem? Many thanks, Jia -Hung -------------Previous Email----------------- Hi Jia-Hung, Sorry for the delay! The key error you're seeing is because yt was unable to fill in all of the cells needed for the smoothed covering grid. Can you try this, and see what happens? ngood = 0 nbad = 0 for g in pf.h.grids: try: g.retrieve_ghost_zones(1, ["Ones"], smoothed=False) except KeyError: nbad += 1 cnotinue ngood += 1 print "Not smoothed", ngood, nbad ngood = 0 nbad = 0 for g in pf.h.grids: try: g.retrieve_ghost_zones(1, ["Ones"], smoothed=True) except KeyError: nbad += 1 cnotinue ngood += 1 print "Smoothed", ngood, nbad and let us know the results? On Fri, Jun 6, 2014 at 10:52 AM, ??? <r00222055@ntu.edu.tw> wrote:
Dear all,
I want to say thank you to all of you for making how powerful and convenient yt is. I really appreciate everything you have done. I?m now using yt 2.6 version and trying to construct our AMR code named ?GAMER? frontend to yt.
So far I have several preliminary results that I could plot picture with projection /slice/ contour /radial profile successfully, and the outcome pictures all seem fine. However when I tried to plot ?3D Surface and Sketchfab?, I failed.
It popped out some error messages. There exist some covering problems in my data structure. Actually this question also happened when I tried to plot ?VorticityMagnitude?. I couldn?t figure it out, and every data value and positions seem fine when I plot pictures in projection and slice.
Therefore, I believe there is some fundamental problem that I am too careless to pay attention to. Could anyone help me with this problem? Thank you in advance.
Jia-Hung Wu
The following is the error message.
======================== Error Message ===========================================
?
In [75]: surface["Density"]
yt : [ERROR ] 2014-06-06 22:49:12,262 Covering problem: 163 cells are uncovered
---------------------------------------------------------------------- -----
KeyError Traceback (most recent call last)
<ipython-input-75-c8eab0fb4ee7> in <module>()
----> 1 surface["Density"]
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in __getitem__(self, key)
316 if key not in self.fields:
317 self.fields.append(key)
--> 318 self.get_data(key)
319 return self.field_data[key]
320
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in get_data(self, fields, sample_type)
4233 my_verts = self._extract_isocontours_from_grid(
4234 g, self.surface_field, self.field_value,
-> 4235 fields, sample_type)
4236 if fields is not None:
4237 my_verts, svals = my_verts
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in save_state(self, grid, field, *args, **kwargs)
79 old_keys = grid.field_data.keys()
80 grid.field_parameters = self.field_parameters
---> 81 tr = func(self, grid, field, *args, **kwargs)
82 grid.field_parameters = old_params
83 grid.field_data = YTFieldData( [(k, grid.field_data[k]) for k in old_keys] )
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in _extract_isocontours_from_grid(self, grid, field, value, sample_values, sample_type)
4257 sample_type = "face"):
4258 mask = self.data_source._get_cut_mask(grid) * grid.child_mask
-> 4259 vals = grid.get_vertex_centered_data(field, no_ghost = False)
4260 if sample_values is not None:
4261 svals = grid.get_vertex_centered_data(sample_values)
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/grid_pat ch.pyc in get_vertex_centered_data(self, field, smoothed, no_ghost)
498 np.power(10.0, new_field, new_field)
499 else:
--> 500 cg = self.retrieve_ghost_zones(1, field, smoothed=smoothed)
501 np.add(new_field, cg[field][1: ,1: ,1: ], new_field)
502 np.add(new_field, cg[field][:-1,1: ,1: ], new_field)
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/grid_pat ch.pyc in retrieve_ghost_zones(self, n_zones, fields, all_levels, smoothed)
465 if smoothed:
466 cube = self.hierarchy.smoothed_covering_grid(
--> 467 level, new_left_edge, **kwargs)
468 else:
469 cube = self.hierarchy.covering_grid(level, new_left_edge, **kwargs)
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in __init__(self, *args, **kwargs)
3869 (self.pf.domain_right_edge - self.pf.domain_left_edge) /
3870 self.pf.domain_dimensions.astype("float64"))
-> 3871 AMRCoveringGridBase.__init__(self, *args, **kwargs)
3872 self._final_start_index = self.global_startindex
3873
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in __init__(self, level, left_edge, dims, fields, pf, num_ghost_zones, use_pbar, **kwargs)
3713 self.domain_width = np.rint((self.pf.domain_right_edge -
3714 self.pf.domain_left_edge)/self.dds).astype('int64')
-> 3715 self._refresh_data()
3716
3717 def _get_list_of_grids(self, buffer = 0.0):
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in _refresh_data(self)
3730
3731 def _refresh_data(self):
-> 3732 AMR3DData._refresh_data(self)
3733 self['dx'] = self.dds[0] * np.ones(self.ActiveDimensions, dtype='float64')
3734 self['dy'] = self.dds[1] * np.ones(self.ActiveDimensions, dtype='float64')
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in _refresh_data(self)
304 """
305 self.clear_data()
--> 306 self.get_data()
307
308 def keys(self):
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in get_data(self, field)
3893 try:
3894 #print "Generating", field
-> 3895 self._generate_field(field)
3896 continue
3897 except NeedsOriginalGrid, ngt_exception:
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in _generate_field(self, field)
3780 # First we check the validator; this might even raise!
3781 self.pf.field_info[field].check_available(self)
-> 3782 self[field] = self.pf.field_info[field](self)
3783 else: # Can't find the field, try as it might
3784 raise KeyError(field)
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/field_in fo_container.pyc in __call__(self, data)
383 ii = self.check_available(data)
384 original_fields = data.keys() # Copy
--> 385 dd = self._function(self, data)
386 dd *= self._convert_function(data)
387 for field_name in data.keys():
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/field_in fo_container.pyc in _TranslationFunc(field, data)
139 def TranslationFunc(field_name):
140 def _TranslationFunc(field, data):
--> 141 return data[field_name]
142 return _TranslationFunc
143
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in __getitem__(self, key)
316 if key not in self.fields:
317 self.fields.append(key)
--> 318 self.get_data(key)
319 return self.field_data[key]
320
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in get_data(self, field)
3935 n_bad = (self[field]==-999).sum()
3936 mylog.error("Covering problem: %s cells are uncovered", n_bad)
-> 3937 raise KeyError(n_bad)
3938 if self._use_pbar: pbar.finish()
3939
KeyError: 163
====================================================================== ===================
_______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
------------------------------ Subject: Digest Footer _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org ------------------------------ End of yt-dev Digest, Vol 66, Issue 6 *************************************
Hi Jia-Hung, This is a bit odd -- this is reporting everything is successful, but I think it's doing the same operation as it was in the other situation. For the particular grid throwing the error, what is the left/right edge, and is it sitting on a domain boundary? On Mon, Jun 9, 2014 at 11:04 PM, 吳佳鴻 <r00222055@ntu.edu.tw> wrote:
Hi Matt,
I ran the script accordingly and the results came out:
Not smoothed 143496 0 Smoothed 143496 0
and "143496" is exact the total number of my grids. Is there any clue to this problem?
Many thanks, Jia -Hung -------------Previous Email----------------- Hi Jia-Hung,
Sorry for the delay!
The key error you're seeing is because yt was unable to fill in all of the cells needed for the smoothed covering grid. Can you try this, and see what happens?
ngood = 0 nbad = 0 for g in pf.h.grids: try: g.retrieve_ghost_zones(1, ["Ones"], smoothed=False) except KeyError: nbad += 1 cnotinue ngood += 1 print "Not smoothed", ngood, nbad ngood = 0 nbad = 0 for g in pf.h.grids: try: g.retrieve_ghost_zones(1, ["Ones"], smoothed=True) except KeyError: nbad += 1 cnotinue ngood += 1 print "Smoothed", ngood, nbad
and let us know the results?
On Fri, Jun 6, 2014 at 10:52 AM, ??? <r00222055@ntu.edu.tw> wrote:
Dear all,
I want to say thank you to all of you for making how powerful and convenient yt is. I really appreciate everything you have done. I?m now using yt 2.6 version and trying to construct our AMR code named ?GAMER? frontend to yt.
So far I have several preliminary results that I could plot picture with projection /slice/ contour /radial profile successfully, and the outcome pictures all seem fine. However when I tried to plot ?3D Surface and Sketchfab?, I failed.
It popped out some error messages. There exist some covering problems in my data structure. Actually this question also happened when I tried to plot ?VorticityMagnitude?. I couldn?t figure it out, and every data value and positions seem fine when I plot pictures in projection and slice.
Therefore, I believe there is some fundamental problem that I am too careless to pay attention to. Could anyone help me with this problem? Thank you in advance.
Jia-Hung Wu
The following is the error message.
======================== Error Message ===========================================
?
In [75]: surface["Density"]
yt : [ERROR ] 2014-06-06 22:49:12,262 Covering problem: 163 cells are uncovered
---------------------------------------------------------------------- -----
KeyError Traceback (most recent call last)
<ipython-input-75-c8eab0fb4ee7> in <module>()
----> 1 surface["Density"]
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in __getitem__(self, key)
316 if key not in self.fields:
317 self.fields.append(key)
--> 318 self.get_data(key)
319 return self.field_data[key]
320
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in get_data(self, fields, sample_type)
4233 my_verts = self._extract_isocontours_from_grid(
4234 g, self.surface_field, self.field_value,
-> 4235 fields, sample_type)
4236 if fields is not None:
4237 my_verts, svals = my_verts
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in save_state(self, grid, field, *args, **kwargs)
79 old_keys = grid.field_data.keys()
80 grid.field_parameters = self.field_parameters
---> 81 tr = func(self, grid, field, *args, **kwargs)
82 grid.field_parameters = old_params
83 grid.field_data = YTFieldData( [(k, grid.field_data[k]) for k in old_keys] )
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in _extract_isocontours_from_grid(self, grid, field, value, sample_values, sample_type)
4257 sample_type = "face"):
4258 mask = self.data_source._get_cut_mask(grid) * grid.child_mask
-> 4259 vals = grid.get_vertex_centered_data(field, no_ghost = False)
4260 if sample_values is not None:
4261 svals = grid.get_vertex_centered_data(sample_values)
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/grid_pat ch.pyc in get_vertex_centered_data(self, field, smoothed, no_ghost)
498 np.power(10.0, new_field, new_field)
499 else:
--> 500 cg = self.retrieve_ghost_zones(1, field, smoothed=smoothed)
501 np.add(new_field, cg[field][1: ,1: ,1: ], new_field)
502 np.add(new_field, cg[field][:-1,1: ,1: ], new_field)
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/grid_pat ch.pyc in retrieve_ghost_zones(self, n_zones, fields, all_levels, smoothed)
465 if smoothed:
466 cube = self.hierarchy.smoothed_covering_grid(
--> 467 level, new_left_edge, **kwargs)
468 else:
469 cube = self.hierarchy.covering_grid(level, new_left_edge, **kwargs)
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in __init__(self, *args, **kwargs)
3869 (self.pf.domain_right_edge - self.pf.domain_left_edge) /
3870 self.pf.domain_dimensions.astype("float64"))
-> 3871 AMRCoveringGridBase.__init__(self, *args, **kwargs)
3872 self._final_start_index = self.global_startindex
3873
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in __init__(self, level, left_edge, dims, fields, pf, num_ghost_zones, use_pbar, **kwargs)
3713 self.domain_width = np.rint((self.pf.domain_right_edge -
3714 self.pf.domain_left_edge)/self.dds).astype('int64')
-> 3715 self._refresh_data()
3716
3717 def _get_list_of_grids(self, buffer = 0.0):
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in _refresh_data(self)
3730
3731 def _refresh_data(self):
-> 3732 AMR3DData._refresh_data(self)
3733 self['dx'] = self.dds[0] * np.ones(self.ActiveDimensions, dtype='float64')
3734 self['dy'] = self.dds[1] * np.ones(self.ActiveDimensions, dtype='float64')
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in _refresh_data(self)
304 """
305 self.clear_data()
--> 306 self.get_data()
307
308 def keys(self):
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in get_data(self, field)
3893 try:
3894 #print "Generating", field
-> 3895 self._generate_field(field)
3896 continue
3897 except NeedsOriginalGrid, ngt_exception:
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in _generate_field(self, field)
3780 # First we check the validator; this might even raise!
3781 self.pf.field_info[field].check_available(self)
-> 3782 self[field] = self.pf.field_info[field](self)
3783 else: # Can't find the field, try as it might
3784 raise KeyError(field)
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/field_in fo_container.pyc in __call__(self, data)
383 ii = self.check_available(data)
384 original_fields = data.keys() # Copy
--> 385 dd = self._function(self, data)
386 dd *= self._convert_function(data)
387 for field_name in data.keys():
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/field_in fo_container.pyc in _TranslationFunc(field, data)
139 def TranslationFunc(field_name):
140 def _TranslationFunc(field, data):
--> 141 return data[field_name]
142 return _TranslationFunc
143
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in __getitem__(self, key)
316 if key not in self.fields:
317 self.fields.append(key)
--> 318 self.get_data(key)
319 return self.field_data[key]
320
/work1/ftd/yt_2.6_Version/yt-x86_64/src/yt-hg/yt/data_objects/data_con tainers.pyc in get_data(self, field)
3935 n_bad = (self[field]==-999).sum()
3936 mylog.error("Covering problem: %s cells are uncovered", n_bad)
-> 3937 raise KeyError(n_bad)
3938 if self._use_pbar: pbar.finish()
3939
KeyError: 163
====================================================================== ===================
_______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
------------------------------
Subject: Digest Footer
_______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
------------------------------
End of yt-dev Digest, Vol 66, Issue 6 ************************************* _______________________________________________ yt-dev mailing list yt-dev@lists.spacepope.org http://lists.spacepope.org/listinfo.cgi/yt-dev-spacepope.org
participants (2)
-
Matthew Turk
-
吳佳鴻