[Paraview] NaN values
Moreland, Kenneth
kmorel at sandia.gov
Tue Nov 14 09:45:15 EST 2017
Doina,
I wasn’t trying to suggest removing all the NaN values by hand. I was saying that the file is being written incorrectly, and you need to change the way you are saving it. The simplest way should be to change the Matlab script that writes the file in the first place. I appreciate that the matrix you are storing the data in Matlab has to be dense, but why do you have to write every entry of the matrix into the file? Write a for loop over the dimensions of the matrix and conditionally write a number if it is not NaN.
If for whatever reason you cannot do that (maybe you are using someone else’s Matlab file writing script and don’t want to or can’t change it), then you could probably automatically remove all the NaN’s with a script after the fact. For example, you should be able to use sed to remove all instances of the string NaN from the file. (This, of course, runs the danger of removing a NaN from elsewhere in the file that you want.)
-Ken
From: "Doina Gumeniuc (224252 MAHS)" <224252 at via.dk>
Date: Tuesday, November 14, 2017 at 12:42 AM
To: "Moreland, Kenneth" <kmorel at sandia.gov>, Mathieu Westphal <mathieu.westphal at kitware.com>, "paraview at paraview.org" <paraview at paraview.org>
Subject: [EXTERNAL] Re: [Paraview] NaN values
Hi!
Yes, I of course understand your point. There is a bit of a problem though: In reality, this file is much more bigger and deleting the NaNs by hand is not an option (also I am trying to make it all happen automatically). If I ask matlab to delete the zeros from my file, the shape of the matrix will change, so the only solution I found so far is to replace the zeros by NaNs in matlab, which gives me error in paraview, for the reason you, Moreland, explained.
So my question would be again, is it possible to replace it with anything else?
Thank you!
________________________________
From: Moreland, Kenneth <kmorel at sandia.gov>
Sent: November 14, 2017 12:24:03 AM
To: Doina Gumeniuc (224252 MAHS); Mathieu Westphal; paraview at paraview.org
Subject: Re: [Paraview] NaN values
Doina,
vtk files support Nan’s in general. (I just tried it. It worked fine.) However, you are trying to introduce NaN’s in a list of integer connections, which is just wrong on many levels. However, I do not see why you need NaN at all. The LINES connectivity list allows you to vary the length of the line chain.
It looks like you can solve your problem by simply not writing out the NaN’s in the fill. In the example you sent us, I presume that you mean to have 4 line cells with 2, 3, 2, and 2 vertices, respectively. The following should be the correct representation of that:
LINES 4 13
2 0 1
3 1 2 3
2 3 4
2 4 5
-Ken
From: ParaView <paraview-bounces at paraview.org> on behalf of "Doina Gumeniuc (224252 MAHS)" <224252 at via.dk>
Date: Monday, November 13, 2017 at 12:55 PM
To: Mathieu Westphal <mathieu.westphal at kitware.com>, "paraview at paraview.org" <paraview at paraview.org>
Subject: [EXTERNAL] Re: [Paraview] NaN values
Hi Mathieu,
Sadly I can not import the whole file, but here is an example:
LINES 4 13
2 0 1 NaN
3 1 2 3
2 3 4 NaN
2 4 5 NaN
I make the vtk file in matlab by extracting the information from a .dat file. Originally, instead of NaN there are zeros, but I just need blanks without changing the shape of the matrix, which is why I use NaN, but it gives me error in paraview.
I hope it explains what I mean. Thank you!
________________________________
From: Mathieu Westphal <mathieu.westphal at kitware.com>
Sent: November 13, 2017 4:29:18 PM
To: Doina Gumeniuc (224252 MAHS)
Cc: paraview at paraview.org
Subject: Re: [Paraview] NaN values
Hi
Can you share your dataset ?
Thanks,
Mathieu Westphal
On Mon, Nov 13, 2017 at 4:10 PM, Doina Gumeniuc (224252 MAHS) <224252 at via.dk<mailto:224252 at via.dk>> wrote:
Hi Mathieu,
I am using a vtk poly data file, which when I load in paraview, it gives me error (paraview just stops working). I was thinking it is because of my NaN values.
________________________________
From: Mathieu Westphal <mathieu.westphal at kitware.com<mailto:mathieu.westphal at kitware.com>>
Sent: November 13, 2017 2:53:19 PM
To: Doina Gumeniuc (224252 MAHS)
Cc: paraview at paraview.org<mailto:paraview at paraview.org>
Subject: Re: [Paraview] NaN values
Hi
ParaView understand NaN correctly as blanks.
If you are reading a .csv file, the correct string that is interpreted as NaN is "nan" without the quotes.
Best,
Mathieu Westphal
On Mon, Nov 13, 2017 at 2:48 PM, Doina Gumeniuc (224252 MAHS) <224252 at via.dk<mailto:224252 at via.dk>> wrote:
Hi all,
I have a file with NaN values in almost every column and row. The integer numbers represent which points should be connected by lines, therefor I can not replace NaN with zeros because it will interpret it as Point with ID 0.
Is there any way I can replace this NaNs with something which paraview reads as blanks?
Thank you!
_______________________________________________
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:
http://public.kitware.com/mailman/listinfo/paraview
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/paraview/attachments/20171114/0c1f72e6/attachment.html>
More information about the ParaView
mailing list