<div dir="ltr">Joeri,<div><br></div><div>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.</div><div><br></div><div>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</div><div><br></div><div>

<pre style="margin:12px 0px 0px;text-indent:0px"><span style="font-family:Monaco">dims </span><span style="font-family:Monaco;color:rgb(102,102,102)">=</span><span style="font-family:Monaco"> inputs[</span><span style="font-family:Monaco;color:rgb(102,102,102)">0</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">.</span><span style="font-family:Monaco">GetDimensions()</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:Monaco">ext </span><span style="font-family:Monaco;color:rgb(102,102,102)">=</span><span style="font-family:Monaco"> inputs[</span><span style="font-family:Monaco;color:rgb(102,102,102)">0</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">.</span><span style="font-family:Monaco">GetExtent()</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:Monaco">output</span><span style="font-family:Monaco;color:rgb(102,102,102)">.</span><span style="font-family:Monaco">SetDimensions(dims[</span><span style="font-family:Monaco;color:rgb(102,102,102)">0</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">+1</span><span style="font-family:Monaco">, dims[</span><span style="font-family:Monaco;color:rgb(102,102,102)">1</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">+1</span><span style="font-family:Monaco">, dims[</span><span style="font-family:Monaco;color:rgb(102,102,102)">2</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">+1</span><span style="font-family:Monaco">)</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:Monaco">output</span><span style="font-family:Monaco;color:rgb(102,102,102)">.</span><span style="font-family:Monaco">SetExtent(ext[</span><span style="font-family:Monaco;color:rgb(102,102,102)">0</span><span style="font-family:Monaco">], ext[</span><span style="font-family:Monaco;color:rgb(102,102,102)">1</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">+1</span><span style="font-family:Monaco">, ext[</span><span style="font-family:Monaco;color:rgb(102,102,102)">2</span><span style="font-family:Monaco">], ext[</span><span style="font-family:Monaco;color:rgb(102,102,102)">3</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">+1</span><span style="font-family:Monaco">, ext[</span><span style="font-family:Monaco;color:rgb(102,102,102)">4</span><span style="font-family:Monaco">], ext[</span><span style="font-family:Monaco;color:rgb(102,102,102)">5</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">+1</span><span style="font-family:Monaco">)</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:Monaco">inputPd </span><span style="font-family:Monaco;color:rgb(102,102,102)">=</span><span style="font-family:Monaco"> inputs[</span><span style="font-family:Monaco;color:rgb(102,102,102)">0</span><span style="font-family:Monaco">]</span><span style="font-family:Monaco;color:rgb(102,102,102)">.</span><span style="font-family:Monaco">GetPointData()</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:Monaco">outputCd </span><span style="font-family:Monaco;color:rgb(102,102,102)">=</span><span style="font-family:Monaco"> output</span><span style="font-family:Monaco;color:rgb(102,102,102)">.</span><span style="font-family:Monaco">GetCellData()</span></pre>
<pre style="margin:0px;text-indent:0px"><span style="font-family:Monaco">outputCd</span><span style="font-family:Monaco;color:rgb(102,102,102)">.</span><span style="font-family:Monaco">SetScalars(inputPd</span><span style="font-family:Monaco;color:rgb(102,102,102)">.</span><span style="font-family:Monaco">GetScalars())</span></pre>
<pre style="margin:0px;text-indent:0px;font-family:Monaco"><br></pre>
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).</div><div><br></div><div>HTH,</div><div>Cory</div></div><br><div class="gmail_quote"><div dir="ltr">On Wed, May 2, 2018 at 10:17 AM Engelen, J. van (Joeri) <<a href="mailto:j.vanengelen1@uu.nl">j.vanengelen1@uu.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">





<div lang="EN-GB" link="blue" vlink="purple">
<div class="m_-8838801349993644501WordSection1">
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">Hi,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">I was wondering whether it is possible to read NetCDF files as CellData.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">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.<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">The problem is that my file is automatically interpreted as PointData. To render this PointData, Paraview than consequently interpolates to achieve cell values.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">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).
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">Also, the information available to me was ambiguous,<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">-this source says it is probably not possible:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><a href="https://public.kitware.com/pipermail/paraview/2017-September/040984.html" target="_blank">https://public.kitware.com/pipermail/paraview/2017-September/040984.html</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">-this states it is possible return Cell Data information:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><a href="https://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.NetCDFReader.html" target="_blank">https://www.paraview.org/ParaView/Doc/Nightly/www/py-doc/paraview.simple.NetCDFReader.html</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">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).<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">So I have two questions:<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">-Is this possible?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">-Are there any workarounds you can think of to get my data as CellData in Paraview?<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">I’m using Paraview v5.4.1 on Windows 7.
<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Arial","sans-serif"">Kind regards,<br>
Joeri<u></u><u></u></span></p>
</div>
</div>

_______________________________________________<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" rel="noreferrer" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" rel="noreferrer" target="_blank">http://markmail.org/search/?q=ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://public.kitware.com/mailman/listinfo/paraview" rel="noreferrer" target="_blank">https://public.kitware.com/mailman/listinfo/paraview</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature">Cory Quammen<br>Staff R&D Engineer<br>Kitware, Inc.</div>