[Paraview] extracting line data

Sven Buijssen sven.buijssen at tu-dortmund.de
Mon Oct 19 12:57:29 EDT 2009


Hi,

I think it can be done by applying a Calculatur filter first to store the
coordinates as an additional point dataset (named e.g. 'xyz'), then applying the
original Plot over Line filter and finally a Programmable Filter with the
following code:

inp = self.GetInput()
filename = "foo.csv"

FILE = open(filename,"w")
FILE.write("x,y,z, x-velocity")
numPoints = inp.GetNumberOfPoints()
coords = inp.GetPointData().GetArray("xyz")
vel = inp.GetPointData().GetArray("Velocity")
for i in xrange(0, 3*numPoints, 3):
  FILE.write(str(coords.GetValue(i)) + "," + str(coords.GetValue(i+1)) + "," +
str(coords.GetValue(i+2)) + "," + str(vel.GetValue(i)))
FILE.close()

(write statement is one big line, despite it being wrapped in this message)


Sven



> So... you are asking /not/ write out the fields you are not interested
> in.  I am afraid that ParaView does not support that; it will write out
> all of the data to the file.  You will have to remove these columns
> after ParaView has written the file.
> 
> -Ken
> 
> 
> On 10/17/09 4:04 AM, "Stephen Wornom" <stephen.wornom at sophia.inria.fr>
> wrote:
> 
>     Moreland, Kenneth wrote:
>     > Csv = Comma separated values, for example “x,pressure,...” Could you
>     > perhaps be more specific on the problem since what you describe, to
>     > me, sounds exactly what the csv file should contain?
>     >
>     I slected only to plot only the velocity in x anong a line that was
>     x=z=constant y varying from 0 to 0.01.
>     I would like simply the values x,y,z, x-velocity. It looks like the x
>     values are point values and not physical values with they,z values being
>     zero.
>     Hope this helps,
>     Stephen
>     sophia-nef-bash-3.2$ cat line_data.csv
>     "X::Point","Y::Point","Z::Point","Density::PointData","Pressure::PointData","Mach::PointData","K::PointData","Epsilon::PointData","LogFR::PointData","Velocity::PointData","Velocity::PointData","Velocity::PointData","vtkValidPointMask::PointData","original_coordinates::PointData","original_coordinates::PointData","original_coordinates::PointData","arc_length::PointData"
> 
>     0,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,-0.00617181,0.0225,0
>     1,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,-0.00509181,0.0225,0.00108
>     2,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,-0.00401181,0.0225,0.00216
>     3,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,-0.00293181,0.0225,0.00324
>     4,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,-0.00185181,0.0225,0.00432
>     5,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,-0.000771809,0.0225,0.0054
>     6,0,0,1,101300,0.00820878,0.0325902,30.9525,1.10668,3.09135,0,0,,0.0700797,0.000308191,0.0225,0.00648
> 
>     7,0,0,1,101300,0.0140821,0.0451884,8.83578,1.10668,5.30319,0,0,,0.0700797,0.00138819,0.0225,0.00756
> 
>     8,0,0,1,101300,0.0155424,0.0438321,4.89569,1.10668,5.8531,0,0,,0.0700797,0.00246819,0.0225,0.00864
> 
>     9,0,0,1,101300,0.0164489,0.0429625,3.39151,1.10668,6.1945,0,0,,0.0700797,0.00354819,0.0225,0.00972
> 
>     10,0,0,1,101300,0.0171169,0.042281,2.60179,1.10668,6.44603,0,0,,0.0700797,0.00462819,0.0225,0.0108
> 
>     11,0,0,1,101300,0.0176546,0.041669,2.10451,1.10668,6.64854,0,0,,0.0700797,0.00570819,0.0225,0.01188
> 
>     12,0,0,1,101300,0.0181045,0.0410879,1.76497,1.10668,6.81797,0,0,,0.0700797,0.00678819,0.0225,0.01296
> 
>     13,0,0,1,101300,0.0184959,0.0405213,1.51332,1.10668,6.96538,0,0,,0.0700797,0.00786819,0.0225,0.01404
> 
>     14,0,0,1,101300,0.0188361,0.0399644,1.32698,1.10668,7.09349,0,0,,0.0700797,0.00894819,0.0225,0.01512
> 
>     15,0,0,1,101300,0.0191425,0.0394128,1.17787,1.10668,7.20889,0,0,,0.0700797,0.0100282,0.0225,0.0162
> 
>     16,0,0,1,101300,0.0194206,0.0388655,1.05676,1.10668,7.3136,0,0,,0.0700797,0.0111082,0.0225,0.01728
> 
>     17,0,0,1,101300,0.0196749,0.0383219,0.956702,1.10668,7.40936,0,0,,0.0700797,0.0121882,0.0225,0.01836
> 
>     18,0,0,1,101300,0.0199094,0.0377815,0.872503,1.10668,7.49767,0,0,,0.0700797,0.0132682,0.0225,0.01944
> 
>     19,0,0,1,101300,0.0201276,0.0372441,0.800271,1.10668,7.57986,0,0,,0.0700797,0.0143482,0.0225,0.02052
> 
>     20,0,0,1,101300,0.0203326,0.0367094,0.737115,1.10668,7.65707,0,0,,0.0700797,0.0154282,0.0225,0.0216
> 
>     21,0,0,1,101300,0.0205225,0.0361781,0.683477,1.10668,7.72858,0,0,,0.0700797,0.0165082,0.0225,0.02268
> 
>     22,0,0,1,101300,0.0207014,0.0356497,0.636132,1.10668,7.79594,0,0,,0.0700797,0.0175882,0.0225,0.02376
> 
>     23,0,0,1,101300,0.0208733,0.0351233,0.592636,1.10668,7.86066,0,0,,0.0700797,0.0186682,0.0225,0.02484
> 
>     24,0,0,1,101300,0.0210333,0.0346005,0.555235,1.10668,7.92092,0,0,,0.0700797,0.0197482,0.0225,0.02592
> 
>     25,0,0,1,101300,0.0211869,0.0340799,0.520814,1.10668,7.97876,0,0,,0.0700797,0.0208282,0.0225,0.027
> 
>     26,0,0,1,101300,0.0213337,0.0335617,0.489533,1.10668,8.03406,0,0,,0.0700797,0.0219082,0.0225,0.02808
> 
>     27,0,0,1,101300,0.0214728,0.0330468,0.461506,1.10668,8.08642,0,0,,0.0700797,0.0229882,0.0225,0.02916
> 
>     28,0,0,1,101300,0.0216074,0.0325339,0.43532,1.10668,8.13713,0,0,,0.0700797,0.0240682,0.0225,0.03024
> 
>     29,0,0,1,101300,0.0217352,0.0320245,0.411731,1.10668,8.18526,0,0,,0.0700797,0.0251482,0.0225,0.03132
> 
>     30,0,0,1,101300,0.0218586,0.0315174,0.389786,1.10668,8.23174,0,0,,0.0700797,0.0262282,0.0225,0.0324
> 
>     31,0,0,1,101300,0.021978,0.0310127,0.369219,1.10668,8.27669,0,0,,0.0700797,0.0273082,0.0225,0.03348
> 
>     32,0,0,1,101300,0.022091,0.030512,0.350809,1.10668,8.31924,0,0,,0.0700797,0.0283882,0.0225,0.03456
> 
>     33,0,0,1,101300,0.022204,0.0300113,0.332398,1.10668,8.3618,0,0,,0.0700797,0.0294682,0.0225,0.03564
> 
>     34,0,0,1,101300,0.0223077,0.0295177,0.316802,1.10668,8.40085,0,0,,0.0700797,0.0305482,0.0225,0.03672
> 
>     35,0,0,1,101300,0.0224109,0.0290243,0.301344,1.10668,8.43973,0,0,,0.0700797,0.0316282,0.0225,0.0378
> 
>     36,0,0,1,101300,0.0225116,0.0285334,0.286581,1.10668,8.47764,0,0,,0.0700797,0.0327082,0.0225,0.03888
>     37,0,0,1,101300,0.0226056,0.0280488,0.2736,1.10668,8.51305,0,0,,0.0700797,0.0337882,0.0225,0.03996
>     38,0,0,1,101300,0.0226997,0.0275642,0.260618,1.10668,8.54846,0,0,,0.0700797,0.0348682,0.0225,0.04104
>     39,0,0,1,101300,0.0227906,0.0270833,0.248365,1.10668,8.58273,0,0,,0.0700797,0.0359482,0.0225,0.04212
>     40,0,0,1,101300,0.022876,0.0266093,0.237468,1.10668,8.61487,0,0,,0.0700797,0.0370282,0.0225,0.0432
>     41,0,0,1,101300,0.0229613,0.0261354,0.226572,1.10668,8.647,0,0,,0.0700797,0.0381082,0.0225,0.04428
>     42,0,0,1,101300,0.0230455,0.0256632,0.215914,1.10668,8.67872,0,0,,0.0700797,0.0391882,0.0225,0.04536
>     43,0,0,1,101300,0.0231225,0.0252026,0.206783,1.10668,8.7077,0,0,,0.0700797,0.0402682,0.0225,0.04644
>     44,0,0,1,101300,0.0231995,0.0247419,0.197652,1.10668,8.73669,0,0,,0.0700797,0.0413482,0.0225,0.04752
>     45,0,0,1,101300,0.0232764,0.0242813,0.188521,1.10668,8.76567,0,0,,0.0700797,0.0424282,0.0225,0.0486
>     46,0,0,1,101300,0.0233484,0.0238311,0.180313,1.10668,8.79279,0,0,,0.0700797,0.0435082,0.0225,0.04968
>     47,0,0,1,101300,0.0234173,0.0233875,0.172694,1.10668,8.81871,0,0,,0.0700797,0.0445882,0.0225,0.05076
>     48,0,0,1,101300,0.0234861,0.022944,0.165074,1.10668,8.84464,0,0,,0.0700797,0.0456682,0.0225,0.05184
>     49,0,0,1,101300,0.023555,0.0225004,0.157454,1.10668,8.87056,0,0,,0.0700797,0.0467482,0.0225,0.05292
>     50,0,0,1,101300,0.0236178,0.0220736,0.150812,1.10668,8.89422,0,0,,0.0700797,0.0478282,0.0225,0.054
>     51,0,0,1,101300,0.0236785,0.0216524,0.144503,1.10668,8.9171,0,0,,0.0700797,0.0489082,0.0225,0.05508
>     52,0,0,1,101300,0.0237393,0.0212313,0.138194,1.10668,8.93998,0,0,,0.0700797,0.0499882,0.0225,0.05616
>     53,0,0,1,101300,0.0238,0.0208101,0.131885,1.10668,8.96286,0,0,,0.0700797,0.0510682,0.0225,0.05724
>     54,0,0,1,101300,0.0238566,0.0204044,0.126168,1.10668,8.98416,0,0,,0.0700797,0.0521482,0.0225,0.05832
>     55,0,0,1,101300,0.0239091,0.0200136,0.121024,1.10668,9.00392,0,0,,0.0700797,0.0532282,0.0225,0.0594
>     56,0,0,1,101300,0.0239616,0.0196228,0.11588,1.10668,9.02369,0,0,,0.0700797,0.0543082,0.0225,0.06048
>     57,0,0,1,101300,0.0240141,0.019232,0.110736,1.10668,9.04345,0,0,,0.0700797,0.0553882,0.0225,0.06156
>     58,0,0,1,101300,0.0240665,0.0188412,0.105593,1.10668,9.06322,0,0,,0.0700797,0.0564682,0.0225,0.06264
>     59,0,0,1,101300,0.0241117,0.0184858,0.101364,1.10668,9.08021,0,0,,0.0700797,0.0575482,0.0225,0.06372
>     60,0,0,1,101300,0.0241556,0.0181362,0.0972847,1.10668,9.09675,0,0,,0.0700797,0.0586282,0.0225,0.0648
>     61,0,0,1,101300,0.0241995,0.0177867,0.0932054,1.10668,9.11329,0,0,,0.0700797,0.0597082,0.0225,0.06588
>     62,0,0,1,101300,0.0242434,0.0174371,0.0891261,1.10668,9.12983,0,0,,0.0700797,0.0607882,0.0225,0.06696
>     63,0,0,1,101300,0.0242874,0.0170875,0.0850468,1.10668,9.14638,0,0,,0.0700797,0.0618682,0.0225,0.06804
>     64,0,0,1,101300,0.0243244,0.0167797,0.0817262,1.10668,9.16031,0,0,,0.0700797,0.0629482,0.0225,0.06912
>     65,0,0,1,101300,0.0243592,0.016485,0.0786413,1.10668,9.17344,0,0,,0.0700797,0.0640282,0.0225,0.0702
>     66,0,0,1,101300,0.0243941,0.0161902,0.0755565,1.10668,9.18656,0,0,,0.0700797,0.0651082,0.0225,0.07128
>     67,0,0,1,101300,0.0244289,0.0158955,0.0724716,1.10668,9.19968,0,0,,0.0700797,0.0661882,0.0225,0.07236
>     68,0,0,1,101300,0.0244638,0.0156007,0.0693868,1.10668,9.21281,0,0,,0.0700797,0.0672682,0.0225,0.07344
>     69,0,0,1,101300,0.024497,0.0153181,0.0664653,1.10668,9.22531,0,0,,0.0700797,0.0683482,0.0225,0.07452
>     70,0,0,1,101300,0.0245222,0.0150934,0.0643221,1.10668,9.23482,0,0,,0.0700797,0.0694282,0.0225,0.0756
>     71,0,0,1,101300,0.0245475,0.0148686,0.0621788,1.10668,9.24433,0,0,,0.0700797,0.0705082,0.0225,0.07668
>     72,0,0,1,101300,0.0245727,0.0146438,0.0600355,1.10668,9.25384,0,0,,0.0700797,0.0715882,0.0225,0.07776
>     73,0,0,1,101300,0.024598,0.0144191,0.0578922,1.10668,9.26335,0,0,,0.0700797,0.0726682,0.0225,0.07884
>     74,0,0,1,101300,0.0246232,0.0141943,0.0557489,1.10668,9.27286,0,0,,0.0700797,0.0737482,0.0225,0.07992
>     75,0,0,1,101300,0.024648,0.0139732,0.053645,1.10668,9.28221,0,0,,0.0700797,0.0748282,0.0225,0.081
>     76,0,0,1,101300,0.0246634,0.0138319,0.0523893,1.10668,9.28797,0,0,,0.0700797,0.0759082,0.0225,0.08208
>     77,0,0,1,101300,0.0246787,0.0136905,0.0511337,1.10668,9.29374,0,0,,0.0700797,0.0769882,0.0225,0.08316
>     78,0,0,1,101300,0.024694,0.0135492,0.049878,1.10668,9.29951,0,0,,0.0700797,0.0780682,0.0225,0.08424
>     79,0,0,1,101300,0.0247093,0.0134078,0.0486224,1.10668,9.30527,0,0,,0.0700797,0.0791482,0.0225,0.08532
>     80,0,0,1,101300,0.0247246,0.0132665,0.0473667,1.10668,9.31104,0,0,,0.0700797,0.0802282,0.0225,0.0864
>     81,0,0,1,101300,0.0247399,0.0131251,0.0461111,1.10668,9.31681,0,0,,0.0700797,0.0813082,0.0225,0.08748
>     82,0,0,1,101300,0.024752,0.0130138,0.0451274,1.19429,9.32134,0,0,,0.0700797,0.0823882,0.0225,0.08856
>     83,0,0,1,101300,0.0247571,0.0129654,0.0447144,1.46563,9.32327,0,0,,0.0700797,0.0834682,0.0225,0.08964
>     84,0,0,1,101300,0.0247622,0.0129171,0.0443014,1.73697,9.3252,0,0,,0.0700797,0.0845482,0.0225,0.09072
>     85,0,0,1,101300,0.0247674,0.0128688,0.0438883,2.00831,9.32714,0,0,,0.0700797,0.0856282,0.0225,0.0918
>     86,0,0,1,101300,0.0247725,0.0128204,0.0434753,2.27965,9.32907,0,0,,0.0700797,0.0867082,0.0225,0.09288
>     87,0,0,1,101300,0.0247776,0.0127721,0.0430622,2.55099,9.33101,0,0,,0.0700797,0.0877882,0.0225,0.09396
>     88,0,0,1,101300,0.0247828,0.0127237,0.0426492,2.42654,9.33294,0,0,,0.0700797,0.0888682,0.0225,0.09504
>     89,0,0,1,101300,0.0247879,0.0126754,0.0422361,2.01953,9.33487,0,0,,0.0700797,0.0899482,0.0225,0.09612
>     90,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0910282,0.0225,0.0972
>     91,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0921082,0.0225,0.09828
>     92,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0931882,0.0225,0.09936
>     93,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0942682,0.0225,0.10044
>     94,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0953482,0.0225,0.10152
>     95,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0964282,0.0225,0.1026
>     96,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0975082,0.0225,0.10368
>     97,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0985882,0.0225,0.10476
>     98,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.0996682,0.0225,0.10584
>     99,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.100748,0.0225,0.10692
>     100,0,0,0,0,0,0,0,0,0,0,0,,0.0700797,0.101828,0.0225,0.108
>     sophia-nef-bash-3.2$
> 
>     > -Ken
>     >
>     >
>     > On 10/15/09 9:45 AM, "Stephen Wornom" <stephen.wornom at sophia.inria.fr>
>     > wrote:
>     >
>     >     Moreland, Kenneth wrote:
>     >     > Use “Save Data”. It is the icon right next to “Open” on the
>     toolbar.
>     >     > It is also under the File menu.
>     >     >
>     >     save data works it is difficult to extract the values from the csv
>     >     file.
>     >
>     >     It possible to write the data is a simple text format like x,
>     >     pressure,
>     >     ... ?
>     >     To use with say gnuplot.
>     >     Hope my question is clear.
>     >     Thanks,
>     >     Stephen
>     >
>     >     --
>     >     stephen.wornom at sophia.inria.fr
>     >     2004 route des lucioles - BP93
>     >     Sophia Antipolis
>     >     06902 CEDEX
>     >
>     >     Tel: 04 92 38 50 54
>     >     Fax: 04 97 15 53 51
>     >
>     >
>     >
>     >
>     > **** Kenneth Moreland
>     > *** Sandia National Laboratories
>     > ***********
>     > *** *** *** email: kmorel at sandia.gov
>     > ** *** ** phone: (505) 844-8919
>     > *** web: http://www.cs.unm.edu/~kmorel
>     <http://www.cs.unm.edu/%7Ekmorel>
>     >
>     > ------------------------------------------------------------------------
>     >
>     > _______________________________________________
>     > Powered by 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
>     >
>     > Follow this link to subscribe/unsubscribe:
>     > http://www.paraview.org/mailman/listinfo/paraview
>     >  
> 
> 
>     --
>     stephen.wornom at sophia.inria.fr
>     2004 route des lucioles - BP93
>     Sophia Antipolis
>     06902 CEDEX
>                    
>     Tel: 04 92 38 50 54
>     Fax: 04 97 15 53 51
> 
> 
> 
> 
>    ****      Kenneth Moreland
>     ***      Sandia National Laboratories
> ***********  
> *** *** ***  email: kmorel at sandia.gov
> **  ***  **  phone: (505) 844-8919
>     ***      web:   http://www.cs.unm.edu/~kmorel
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Powered by 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
> 
> Follow this link to subscribe/unsubscribe:
> http://www.paraview.org/mailman/listinfo/paraview



More information about the ParaView mailing list