# PlotOverLine for specific time step

**URL:** https://discourse.paraview.org/t/plotoverline-for-specific-time-step/4675
**Category:** ParaView Support
**Created:** [June 24, 2020, 10:43pm UTC](https://discourse.paraview.org/t/plotoverline-for-specific-time-step/4675 "2020-06-24T22:43:03Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jrobbin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/a8b319/32.png) [@jrobbin](https://discourse.paraview.org/u/jrobbin)
#### Post date: [June 24, 2020, 10:43pm UTC](https://discourse.paraview.org/t/plotoverline-for-specific-time-step/4675/1 "2020-06-24T22:43:03Z")

</div>

Hello,  
I’m trying to extract x-y data from a PlotOverLine in a Python script (below). I’m able to plot data from the zeroth step index, but I cannot figure out how to change the time step. The following still writes x-y data from the zeroth step index, but I would expect it to write data from step index 19. Any ideas?

```python
from paraview.simple import *

fileName = 'output_data/steps.pvd'
x0 = [-0.5, 0, 0]
x1 = [0.5, 0, 0]
variableName = 'Temperature'

# create a new 'PVD Reader'
stepspvd = PVDReader(FileName=fileName)

# create a new 'Extract Time Steps'
extractTimeSteps1 = ExtractTimeSteps(Input=stepspvd)
extractTimeSteps1.TimeStepIndices = [19]
extractTimeSteps1.TimeStepRange = [19, 19]

# create a new 'Plot Over Line'
plotOverLine1 = PlotOverLine(Input=extractTimeSteps1, Source='High Resolution Line Source')

# Properties modified on plotOverLine1
plotOverLine1.Tolerance = 2.22044604925031e-16

# Properties modified on plotOverLine1.Source
plotOverLine1.Source.Point1 = x0
plotOverLine1.Source.Point2 = x1

fetchData = paraview.servermanager.Fetch(plotOverLine1)
pointData = fetchData.GetPointData()
fieldData = pointData.GetArray(variableName)
posData = pointData.GetArray('arc_length')
y_Data = [fieldData.GetValue(i) for i in range(fieldData.GetSize())]
x_Data = [posData.GetValue(i) for i in range(posData.GetSize())]
```

---

<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: [June 26, 2020, 2:50am UTC](https://discourse.paraview.org/t/plotoverline-for-specific-time-step/4675/2 "2020-06-26T02:50:09Z")

</div>

I can’t find the view in your script, but usually, time is changed by using `view.ViewTime = time`

---

<div class="post-metadata">

### Author: ![jrobbin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/a8b319/32.png) [@jrobbin](https://discourse.paraview.org/u/jrobbin)
#### Post date: [June 26, 2020, 2:48pm UTC](https://discourse.paraview.org/t/plotoverline-for-specific-time-step/4675/3 "2020-06-26T14:48:39Z")

</div>

Thanks for your response. I’m using Paraview to compute the PlotOverLine filter and then extract the result into a python array, so there’s not really a view that’s readily apparent. I tried using the trace functionality in Paraview to tease out how the time step is changed before writing to the filesystem, but there doesn’t appear to be a view there either. The function below is what I’m actually using, and it works great as long as the data of interest are in the first time step. I guess I could reorder the steps in the pvd file before loading, but that seems really hacky just to change a time step.

```python
#### import the simple module from the paraview
from paraview.simple import *

def getLineData(fileName, x0, x1, variableName):

  # create a new 'PVD Reader'
  stepspvd = PVDReader(FileName=fileName)

  # create a new 'Plot Over Line'
  plotOverLine1 = PlotOverLine(Input=stepspvd, Source='High Resolution Line Source')

  # Properties modified on plotOverLine1
  plotOverLine1.Tolerance = 2.22044604925031e-16

  # Properties modified on plotOverLine1.Source
  plotOverLine1.Source.Point1 = x0
  plotOverLine1.Source.Point2 = x1

  fetchData = paraview.servermanager.Fetch(plotOverLine1)
  pointData = fetchData.GetPointData()
  fieldData = pointData.GetArray(variableName)
  posData = pointData.GetArray('arc_length')
  y_Data = [fieldData.GetValue(i) for i in range(fieldData.GetSize())]
  x_Data = [posData.GetValue(i) for i in range(posData.GetSize())]

  return x_Data, y_Data
```

---

<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: [June 29, 2020, 3:41am UTC](https://discourse.paraview.org/t/plotoverline-for-specific-time-step/4675/4 "2020-06-29T03:41:36Z")

</div>

Then you can use `UpdatePipeline(time)` method on any source.

---

<div class="post-metadata">

### Author: ![jrobbin](https://discourse.paraview.org/letter_avatar_proxy/v4/letter/j/a8b319/32.png) [@jrobbin](https://discourse.paraview.org/u/jrobbin)
#### Post date: [June 29, 2020, 4:12am UTC](https://discourse.paraview.org/t/plotoverline-for-specific-time-step/4675/5 "2020-06-29T04:12:41Z")

</div>

Awesome. That did the trick. Thank you!
