# extractor time steps

**URL:** https://discourse.paraview.org/t/extractor-time-steps/10671
**Category:** ParaView Support
**Created:** [November 3, 2022, 4:37pm UTC](https://discourse.paraview.org/t/extractor-time-steps/10671 "2022-11-03T16:37:17Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [November 3, 2022, 4:37pm UTC](https://discourse.paraview.org/t/extractor-time-steps/10671/1 "2022-11-03T16:37:17Z")

</div>

Even though programming animatins myself, I am still lost regarding the understanding of “time” in ParaView! But anyway, as long as things are running like I want, I can live with this ignorance… However, they are not!

I have a self-written filter that generates a table as output, one table per timestep. The number of timesteps can be chosen in the properties - let’s assume we make it 6, so the result will be 7 tables, corresponding to 0-1-2-3-4-5-6. For some reason, ParaView wants this to be in a range from 0 to 1, which makes it 0 - 0.16667 - 0.33333 etc. Not a problem, as long as I am getting my 7 tables!

Now I want to write them into a series of 7 CSV files - which looks like a good job for the CSV extractor - right?

And it works indeed - except for the fact that the extractor insists on generating 10 CSV files, no matter what I enter in “Start Time Step”, “End Time Step” and “Frequency”. These would correspond to time steps 0 - 0.11111 - 0.22222 - 0.33333 etc., and my required 7 tables are indeed among the 10 output tables, plus 3 that are duplicates.

My question is now: **How can I convince the extractor to extract exactly the 7 tables that I want to generate?** Or any other number - whatever is generated by the “table generating filter”?

As I said above: I have no clue what these time figures really do. I entered e.g. StartTimeStep=0, EndTimeStep=1 and Frequency=6 → generates 10 tables. Or I made it StartTimeStep=0, EndTimeStep=6, Frequency=1 → generates 7 tables, but they do not cover the full range… I am indeed a bit lost now!

Any helpful hint?

---

<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 7, 2022, 8:27am UTC](https://discourse.paraview.org/t/extractor-time-steps/10671/2 "2022-11-07T08:27:42Z")

</div>

> [@cobo](#):
>
> I have a self-written filter that generates a table as output, one table per timestep. The number of timesteps can be chosen in the properties - let’s assume we make it 6, so the result will be 7 tables, corresponding to 0-1-2-3-4-5-6.

How do you specify that ? Are you using information keys ?

---

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [November 9, 2022, 10:14am UTC](https://discourse.paraview.org/t/extractor-time-steps/10671/3 "2022-11-09T10:14:56Z")

</div>

What I found to be working for a “source” that generates a sequence of output was to do the following within the `RequestInformation` function:

```
for(int n = 0; n < GetNumberOfOutputPorts(); ++n)
{
    vtkInformation* info = outputVector->GetInformationObject(n);
    info->Set(vtkStreamingDemandDrivenPipeline::TIME_RANGE(), tRange, 2);
    info->Set(vtkStreamingDemandDrivenPipeline::TIME_STEPS(), Steps.data(), Steps.size());
    info->Set(CAN_HANDLE_PIECE_REQUEST(), 1);
}

```

tRange and Steps are both double vectors: tRange is always 0. and 1., and Steps would be something like 0., 0.1666, 0.3333, 0.5 etc. if I actually want it to be 0-1-2- etc. With this I am getting the desired result, but in the animation controls I see these values that I entered in the Steps array.

However, I found now that I could also write a CSV reader that does not even have a `RequestInformation` function and also in `RequestData` it does not fiddle around with anything like `UPDATE_TIME_STEP()` - and there exactly the thing is happening that I would like to achieve: if I have 7 input files, they will be shown as 0-1-2- etc.!

So it looks like I have to “spy” now a little bit how that latter “source” (reader) does the trick indeed.

From what I understand, ParaView actually wants to handle the two possible concepts of “time”: one being a series of objects corresponding to floating point values along a time axis (maybe even if they are not evenly spaced, like 0.0 - 0.1 - 0.25 - 0.3 etc.??) and maybe even interpolate between them if required. The other would be a sequence of objects that are simply numbered: 0 - 1 - 2 etc.

The latter is what best describes my use case, even if the “time objects” are corresponding to time indeed: mining period 1, mining period 2, etc. Even of they are a time sequence, it would not make sense to e.g. interpolate something like “mining period 1.5”.

---

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [November 9, 2022, 10:38am UTC](https://discourse.paraview.org/t/extractor-time-steps/10671/4 "2022-11-09T10:38:23Z")

</div>

Now I see what the “reader” is doing:

Within `RequestInformation`, after doing it’s job, this is what the information object contains:

> vtkAtgConstraintsReader::RequestInformation  
> Debug: Off  
> Modified Time: 321117  
> Reference Count: 1  
> Registered Events: (none)  
> FILE\_SERIES\_CURRENT\_FILE\_NUMBER: 0  
> DATA\_OBJECT: vtkTable(0x562d94bf8300)  
> FILE\_SERIES\_FIRST\_FILENAME: /home/cornelis/…0.csv  
> FILE\_SERIES\_NUMBER\_OF\_FILES: 8  
> PRODUCER: vtkPVCompositeDataPipeline(0x562d94be03b0) port 0

In other words: neither `TIME_RANGE()` nor `TIME_STEP()` are specified, but rather a `FILE_SERIES_NUMBER_OF_FILES` key that basically tells us the number of “steps” that we want to achieve.

Within `RequestData`, this is what we receive - for the first step (from the output vector information object):

> vtkAtgConstraintsReader::RequestData  
> Debug: Off  
> Modified Time: 391514  
> Reference Count: 2  
> Registered Events: (none)  
> CONSUMERS: vtkPVPostFilterExecutive(0x562d94aa61a0) port 0  
> UPDATE\_NUMBER\_OF\_GHOST\_LEVELS: 0  
> UPDATE\_NUMBER\_OF\_PIECES: 1  
> UPDATE\_TIME\_STEP: 0  
> TIME\_RANGE: 0 0  
> TIME\_STEPS: 0  
> UPDATE\_PIECE\_NUMBER: 0  
> FILE\_SERIES\_CURRENT\_FILE\_NUMBER: 0  
> DATA\_OBJECT: vtkTable(0x562d94bf8300)  
> FILE\_SERIES\_FIRST\_FILENAME: /home/cornelis/…0.csv  
> FILE\_SERIES\_NUMBER\_OF\_FILES: 8  
> PRODUCER: vtkPVCompositeDataPipeline(0x562d94be03b0) port 0

For the next steps, I see the following change:

> TIME\_RANGE: 1 1  
> TIME\_STEPS: 1

enz. with RANGE: 2 2, STEPS: 2, etc.

Is this actually what I need to simulate in order to obtain my desired result!?? I am already going to try…

---

<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 9, 2022, 11:15am UTC](https://discourse.paraview.org/t/extractor-time-steps/10671/5 "2022-11-09T11:15:43Z")

</div>

Yes, you need TIME\_RANGE and TIME\_STEPS

---

<div class="post-metadata">

### Author: ![cobo](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/c/f17d59/32.png) [@cobo](https://discourse.paraview.org/u/cobo)
#### Post date: [November 9, 2022, 2:02pm UTC](https://discourse.paraview.org/t/extractor-time-steps/10671/6 "2022-11-09T14:02:11Z")

</div>

Hmm - well: This I was doing, and this turns out to give me not the result that I always wanted to achieve! Which would be: Having timesteps counted like 0 - 1 - 2 etc…

Strange indeed! But…

…now I realized that I was in `RequestData` actually shooting into my own foot!

Some years ago I had written some code where I thought that this counting in integer numbers did not work, so I made it always fractions within a range from 0 to 1. Right now I simply copied that code, assuming that this is a must within ParaView: “time ranges have to be 0 to 1”.

Now, in order to check whether it would still work otherwise, I changed my code: In `RequestInformation` I made `TIME_RANGE` 0 4 and `TIME_STEPS` 0 1 2 3 4. Then in RequestData, I obtained an `UPDATE_TIME_STEP` that was indeed correctly giving me the required sequence: 0 1 2 3 4.

But then I had overlooked a line of code that I had put in “just to play safe”:

> reqTime = std::min(std::max(reqTime, 0.), 1.);

And **THIS** was then actually the very obvious reason why I could never get beyond 1!

(PS: From you I learned once what “rubber ducking” means - here was another example though… Anyway many thanks for playing the “rubber duck” for me again!)

---

<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 9, 2022, 2:13pm UTC](https://discourse.paraview.org/t/extractor-time-steps/10671/7 "2022-11-09T14:13:27Z")

</div>

Always a pleasure @cobo 🙂
