CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > ParaView

NaN color for TecPlot data

Register Blogs Members List Search Today's Posts Mark Forums Read

Reply
 
LinkBack Thread Tools Display Modes
Old   January 22, 2014, 10:45
Default NaN color for TecPlot data
  #1
Senior Member
 
Elo´se
Join Date: Jul 2012
Location: Trondheim, Norway
Posts: 112
Rep Power: 6
Eloise is on a distinguished road
Hello,

I import some 2D data from a TecPlot format into ParaView through a Python script. The TecPlot data file has the following structure:
Code:
TITLE = "B00001"
VARIABLES = "x", "y", "U"
ZONE T="Frame 0", I=74, J=55
1.271574e+02 -8.534172e+00 NaN
[...]
1.263715e+02 -1.875147e+01 9.161986e-01
[...]
In order to highlight the region where the variable U is defined, I'd like to use a colorbar for U and a white color for the NaN region.

I'm using the following command to define my LookUpTable. The colorbar is properly created, but the instruction regarding NaN seems to be ignored. It looks like ParaView automatically converts the NaN to 0.0 because the NaN region get the color assigned to 0.0 (gray) instead of a white color.
Code:
a1_Ux_PVLookupTable = GetLookupTableForArray( "U", 1, RGBPoints=[UMin, 0.23, 0.299, 0.754, 0.0, 0.865, 0.865, 0.865, UMax, 0.706, 0.016, 0.15], NanColor=[1.0, 1.0, 1.0], ColorSpace='Diverging', ScalarRangeInitialized=1.0)
I've also tried to import manually the TecPlot file through the GUI and set NaN color to white in the colorbar menu, but it does not have any effect on the image.

Does someone know more about handling of NaN values during TecPlot import in ParaView 4.1.0-RC1 and can help me?

Many thanks,
Elo´se
Eloise is offline   Reply With Quote

Old   January 24, 2014, 20:26
Default
  #2
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,743
Blog Entries: 39
Rep Power: 103
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Greetings Elo´se,

Without an example file to test this myself, I can only guess that the TecPlot reader in ParaView is actually the one to blame here

Did you confirm in the Spreadsheet view in ParaView, if the values were correctly loaded?

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Old   January 27, 2014, 07:19
Default
  #3
Senior Member
 
Elo´se
Join Date: Jul 2012
Location: Trondheim, Norway
Posts: 112
Rep Power: 6
Eloise is on a distinguished road
Hello Bruno,

Yes, let's blame the loader I uploaded a TecPlot file where you can see that the original data contain NaN. The spreadsheet view confirms that the NaN values are converted to 0.0 at import.

It annoys me because it is then difficult to identify the boundary of the region which actually contains the data, as I also have a region close to 0.0 in my data.

Having NaNs would make it easy to define the color of the NaNs to white and create the contrast to highlight the region containing data. Another way to do is maybe to filter all the 0.0 values in Paraview and set another color for them. But I didn't manage to do so. Any help or suggestions are welcome!

Thanks,
Elo´se
Attached Images
File Type: jpg Example.jpg (25.0 KB, 12 views)
Attached Files
File Type: zip B00001.zip (45.1 KB, 5 views)
Eloise is offline   Reply With Quote

Old   February 2, 2014, 11:54
Default
  #4
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,743
Blog Entries: 39
Rep Power: 103
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Hi Elo´se,

Mmm... strange. Perhaps this was already fixed in ParaView 4.1.0, since RC1 was released?
I've used the 4.1.0 version for Linux 64 bit and attached is the image that tells almost all of the details:
  • The spreadsheet view demonstrates that the NaN values were read properly.
  • The colour for NaN values was respected.
The missing detail is that I used the "Tecplot Files" option when ParaView asked me which reader to use to load the data.

Best regards,
Bruno
Attached Images
File Type: jpg Screenshot from 2014-02-02 15:50:25.jpg (66.9 KB, 9 views)
wyldckat is offline   Reply With Quote

Old   February 4, 2014, 11:04
Default
  #5
Senior Member
 
Elo´se
Join Date: Jul 2012
Location: Trondheim, Norway
Posts: 112
Rep Power: 6
Eloise is on a distinguished road
Hello Bruno,

I'm post-processing those data on a Windows 64bits machine. I've downloaded Paraview 4.1 for Windows 64bits and the NaN values are still converted to zeros here. I'm also using the TecPlot file option when loading the data.

Thanks for trying,
Elo´se
Attached Images
File Type: jpg Win64bits.jpg (56.7 KB, 5 views)
Eloise is offline   Reply With Quote

Old   February 15, 2014, 15:56
Default
  #6
Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 9,743
Blog Entries: 39
Rep Power: 103
wyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of lightwyldckat is a glorious beacon of light
Hi Elo´se,

I went into the VTK source code and found out that the limitation is in atof, a function that converts a number in text format to a double value: https://github.com/Kitware/VTK/blob/...eader.cxx#L824

Unfortunately, if we Google:
Code:
microsoft atof nan
We can easily find that Microsoft's implementation of atof cannot handle NaN values, which returns simply "0.0".

Therefore, the only solution (aside from using a Linux Distribution ) is to use a text editor to search and replace all NaN values for something... I've done some tests and 1e40 is enough to get all ex-NaN values to be interpreted as "inf" (infinite)... problem is that I can't do anything worth while with it

Now I'm understanding a lot better why some people say Windows isn't very science friendly...

Best regards,
Bruno
wyldckat is offline   Reply With Quote

Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
2 datas on one plot Akuji ParaView 46 December 1, 2013 15:06
fluentMeshToFoam multidomain mesh conversion problem Attesz OpenFOAM Other Meshers: ICEM, Star, Ansys, Pointwise, GridPro, Ansa, ... 12 May 2, 2013 10:52
Why simulation results showing "nan" values? Sargam05 OpenFOAM 4 September 10, 2012 12:37
Could anybody help me see this error and give help liugx212 OpenFOAM Running, Solving & CFD 3 January 4, 2006 19:07
How to update polyPatchbs localPoints liu OpenFOAM Running, Solving & CFD 6 December 30, 2005 18:27


All times are GMT -4. The time now is 18:13.