# Custom Filenamesuffix (from list) in SaveData using pvbatch

**URL:** https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707
**Category:** ParaView Support
**Created:** [November 3, 2020, 9:23pm UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707 "2020-11-03T21:23:01Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![kirit\_101](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@kirit\_101](https://discourse.paraview.org/u/kirit_101)
#### Post date: [November 3, 2020, 9:23pm UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/1 "2020-11-03T21:23:01Z")

</div>

I have a time series dataset, I want to save slice data using SaveData method. I was able to do that using below code in pvbatch:

> SaveData(File\_to\_Save,  
> proxy=slice1,  
> WriteTimeSteps=1,  
> Filenamesuffix=‘\_%d’,  
> CellDataArrays=[‘IDREG’, ‘AREA\_X-’, ‘AREA\_X+’, ‘AREA\_Y-’, ‘AREA\_Y+’, ‘AREA\_Z-’, ‘AREA\_Z+’, ‘DENSITY’, ‘PRESSURE’, ‘TEMPERATURE’, ‘TOTAL\_PRESSURE’, ‘VOLUME’, ‘TKE’, ‘YPLUS’, ‘XCEN’, ‘VELOCITY’],  
> Precision=8,  
> UseScientificNotation=1,  
> FieldAssociation=‘Cell Data’, # for cell data  
> AddMetaData=0)

This works fine, However data file is saved as slice1\_0.txt , slice1\_1.txt … . I want to add time series name as suffix (like slice1\_\<time\_step\>.txt , slice1\_\<time\_step\>.txt …) , to do so I have created a a list using bleow code:

```
time_step = sCR_Data.TimestepValues
time_step = list(time_step)

```

Now I have a list of time series which i want to use as suffix of my filename. What is the best way ?

So far I have tried using typical python tricks %s and {}.format(time\_step). None of them are working.

---

<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: [November 4, 2020, 8:27am UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/2 "2020-11-04T08:27:43Z")

</div>

Do you mean time value ? This is not supported, however you could store the time values within your data.

---

<div class="post-metadata">

### Author: ![kirit\_101](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@kirit\_101](https://discourse.paraview.org/u/kirit_101)
#### Post date: [November 4, 2020, 2:12pm UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/3 "2020-11-04T14:12:20Z")

</div>

Yes, I want time step value as my filename suffix

---

<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: [November 4, 2020, 2:17pm UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/4 "2020-11-04T14:17:56Z")

</div>

not supported afaik.

---

<div class="post-metadata">

### Author: ![kirit\_101](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@kirit\_101](https://discourse.paraview.org/u/kirit_101)
#### Post date: [November 4, 2020, 2:38pm UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/5 "2020-11-04T14:38:05Z")

</div>

Thanks @mwestphal.

Do you think it will be a good candidate for future development ?

---

<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: [November 5, 2020, 9:50am UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/6 "2020-11-05T09:50:37Z")

</div>

Not as trivial as it may seem, but not a bad idea overall. You may want to open an issue on gitlab  
[https://gitlab.kitware.com/paraview/paraview/-/issues](https://gitlab.kitware.com/paraview/paraview/-/issues)

---

<div class="post-metadata">

### Author: ![kirit\_101](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@kirit\_101](https://discourse.paraview.org/u/kirit_101)
#### Post date: [November 12, 2020, 8:02pm UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/7 "2020-11-12T20:02:53Z")

</div>

Hi Mathieu:  
I realized one thing when I execute python script using pvbatch from terminal to add time (as column) to my save data Time is not added to the file. This is the code I am using :

> SaveData(File\_to\_Save,  
> proxy=slice1,  
> CellDataArrays=[‘IDREG’, ‘AREA\_X-’, ‘AREA\_X+’, ‘AREA\_Y-’, ‘AREA\_Y+’, ‘AREA\_Z-’, ‘AREA\_Z+’, ‘DENSITY’, ‘PRESSURE’, ‘TEMPERATURE’, ‘TOTAL\_PRESSURE’, ‘VOLUME’, ‘TKE’, ‘YPLUS’, ‘XCEN’, ‘VELOCITY’],  
> Precision=8,  
> UseScientificNotation=1,  
> FieldAssociation=‘Cell Data’, # for cell data  
> AddMetaData=0,  
> AddTime=1)

However, If I execute this code from Paraview Python Shell, then it adds Time Column at the beginning. I have tried this both in Paraview 5.8.1 and Paraview 5.9.0.

Is this a bug ? or meant to be like this?

---

<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: [November 13, 2020, 8:54am UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/8 "2020-11-13T08:54:30Z")

</div>

Looks like an oversight, you may want to open an issue with steps to reproduce.

---

<div class="post-metadata">

### Author: ![kirit\_101](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/k/b19c9b/32.png) [@kirit\_101](https://discourse.paraview.org/u/kirit_101)
#### Post date: [November 13, 2020, 4:09pm UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/9 "2020-11-13T16:09:40Z")

</div>

Thanks @mwestphal.

I have opened an issue.

[https://gitlab.kitware.com/paraview/paraview/-/issues/20331](https://gitlab.kitware.com/paraview/paraview/-/issues/20331)

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [December 4, 2020, 8:47am UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/10 "2020-12-04T08:47:10Z")

</div>

I came here looking for a way to add timesteps as filename suffixes as well. Your idea to store the time values within my data would help for now. How can i achieve this?

I have a contour filter and need the points over time with time data to calculate dimension of my contour over time and plot these. So far everything works (using python) except time data.

Any help is appreciated!

---

<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: [December 4, 2020, 9:09am UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/11 "2020-12-04T09:09:04Z")

</div>

Juste create a .pvd file similar to this one:

[medTime.pvd](https://discourse.paraview.org/uploads/short-url/2aOr44q7S9DZBTaz1t5dCP6EboM.pvd) (675 Bytes)

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [December 4, 2020, 9:34am UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/12 "2020-12-04T09:34:43Z")

</div>

Thanks for your answer. Sadly it doesn’t help yet.  
I will have thousands of timesteps (cfd data, openfoam) and the files will already be loaded accordingly into paraview (using OpenFOAMReader). So I don’t have any vtk files.

I can use AnnotateTime filter to get the current time value. How can I add this information to spreadsheet of the contourfilter and save both?

---

<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: [December 4, 2020, 9:41am UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/13 "2020-12-04T09:41:01Z")

</div>

You can use the python calculator for that. Juste add an array with the “time\_value” expression.

---

<div class="post-metadata">

### Author: ![Terry](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/t/b9e5f3/32.png) [@Terry](https://discourse.paraview.org/u/Terry)
#### Post date: [December 4, 2020, 9:41am UTC](https://discourse.paraview.org/t/custom-filenamesuffix-from-list-in-savedata-using-pvbatch/5707/14 "2020-12-04T09:41:25Z")

</div>

Than you! I will try that.

Works perfect! Have a nice day!
