Thank you Cory,

I sense this solution might work. However, the type of my data is “Rectilinear 
Grid”, not sure if that increases the complexity (dx = 1000, dy = 1000, dz = 1).
Regardless, the script you provided does not give me output and it also does 
not throw an error, so I’m left a bit in the dark here.

From: Cory Quammen [mailto:[email protected]]
Sent: Wednesday, May 02, 2018 5:01 PM
To: Engelen, J. van (Joeri)
Cc: [email protected]
Subject: Re: [Paraview] generic NetCDFreader support for CellData

Joeri,

You can try the "Point Data to Cell Data" filter, but that averages the point 
data and places the results in the cell data. You may wind up with some 
incorrect values using that approach.

Better would be to use a "Progammable Filter" to resize the cartesian grid read 
by the NetCDF reader and treat the point data as cell data. That is a bit 
involved, but not terrible. Set the Script to


dims = inputs[0].GetDimensions()

ext = inputs[0].GetExtent()

output.SetDimensions(dims[0]+1, dims[1]+1, dims[2]+1)

output.SetExtent(ext[0], ext[1]+1, ext[2], ext[3]+1, ext[4], ext[5]+1)

inputPd = inputs[0].GetPointData()

outputCd = output.GetCellData()

outputCd.SetScalars(inputPd.GetScalars())


This assumes that the NetCDF reader is producing a vtkImageData (you can check 
under the Information panel) which would report the Type: of the data set as 
"Image (Uniform Rectilinear Grid).

HTH,
Cory

On Wed, May 2, 2018 at 10:17 AM Engelen, J. van (Joeri) 
<[email protected]<mailto:[email protected]>> wrote:
Hi,

I was wondering whether it is possible to read NetCDF files as CellData.

I have categorial data on Cartesian coordinates that I want to visualize. To be 
more specific, the data represents lithologies of the subsurface. So 1 = sand, 
3 = clay, 5 = rock.
The problem is that my file is automatically interpreted as PointData. To 
render this PointData, Paraview than consequently interpolates to achieve cell 
values.
With most variables that is not such a problem, but here it is. If I have sand 
(1) overlying rock (5), Paraview shows me clay (3).

Also, the information available to me was ambiguous,
-this source says it is probably not possible:
https://public.kitware.com/pipermail/paraview/2017-September/040984.html
-this states it is possible return Cell Data information:
https://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.NetCDFReader.html

I tried converting my data from NetCDF to a .vtr file in Python, but this 
resulted in more problems than solutions. (Just gave me very glitched 
rendering).

So I have two questions:
-Is this possible?
-Are there any workarounds you can think of to get my data as CellData in 
Paraview?

I’m using Paraview v5.4.1 on Windows 7.

Kind regards,
Joeri
_______________________________________________
Powered by www.kitware.com<http://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:
https://public.kitware.com/mailman/listinfo/paraview


--
Cory Quammen
Staff R&D Engineer
Kitware, Inc.
_______________________________________________
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:
https://public.kitware.com/mailman/listinfo/paraview

Reply via email to