# Get the range of last timestep

**URL:** https://discourse.paraview.org/t/get-the-range-of-last-timestep/13139
**Category:** ParaView Support
**Created:** [October 30, 2023, 1:11pm UTC](https://discourse.paraview.org/t/get-the-range-of-last-timestep/13139 "2023-10-30T13:11:59Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![RemDelaporteMathurin](https://discourse.paraview.org/user_avatar/discourse.paraview.org/remdelaportemathurin/32/12581_2.png) [@RemDelaporteMathurin](https://discourse.paraview.org/u/RemDelaporteMathurin)
#### Post date: [October 30, 2023, 1:11pm UTC](https://discourse.paraview.org/t/get-the-range-of-last-timestep/13139/1 "2023-10-30T13:11:59Z")

</div>

Hi all!

I’m trying to rescale a colourbar to force the minimum at zero.  
It seems I can only do this by setting both the minimum and maximum.  
However I do not know the maximum a priori and therefore cannot hardcode it.

I am doing the following:

```python
# create a new 'Xdmf3ReaderS'
mobile_concentrationxdmf = Xdmf3ReaderS(
    registrationName="mobile_concentration.xdmf",
    FileName=["./mobile_concentration.xdmf"],
)

# ----------------------------------------------------------------
# setup the visualization in view 'renderView1'
# ----------------------------------------------------------------

# show data from mobile_concentrationxdmf
mobile_concentrationxdmfDisplay = Show(
    mobile_concentrationxdmf, renderView1, "UnstructuredGridRepresentation"
)

animationScene1 = GetAnimationScene()
animationScene1.GoToLast()

# set scalar coloring
ColorBy(mobile_concentrationxdmfDisplay, ("POINTS", "mobile_concentration"))

# get min and max of Color
info = mobile_concentrationxdmf.GetDataInformation().DataInformation
arrayInfo = info.GetArrayInformation(
    "mobile_concentration", vtk.vtkDataObject.FIELD_ASSOCIATION_POINTS
)
min_conc, max_conc= arrayInfo.GetComponentRange(0)

# get color transfer function/color map for 'Color'
colorLUT = GetColorTransferFunction("mobile_concentration")

# Apply a preset using its name. Note this may not work as expected when presets have duplicate names.
colorLUT.ApplyPreset("Viridis (matplotlib)", True)
colorLUT.RescaleTransferFunction(0, max_conc)

op = GetOpacityTransferFunction("mobile_concentration")
op.RescaleTransferFunction(0, max_conc)

```

It works just fine for datasets that have only one time step, but here, even though I go to the last time step on the animation, `GetComponentRange` only returns the first timestep.  
Where should I select the last timestep?

Thanks in advance for the help!

Cheers  
Remi

---

<div class="post-metadata">

### Author: ![jourdain](https://discourse.paraview.org/user_avatar/discourse.paraview.org/jourdain/32/11_2.png) [@jourdain](https://discourse.paraview.org/u/jourdain)
#### Post date: [October 30, 2023, 4:43pm UTC](https://discourse.paraview.org/t/get-the-range-of-last-timestep/13139/2 "2023-10-30T16:43:50Z")

</div>

Just a guess, but you need to flush the pipeline, otherwise, the `animationScene1.GoToLast()` has no effect yet.

```python
mobile_concentrationxdmf.UpdatePipeline()
info = mobile_concentrationxdmf.GetDataInformation().DataInformation

```
