Get the range of last timestep

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:

# 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

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

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