Skip to content

Iterate readIterations/read_iterations Multiple Times #1418

Open
@ax3l

Description

@ax3l

Describe the bug
Currently, read_iterations() cannot be looped multiple times.
Error message:

openpmd_api.openpmd_api_cxx.ErrorWrongAPIUsage:
  Wrong API usage: Trying to call Series::readIterations() on a (partially) read Series.

This is a bit unusual, since it should start over on the same open series, at least in regular/random access mode (non-streaming.)

To Reproduce
Python:

import openpmd_api as io

# ...
series = io.Series(filename, io.Access_Type.read_only)

# start-to-end read:
for count, iteration in enumerate(series.read_iterations()):
    pass

# another start-to-end read:
for count, iteration in enumerate(series.read_iterations()):
    pass

Expected behavior
Usually in Python on generators/iterators, one should start iterations over when reading files that way.

Software Environment

  • version of openPMD-api: 0.15.0 & 0.15.1
  • installed openPMD-api via: conda
  • operating system: Linux
  • machine: any
  • name and version of Python implementation: any
  • version of HDF5: hdf5 1.12.2 (nompi_ha7af310_101)
  • version of ADIOS1: N/A
  • version of ADIOS2: N/A
  • name and version of MPI: none

Additional context
First seen by @s-sajid-ali.

https://github.com/fnalacceleratormodeling/synergia2/blob/231d3dff97c0a2bb64db49584c626ec15f7b24b4/src/analysis_tools/diag_plot_openpmd.py

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions