I wrote a programmable filter which gives me the following error that I would like to get rid off:
ERROR: In /builds/gitlab-kitware-sciviz-ci/build/superbuild/paraview/src/VTK/Common/ExecutionModel/vtkStreamingDemandDrivenPipeline.cxx, line 878
vtkPVPostFilterExecutive (0x20bdd610): The update extent specified in the information for output port 0 on algorithm vtkPVPostFilter(0x1ff2ba90) is 0 800 0 84 0 256, which is outside the whole extent 0 800 0 88 0 0.
The confusing part is that inputs[0]
has extent 0 800 0 84 0 256
, and so does output
which inherits the grid from inputs[0]
, does it not?
Below is a not so MWE. Can anyone help me out with the missing bit needed to get rid of this error?
I came across this clue, talking about using some UpdateExtent
-function but I can’t quite figure out how to do it. Plus, in my case I am not even modifying any grid.
The filter gets two inputs with different rectilinear grids (different node counts).
Data of the second input (data_av
below) are interpolated onto the grid of the first input and then substracted from those data.
So the data that I finally assign to the output (ufluc
below) has the dimension of the output. Yet, Paraview complains about some “update extent”.
The produced data looks absolutely fine, too.
from paraview.vtk.numpy_interface import dataset_adapter as dsa
from paraview.vtk.numpy_interface import algorithms as algs
import numpy as np
from scipy.interpolate import RegularGridInterpolator
data = inputs[0] # extent 0 800 0 84 0 256
data_av = inputs[1] # extent 0 800 0 88 0 0
# Get extents
extents_av = data_av.GetExtent()
nx_ny_nz_av = tuple(extents_av[2*i+1]-extents_av[2*i]+1 for i in range(3))
x_av = np.array(data_av.GetXCoordinates())
y_av = np.array(data_av.GetYCoordinates())
z_av = np.array(data_av.GetZCoordinates())
xyz_av = [x_av, y_av, z_av]
avdims = np.where(np.array(nx_ny_nz_av) > 1)[0]
xyz_av_red = [x for i,x in enumerate([x_av, y_av, z_av]) if i in avdims]
xyz_av_red_g = np.meshgrid(*xyz_av_red, indexing='ij')
nx_ny_nz_av_red = [n for i,n in enumerate(nx_ny_nz_av) if i in avdims]
for ind, (block_in, block_out) in enumerate(zip(data, output)):
extents = block_in.GetExtent()
nx_ny_nz = tuple(extents[2*i+1]-extents[2*i]+1 for i in range(3))
x = np.array(block_in.GetXCoordinates())
y = np.array(block_in.GetYCoordinates())
z = np.array(block_in.GetZCoordinates())
xyz_red = [x for i,x in enumerate([x,y,z]) if i in avdims]
xyz_red_g = np.meshgrid(*xyz_red, indexing='ij')
nx_ny_nz_red = [n for i,n in enumerate(nx_ny_nz) if i in avdims]
nx_ny_nz_red_ext = [n if i in avdims else 1 for i,n in enumerate(nx_ny_nz)]
# Normalize existing fields
for qname in block_in.PointData.keys():
qname_av = qname + "_av"
qname_fluc = qname + "fluc"
if qname_av in data_av.PointData.keys():
u = np.reshape(block_in.PointData[qname], nx_ny_nz, order='F')
u_av_red = np.reshape(data_av.PointData[qname_av], nx_ny_nz_av, order='F').reshape(nx_ny_nz_av_red)
u_av_interpolator = RegularGridInterpolator(xyz_av_red, u_av_red)
u_av_interpolated = u_av_interpolator(tuple(xyz_red_g)).reshape(nx_ny_nz_red_ext)
# taking advantage of numpy broadcasting rules, here
ufluc = u - u_av_interpolated
block_out.PointData.append(np.reshape(ufluc, (-1), order='F'), qname_fluc)