I have tested the following solution which consists in using a Python 
programmable filter, copying the non-spatial data attributes, and creating a 
new coordinate array with the spatial attributes (x, x and z)

see the included python code. I suggest using ParaView 4.4 or 5.0RC1.

Note that the solution provided is independent of the input grid resolution, 
and that it ought to work in parallel too for large scale grids. I have tested 
it using 4 pvservers.

Enjoy.
-----------------
Jean/CSCS
# state file generated using paraview version 5.0.0-RC1-4-g4f7ebb9
# example created by Jean M. Favre, Swiss National Supercomputing Center
# ----------------------------------------------------------------
# setup views used in the visualization
# ----------------------------------------------------------------

#### import the simple module from the paraview
from paraview.simple import *
#### disable automatic camera reset on 'Show'
paraview.simple._DisableFirstRenderCameraReset()

# Create a new 'Render View'
renderView1 = GetRenderView()

# create a new 'NetCDF Reader'
testnc = NetCDFReader(FileName=['./test.nc'])
testnc.Dimensions = '(CP, CZ, CR)'
testnc.SphericalCoordinates = 0

Script = """
import numpy as np
from vtk.numpy_interface import dataset_adapter as dsa
from vtk.numpy_interface import algorithms as algs
executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)\nin_mesh=inputs[0]\nexts = [executive.UPDATE_EXTENT().Get(outInfo, i) for i in xrange(6)]
output.SetExtent(exts)
X = in_mesh.PointData[\'x\']
Y = in_mesh.PointData[\'y\']
Z = in_mesh.PointData[\'z\']
output.Points = algs.make_vector(X,Y,Z)
output.PointData.append(in_mesh.PointData[\'cylindrical\'], "cylindrical")
"""
RequestInformationScript = """
executive = self.GetExecutive()
outInfo = executive.GetOutputInformation(0)
whole = [executive.WHOLE_EXTENT().Get(outInfo, i) for i in xrange(6)]
outInfo.Set(executive.WHOLE_EXTENT(), whole[0], whole[1], whole[2], whole[3], whole[4], whole[5])
outInfo.Set(vtk.vtkAlgorithm.CAN_PRODUCE_SUB_EXTENT(), 1)
"""

# create a new 'Programmable Filter'
programmableFilter1 = ProgrammableFilter(Input=testnc)
programmableFilter1.OutputDataSetType = 'vtkStructuredGrid'
programmableFilter1.Script = Script
programmableFilter1.RequestInformationScript = RequestInformationScript
programmableFilter1.RequestUpdateExtentScript = ''
programmableFilter1.PythonPath = ''

# create a new 'NetCDF Reader'
test151520nc = NetCDFReader(FileName=['./test.151520.nc'])
test151520nc.Dimensions = '(CP, CZ, CR)'
test151520nc.SphericalCoordinates = 0

# create a new 'Programmable Filter'
programmableFilter2 = ProgrammableFilter(Input=test151520nc)
programmableFilter2.OutputDataSetType = 'vtkStructuredGrid'
programmableFilter2.Script = Script
programmableFilter2.RequestInformationScript = RequestInformationScript
programmableFilter2.RequestUpdateExtentScript = ''
programmableFilter2.PythonPath = ''

# get color transfer function/color map for 'cylindrical'
cylindricalLUT = GetColorTransferFunction('cylindrical')
cylindricalLUT.RGBPoints = [-0.818740647478788, 0.231373, 0.298039, 0.752941, 0.0, 0.865003, 0.865003, 0.865003, 0.818740647478788, 0.705882, 0.0156863, 0.14902]
cylindricalLUT.ScalarRangeInitialized = 1.0

# get opacity transfer function/opacity map for 'cylindrical'
cylindricalPWF = GetOpacityTransferFunction('cylindrical')
cylindricalPWF.Points = [-0.818740647478788, 0.0, 0.5, 0.0, 0.818740647478788, 1.0, 0.5, 0.0]
cylindricalPWF.ScalarRangeInitialized = 1

# show data from programmableFilter2
programmableFilter2Display = Show(programmableFilter2, renderView1)
# trace defaults for the display properties.
programmableFilter2Display.Representation = 'Surface With Edges'
programmableFilter2Display.ColorArrayName = ['POINTS', 'cylindrical']
programmableFilter2Display.LookupTable = cylindricalLUT

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the ParaView Wiki at: 
http://paraview.org/Wiki/ParaView

Search the list archives at: http://markmail.org/search/?q=ParaView

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/paraview

Reply via email to