Skip to content
Snippets Groups Projects
Unverified Commit 395155f0 authored by David Hoese's avatar David Hoese
Browse files

Add checks for empty frame to quicklooks

parent 25fe631d
No related branches found
No related tags found
No related merge requests found
......@@ -217,19 +217,19 @@ class PlotMaker(object):
:param shared_x:
:return:
"""
specific_frame = frame[[x for x in frame.columns if x in self.deps]]
if frame.empty or specific_frame.empty or specific_frame.isnull().all().any():
raise ValueError("No valid data found or missing necessary data to make {}".format(self.name))
if start_time is None:
start_time = frame.index[0].to_pydatetime()
if end_time is None:
end_time = frame.index[-1].to_pydatetime()
# TODO: If frame is empty, make an empty plot
ax = self._get_axes(fig, is_subplot, shared_x)
self._set_title(frame, fig, ax,
start_time=start_time, end_time=end_time,
title=title, is_subplot=is_subplot)
# get the min for each column then combine them assuming we can
specific_frame = frame[[x for x in frame.columns if x in self.deps]]
# make ticks show up on top and bottom inside and out of the axis line
ax.xaxis.set_tick_params(left=True, right=True, direction='inout')
lines = self._call_plot(specific_frame, ax)
......@@ -427,7 +427,11 @@ def create_plot(plot_names, frame, output,
plot_frame = plot_frame[~plot_frame.isnull().any(axis=1)]
fig = plt.figure()
ax = plot_maker.create_plot(plot_frame, fig, start_time=start_time, end_time=end_time)
try:
ax = plot_maker.create_plot(plot_frame, fig, start_time=start_time, end_time=end_time)
except ValueError:
LOG.error("Could not make '{}'".format(name), exc_info=True)
continue
out_fn = output.format(plot_name=name, start_time=start_time, end_time=end_time)
LOG.info("Saving plot '{}' to filename '{}'".format(name, out_fn))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment