<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:SimSun;
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"\@SimSun";
panose-1:2 1 6 0 3 1 1 1 1 1;}
@font-face
{font-family:Consolas;
panose-1:2 11 6 9 2 2 4 3 2 4;}
@font-face
{font-family:Monaco;
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0cm;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
pre
{mso-style-priority:99;
mso-style-link:"HTML Preformatted Char";
margin:0cm;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Courier New";}
span.HTMLPreformattedChar
{mso-style-name:"HTML Preformatted Char";
mso-style-priority:99;
mso-style-link:"HTML Preformatted";
font-family:Consolas;}
span.EmailStyle19
{mso-style-type:personal-reply;
font-family:"Arial","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-family:"Calibri","sans-serif";}
@page WordSection1
{size:612.0pt 792.0pt;
margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-GB" link="blue" vlink="purple">
<div class="WordSection1">
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D">Thank you Cory,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D">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).
<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D">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.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="font-size:11.0pt;font-family:"Arial","sans-serif";color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> Cory Quammen [mailto:cory.quammen@kitware.com]
<br>
<b>Sent:</b> Wednesday, May 02, 2018 5:01 PM<br>
<b>To:</b> Engelen, J. van (Joeri)<br>
<b>Cc:</b> paraview@public.kitware.com<br>
<b>Subject:</b> Re: [Paraview] generic NetCDFreader support for CellData<o:p></o:p></span></p>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<p class="MsoNormal">Joeri,<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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.<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">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<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<pre style="margin-top:9.0pt"><span style="font-family:"Monaco","serif"">dims <span style="color:#666666">=</span> inputs[<span style="color:#666666">0</span>]<span style="color:#666666">.</span>GetDimensions()</span><o:p></o:p></pre>
<pre><span style="font-family:"Monaco","serif"">ext <span style="color:#666666">=</span> inputs[<span style="color:#666666">0</span>]<span style="color:#666666">.</span>GetExtent()</span><o:p></o:p></pre>
<pre><span style="font-family:"Monaco","serif"">output<span style="color:#666666">.</span>SetDimensions(dims[<span style="color:#666666">0</span>]<span style="color:#666666">+1</span>, dims[<span style="color:#666666">1</span>]<span style="color:#666666">+1</span>, dims[<span style="color:#666666">2</span>]<span style="color:#666666">+1</span>)</span><o:p></o:p></pre>
<pre><span style="font-family:"Monaco","serif"">output<span style="color:#666666">.</span>SetExtent(ext[<span style="color:#666666">0</span>], ext[<span style="color:#666666">1</span>]<span style="color:#666666">+1</span>, ext[<span style="color:#666666">2</span>], ext[<span style="color:#666666">3</span>]<span style="color:#666666">+1</span>, ext[<span style="color:#666666">4</span>], ext[<span style="color:#666666">5</span>]<span style="color:#666666">+1</span>)</span><o:p></o:p></pre>
<pre><span style="font-family:"Monaco","serif"">inputPd <span style="color:#666666">=</span> inputs[<span style="color:#666666">0</span>]<span style="color:#666666">.</span>GetPointData()</span><o:p></o:p></pre>
<pre><span style="font-family:"Monaco","serif"">outputCd <span style="color:#666666">=</span> output<span style="color:#666666">.</span>GetCellData()</span><o:p></o:p></pre>
<pre><span style="font-family:"Monaco","serif"">outputCd<span style="color:#666666">.</span>SetScalars(inputPd<span style="color:#666666">.</span>GetScalars())</span><o:p></o:p></pre>
<pre><span style="font-family:"Monaco","serif""><o:p> </o:p></span></pre>
<p class="MsoNormal">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).<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<div>
<p class="MsoNormal">HTH,<o:p></o:p></p>
</div>
<div>
<p class="MsoNormal">Cory<o:p></o:p></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<div>
<div>
<p class="MsoNormal">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:<o:p></o:p></p>
</div>
<blockquote style="border:none;border-left:solid #CCCCCC 1.0pt;padding:0cm 0cm 0cm 6.0pt;margin-left:4.8pt;margin-right:0cm">
<div>
<div>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">Hi,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">I was wondering whether it is possible to read NetCDF files as CellData.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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.</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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. </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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).
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">Also, the information available to me was ambiguous,</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">-this source says it is probably not possible:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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></span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">-this states it is possible return Cell Data information:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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></span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><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).</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">So I have two questions:</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">-Is this possible?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">-Are there any workarounds you can think of to get my data as CellData in Paraview?</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">I’m using Paraview v5.4.1 on Windows 7.
</span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif""> </span><o:p></o:p></p>
<p class="MsoNormal" style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><span style="font-family:"Arial","sans-serif"">Kind regards,<br>
Joeri</span><o:p></o:p></p>
</div>
</div>
<p class="MsoNormal">_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" 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" target="_blank">
http://paraview.org/Wiki/ParaView</a><br>
<br>
Search the list archives at: <a href="http://markmail.org/search/?q=ParaView" 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" target="_blank">https://public.kitware.com/mailman/listinfo/paraview</a><o:p></o:p></p>
</blockquote>
</div>
<p class="MsoNormal"><br clear="all">
<o:p></o:p></p>
<div>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
<p class="MsoNormal">-- <o:p></o:p></p>
<div>
<p class="MsoNormal">Cory Quammen<br>
Staff R&D Engineer<br>
Kitware, Inc.<o:p></o:p></p>
</div>
</div>
</body>
</html>