# Exporting a vector field to a csv file

**URL:** https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780
**Category:** ParaView Support
**Created:** [July 8, 2020, 10:23am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780 "2020-07-08T10:23:32Z")
**Posts on this page:** 16
**Page:** 1

<div class="post-metadata">

### Author: ![ohad.mishael](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohad.mishael](https://discourse.paraview.org/u/ohad.mishael)
#### Post date: [July 8, 2020, 10:23am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/1 "2020-07-08T10:23:32Z")

</div>

Hello,  
I have a field with 500 vectors and I would like to export the (X,Y,Z) of the vectors to a csv file.  
pic of the vectors:

 ![asdasd](https://discourse.paraview.org/uploads/default/original/2X/a/a9dafcce80b08a73ce1f04ced7fe23eb6259699e.jpeg)

When i do File-\> Save Data -\> “file.csv”, I get a csv file that looks like this:  
 ![image](https://discourse.paraview.org/uploads/default/original/2X/0/073cc65d0f85278dc30e78c315fdb9e768fa5a1e.png)

One problem is that the file has 15470 rows.  
But the main problem is that the (X,Y,Z) beggining and ending aren’t the same as the data is Paraview.  
what can I do to get the real points? Or maybe I am reading the data wrong in the CSV file?

I am uploading the csv file so whoever wants to give it a try is welcome.

Thank you, Ohad

[asd.csv](https://discourse.paraview.org/uploads/short-url/dGf01mk8PN9LGt9jPkaffLY17Ap.csv) (675.2 KB)

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 8, 2020, 11:13am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/2 "2020-07-08T11:13:09Z")

</div>

Are you exporting the results of the glyph filter ?  
Can you share your original data ?

---

<div class="post-metadata">

### Author: ![ohad.mishael](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohad.mishael](https://discourse.paraview.org/u/ohad.mishael)
#### Post date: [July 8, 2020, 11:16am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/3 "2020-07-08T11:16:25Z")

</div>

Yes the glyph filter.  
The files are huge (over 1gb), I can try and send you them if you want

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 8, 2020, 11:17am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/4 "2020-07-08T11:17:36Z")

</div>

You want to export the output of the reader, not the glyph filter.

---

<div class="post-metadata">

### Author: ![ohad.mishael](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohad.mishael](https://discourse.paraview.org/u/ohad.mishael)
#### Post date: [July 8, 2020, 11:21am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/5 "2020-07-08T11:21:35Z")

</div>

And how do I do that? I tried threw the python shell and it didn’t work

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 8, 2020, 11:24am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/6 "2020-07-08T11:24:23Z")

</div>

Please share a screenshot of ParaView (including the interface and pipeline browser) just before you export.

---

<div class="post-metadata">

### Author: ![ohad.mishael](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohad.mishael](https://discourse.paraview.org/u/ohad.mishael)
#### Post date: [July 8, 2020, 11:33am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/7 "2020-07-08T11:33:30Z")

</div>

![image.jpg](https://discourse.paraview.org/uploads/default/original/2X/2/2c415dd1d26f33efe10cc2546bcd4dacde45df7d.jpeg)

This is the paraview screen.

 ![image.jpg](https://discourse.paraview.org/uploads/default/original/2X/b/b3ba41e6ca768fa740294da54cec50fd104404ca.jpeg)

This is an error I get when i try to export.  
When i saved the data i did save data, not export

‫בתאריך יום ד׳, 8 ביולי 2020 ב-14:24 מאת ‪Mathieu Westphal (Kitware) via ParaView‬‏ \<‪[noreply@discourse.paraview.org](mailto:noreply@discourse.paraview.org)‬‏\>:‬

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 8, 2020, 11:36am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/8 "2020-07-08T11:36:06Z")

</div>

- Click on the extract subset filter in the pipeline browser
- File -\> SaveData -\> .csv -\> OK
- You csv file should be ok.

---

<div class="post-metadata">

### Author: ![ohad.mishael](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohad.mishael](https://discourse.paraview.org/u/ohad.mishael)
#### Post date: [July 8, 2020, 11:42am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/9 "2020-07-08T11:42:56Z")

</div>

I did it and I got a csv file with only 3 columns. How does this represent the vectors?

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 8, 2020, 11:44am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/10 "2020-07-08T11:44:52Z")

</div>

Hard to say. Please share you original file and what you are trying to achieve exactly.

---

<div class="post-metadata">

### Author: ![ohad.mishael](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohad.mishael](https://discourse.paraview.org/u/ohad.mishael)
#### Post date: [July 8, 2020, 11:50am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/11 "2020-07-08T11:50:41Z")

</div>

The original files are over 2gb and it will be hard for me to share them with you.

I have a raw file (.raw) from an experiment I have done. I loaded it in Paraview with a python script (I’ll share here) and i can see the vectors (in the image I sent).  
My goal is to have a csv file with (x, y, z) beginning and ending or with an angel and length.

[glyphTrace.py](https://discourse.paraview.org/uploads/short-url/dEtvI4Ww1n1fHU4u9IWHTyOImkW.py) (51.9 KB)

---

<div class="post-metadata">

### Author: ![ohad.mishael](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohad.mishael](https://discourse.paraview.org/u/ohad.mishael)
#### Post date: [July 8, 2020, 11:52am UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/12 "2020-07-08T11:52:01Z")

</div>

[https://drive.google.com/drive/folders/1GfnFQNmBeK6KH7qiGwXNVXyY9HQ2aXid?usp=sharing](https://drive.google.com/drive/folders/1GfnFQNmBeK6KH7qiGwXNVXyY9HQ2aXid?usp=sharing)

the files i import (the raw file) is here

‫בתאריך יום ד׳, 8 ביולי 2020 ב-14:50 מאת ‪Ohad Mishael‬‏ \<‪[ohad.mishael@mail.huji.ac.il](mailto:ohad.mishael@mail.huji.ac.il)‬‏\>:‬

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 8, 2020, 12:22pm UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/13 "2020-07-08T12:22:20Z")

</div>

> My goal is to have a csv file with (x, y, z) beginning and ending or with an angel and length.

So here what you need to do :

- Open your file
- Extract the subset your are interested in using ExtractSubset, apply
- Add an AppendDataset filter, Apply
- Add a calculator filter to compute the angle of the vector, Apply
- Add a calculator filter to compute the length of the vector, Apply
- Add a PassArray filter to remove the arrays you are not interested in
- File → SaveData → csv

This should create the file you are looking for.

---

<div class="post-metadata">

### Author: ![ohad.mishael](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/o/cab0a1/32.png) [@ohad.mishael](https://discourse.paraview.org/u/ohad.mishael)
#### Post date: [July 8, 2020, 12:57pm UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/14 "2020-07-08T12:57:05Z")

</div>

I’m not sure what you mean when you say how to compute angle and length of vector

---

<div class="post-metadata">

### Author: ![mwestphal](https://discourse.paraview.org/user_avatar/discourse.paraview.org/mwestphal/32/17_2.png) [@mwestphal](https://discourse.paraview.org/u/mwestphal)
#### Post date: [July 8, 2020, 12:59pm UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/15 "2020-07-08T12:59:36Z")

</div>

This is for you to define what you mean by that in your original message.  
It may be something like that : [https://www.intmath.com/vectors/7-vectors-in-3d-space.php](https://www.intmath.com/vectors/7-vectors-in-3d-space.php)

---

<div class="post-metadata">

### Author: ![wascott](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/w/8e8cbc/32.png) [@wascott](https://discourse.paraview.org/u/wascott)
#### Post date: [July 8, 2020, 4:28pm UTC](https://discourse.paraview.org/t/exporting-a-vector-field-to-a-csv-file/4780/16 "2020-07-08T16:28:14Z")

</div>

In the File -\> Save Data -\> csv -\> there is a Choose Arrays To Write option. Now, you get to output whatever you want. Thus, no need for the Pass Arrays filter.
