[yt-svn] commit/yt: MatthewTurk: Adding a note about slices that have nothing inside them. Closes #362.
Bitbucket
commits-noreply at bitbucket.org
Thu Feb 16 08:55:23 PST 2012
1 new commit in yt:
https://bitbucket.org/yt_analysis/yt/changeset/5545661b9e5b/
changeset: 5545661b9e5b
branch: yt
user: MatthewTurk
date: 2012-02-16 17:55:10
summary: Adding a note about slices that have nothing inside them. Closes #362.
affected #: 2 files
diff -r 306640bd4e4a37f9756d8c4a3e5b3ba7e1087bb9 -r 5545661b9e5b1afbb9b693351bd088f825a40478 yt/utilities/exceptions.py
--- a/yt/utilities/exceptions.py
+++ b/yt/utilities/exceptions.py
@@ -48,3 +48,13 @@
def __str__(self):
return "The supplied axes are not orthogonal. %s" % (self.axes)
+
+class YTNoDataInObjectError(YTException):
+ def __init__(self, obj):
+ self.obj_type = getattr(obj, "_type_name", "")
+
+ def __str__(self):
+ s = "The object requested has no data included in it."
+ if self.obj_type == "slice":
+ s += " It may lie on a grid face. Try offsetting slightly."
+ return s
diff -r 306640bd4e4a37f9756d8c4a3e5b3ba7e1087bb9 -r 5545661b9e5b1afbb9b693351bd088f825a40478 yt/visualization/plot_types.py
--- a/yt/visualization/plot_types.py
+++ b/yt/visualization/plot_types.py
@@ -36,6 +36,7 @@
y_dict, \
axis_names
from .color_maps import yt_colormaps, is_colormap
+from yt.utilities.exceptions import YTNoDataInObjectError
class CallbackRegistryHandler(object):
def __init__(self, plot):
@@ -379,6 +380,8 @@
def _redraw_image(self, *args):
buff = self._get_buff()
+ if self[self.axis_names["Z"]].size == 0:
+ raise YTNoDataInObjectError(self.data)
mylog.debug("Received buffer of min %s and max %s (data: %s %s)",
na.nanmin(buff), na.nanmax(buff),
self[self.axis_names["Z"]].min(),
Repository URL: https://bitbucket.org/yt_analysis/yt/
--
This is a commit notification from bitbucket.org. You are receiving
this because you have the service enabled, addressing the recipient of
this email.
More information about the yt-svn
mailing list