Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG #1770: Display meshfill template elements through renderTemplate. #2049

Merged
merged 1 commit into from
Jul 26, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Packages/vcs/vcs/VTKPlots.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,10 +810,10 @@ def plotContinents(self, wc, projection, wrap, vp, priority, **kargs):
priority=priority,
create_renderer=True)

def renderTemplate(self, tmpl, data, gm, taxis, zaxis, **kargs):
def renderTemplate(self, tmpl, data, gm, taxis, zaxis, X=None, Y=None, **kargs):
# ok first basic template stuff, let's store the displays
# because we need to return actors for min/max/mean
displays = tmpl.plot(self.canvas, data, gm, bg=self.bg, **kargs)
displays = tmpl.plot(self.canvas, data, gm, bg=self.bg, X=X, Y=Y, **kargs)
returned = {}
for d in displays:
if d is None:
Expand Down
21 changes: 13 additions & 8 deletions Packages/vcs/vcs/vcsvtk/meshfillpipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,21 +207,26 @@ def _plotInternal(self):
create_renderer=True)
actors.append([act, plotting_dataset_bounds])

t = self._originalData1.getTime()
if self._originalData1.ndim > 2:
z = self._originalData1.getAxis(-3)
else:
z = None
self._resultDict["vtk_backend_actors"] = actors
kwargs = {"vtk_backend_grid": self._vtkDataSet,
"dataset_bounds": self._vtkDataSetBounds,
"plotting_dataset_bounds": plotting_dataset_bounds,
"vtk_backend_geo": self._vtkGeoTransform}
if ("ratio_autot_viewport" in self._resultDict):
kwargs["ratio_autot_viewport"] = vp
self._template.plot(self._context().canvas, self._data1, self._gm,
bg=self._context().bg,
X=numpy.arange(min(x1, x2),
max(x1, x2) * 1.1,
abs(x2 - x1) / 10.),
Y=numpy.arange(min(y1, y2),
max(y1, y2) * 1.1,
abs(y2 - y1) / 10.), **kwargs)
self._resultDict.update(self._context().renderTemplate(self._template, self._data1, self._gm,
t, z,
X=numpy.arange(min(x1, x2),
max(x1, x2) * 1.1,
abs(x2 - x1) / 10.),
Y=numpy.arange(min(y1, y2),
max(y1, y2) * 1.1,
abs(y2 - y1) / 10.), **kwargs))

legend = getattr(self._gm, "legend", None)

Expand Down
2 changes: 1 addition & 1 deletion testing/vcs/test_vcs_meshfill_no_wrapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
h = f("heat")
x = regression.init()
x.plot(h, bg=1)
regression.run(x, "vcs_test_meshfill_no_wrapping.png")
regression.run(x, "test_vcs_meshfill_no_wrapping.png")
2 changes: 1 addition & 1 deletion testing/vcs/test_vcs_meshfill_regular_grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
f = cdms2.open(os.path.join(vcs.sample_data, "clt.nc"))
s = f("clt")
x.meshfill(s, bg=1)
regression.run(x, "test_meshfill_regular_grid.png")
regression.run(x, "test_vcs_meshfill_regular_grid.png")