CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > Visualization & Post-Processing Software > ParaView

[General] Ordering XYZ data in Paraview

Register Blogs Community New Posts Updated Threads Search

Like Tree2Likes
  • 1 Post By Gaetano
  • 1 Post By wyldckat

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 28, 2013, 06:46
Default Ordering XYZ data in Paraview
  #1
New Member
 
Ellen van der Veer
Join Date: Oct 2013
Posts: 4
Rep Power: 13
ellenvdveer is on a distinguished road
Hi all,

I am pretty new to paraview and have a problem in converting my actual structured data into a structured grid. I have a pressure file showing X,Y,Z,P but the X,Y,Z data are not in structured order. I found out how to re-order one column, e.g. X data, but attached to that I need to have my Y and Z data to be sorted from low to high along with the sortedX data.

Does any of you know if Paraview can re-order the Y and Z data for the fixed order of X data? And if yes, how? Would be of great help!

Best,

Ellen
ellenvdveer is offline   Reply With Quote

Old   November 3, 2013, 07:08
Default
  #2
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings Ellen and welcome to the forum!

If you could provide a small example, it would allow us to try to do some trial-and-error as well and to achieve the same you're trying to do.

Best regards,
Bruno
__________________
wyldckat is offline   Reply With Quote

Old   November 4, 2013, 04:21
Default
  #3
New Member
 
Ellen van der Veer
Join Date: Oct 2013
Posts: 4
Rep Power: 13
ellenvdveer is on a distinguished road
Thanks a lot. I just give a very straightforward example. E.g., you load a dataset representing X,Y,Z coordinates in PV which looks like this:

X Y Z
1 2 1
2 3 3
3 2 3
1 3 2
2 1 1
3 1 2
1 1 3
2 2 2
3 3 1

Now, I want it to sort in a structured way so I can convert it into a structured grid, i.e. it should look like this:

X Y Z
1 1 1
1 2 2
1 3 3
2 1 1
2 2 2
2 3 3
3 1 1
3 2 2
3 3 3

meaning that the X coordinates are sorted AND the Y,Z data are sorted within the block of the corresponding X-coordinate.

However, as far as I found out, I am only able to sort one column in Paraview, in this case the X-coordinate, which makes my result look like this:

X Y Z
1 2 1
1 3 2
1 1 3
2 3 3
2 1 1
2 2 2
3 2 3
3 1 2
3 3 1

Problem is that Paraview is not able to translate this into a structured grid. Very sorry if this all sounds a bit vague; it's just pretty hard to explain in words . Really hope you can help me on this!

Thanks
ellenvdveer is offline   Reply With Quote

Old   November 5, 2013, 07:30
Default
  #4
New Member
 
Gaetano
Join Date: Jul 2012
Posts: 18
Rep Power: 14
Gaetano is on a distinguished road
How about pre-processing your input file? I'm thinking about multiple sorting:
sort(z) -> sort(y) -> sort(x)

Before pre-processing (your example):
Code:
X	Y	Z
1	2	1
2	3	3
3	2	3
1	3	2
2	1	1
3	1	2
1	1	3
2	2	2
3	3	1
After sort(z):
Code:
X	Y	Z
1	2	1
2	1	1
3	3	1
1	3	2
3	1	2
2	2	2
2	3	3
3	2	3
1	1	3
After sort(y):
Code:
X	Y	Z
2	1	1
3	1	2
1	1	3
1	2	1
2	2	2
3	2	3
3	3	1
1	3	2
2	3	3
After sort(x):
Code:
X	Y	Z
1	1	3
1	2	1
1	3	2
2	1	1
2	2	2
2	3	3
3	1	2
3	2	3
3	3	1
I did this with m$ excel, but it should be straightforward with any software.

Another suggestion would be to create another field by merging the X, Y and Z and order by means of that. With decimal coordinates:
Code:
X	Y	Z
0.704	0.835	0.161
0.202	0.33	0.018
0.466	0.139	0.539
0.438	0.024	0.043
0.057	0.392	0.792
0.189	0.733	0.635
0.127	0.656	0.426
0.32	0.325	0.234
0.783	0.845	0.46
Here the new field is calculated as x*1000^3+y*1000^2+z*1000:
Code:
X	Y	Z	FIELD
0.704	0.835	0.161	704835161
0.202	0.33	0.018	202330018
0.466	0.139	0.539	466139539
0.438	0.024	0.043	438024043
0.057	0.392	0.792	57392792
0.189	0.733	0.635	189733635
0.127	0.656	0.426	127656426
0.32	0.325	0.234	320325234
0.783	0.845	0.46	783845460
After sorting:
Code:
X	Y	Z	FIELD
0.057	0.392	0.792	57392792
0.127	0.656	0.426	127656426
0.189	0.733	0.635	189733635
0.202	0.33	0.018	202330018
0.32	0.325	0.234	320325234
0.438	0.024	0.043	438024043
0.466	0.139	0.539	466139539
0.704	0.835	0.161	704835161
0.783	0.845	0.46	783845460
Which is the same result as sort(z) -> sort(y) -> sort(x)

Hope it helps.

Regards,
Gaetano
Gaetano is offline   Reply With Quote

Old   November 5, 2013, 08:40
Default
  #5
New Member
 
Ellen van der Veer
Join Date: Oct 2013
Posts: 4
Rep Power: 13
ellenvdveer is on a distinguished road
Hi Gaetano,

Thanks for your response. I see what you mean with the pre-processing, but for certain reasons I really want to do the sorting within Paraview if possible.

I tried the sorting sequence you propose but Paraview seems to overwrite previous sorting actions, so the result of sort(z) -> sort(y) -> sort(x) is exactly the same as sort(x) only.

About your second suggestion; I'm not sure if this is a really easy thing to do in Paraview. I will give it a try with programmable Phyton filters, but really hope there is actually an easier way to do so in Paraview. > I tried this using the Calculator filter in Paraview, but this is tricky as there were minor errors in the sorting, leading to a messed up structured grid. I think my values are just to high to use this method (PV cannot handle the 100^3 factor with my numbers).

Thanks, anyway :-)

Ellen

Last edited by ellenvdveer; November 6, 2013 at 09:09.
ellenvdveer is offline   Reply With Quote

Old   November 6, 2013, 06:20
Default
  #6
New Member
 
Ellen van der Veer
Join Date: Oct 2013
Posts: 4
Rep Power: 13
ellenvdveer is on a distinguished road
I'm still not sure how to solve this problem and I'm actually running out of ideas. Hope someone could help me out another moment. Thanks anyways for your comments .

Last edited by ellenvdveer; November 6, 2013 at 09:08.
ellenvdveer is offline   Reply With Quote

Old   November 7, 2013, 19:28
Default
  #7
New Member
 
Gaetano
Join Date: Jul 2012
Posts: 18
Rep Power: 14
Gaetano is on a distinguished road
I still think that pre-processing would be the best option. A small script will easily do the work, but you might also get it thanks to a programmable filter as first entry in the pipeline, I guess.
I'm not very experienced in that: let's wait for answers from more skilled users
ellenvdveer likes this.
Gaetano is offline   Reply With Quote

Old   November 9, 2013, 17:41
Default
  #8
Retired Super Moderator
 
Bruno Santos
Join Date: Mar 2009
Location: Lisbon, Portugal
Posts: 10,982
Blog Entries: 45
Rep Power: 128
wyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to allwyldckat is a name known to all
Greetings to all!

@Ellen: Gaetano is right. As someone once said: http://en.wikipedia.org/wiki/Perfect..._enemy_of_good
Quote:
perfect is the enemy of the good
It's a looooooooot easier to pre-process the data first and then import it to ParaView.
I've spent over 1h trying to learn how to do this in ParaView with the "Programmable Filter" and it's too much trouble to be bothered by it. It requires so many layers of converting data-types, just to get it sorted...


The simplest is to simply load the CSV data onto a numpy table and then use it to sort the table: http://stackoverflow.com/questions/2...umpy-by-column
Then use the numpy converter and send the data to the vtkTable: http://www.paraview.org/Wiki/ParaVie...ammable_Filter - search for "Mixing VTK and NumPy APIs"
All of this would probably have to be done with a "Programmable Source" instead of a "Programmable Filter". But I'm too tired to spend any more time on this

Good luck! Best regards,
Bruno
ellenvdveer likes this.
__________________
wyldckat is offline   Reply With Quote

Old   July 3, 2016, 22:04
Default table to structured grid & whole extent
  #9
Member
 
Ndong-Mefane Stephane Boris
Join Date: Nov 2013
Location: Kawasaki (JAPAN)
Posts: 53
Rep Power: 12
S_teph_2000 is on a distinguished road
Hello,
could someone explain to me how to determine the "whole extent" for paraview using one of the dataset above?

Steph
S_teph_2000 is offline   Reply With Quote

Reply

Tags
order, paraview, sort


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 Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
[OpenFOAM] How to get the coordinates of velocity data at all cells and at all times vidyadhar ParaView 9 May 20, 2020 21:06
UDF value to large for defined data type Anna73 Fluent UDF and Scheme Programming 9 September 30, 2018 23:18
[General] problem with extracting data from paraview a.hajisharifi ParaView 5 April 29, 2016 12:38
[OpenFOAM] Paraview: Cell data and Point Data? vitor ParaView 4 May 15, 2015 18:56
XYZ (ASCII format) data points into GAMBIT Neil FLUENT 1 August 7, 2007 10:24


All times are GMT -4. The time now is 03:45.