openPMD / openPMD-api

:floppy_disk: C++ & Python API for Scientific I/O
https://openpmd-api.readthedocs.io
GNU Lesser General Public License v3.0
134 stars 51 forks source link

Series: Open with Placeholder for File-Ending/Backend #1561

Closed ax3l closed 4 months ago

ax3l commented 7 months ago

I realized that in many situations, generalized post-processing scripts, CI, etc., it would be cool if we could open a series of the kind

auto s = openPMD::Series("samples/git-sample/data%T.*", openPMD::Access::READ_ONLY);

or

auto s = openPMD::Series("samples/git-sample/data%T.%B", openPMD::Access::READ_ONLY);

without having to specify the backend. The logic would just match the first backend that fits the pattern.

In openPMD-viewer, we approach this by just specifying the directory in which files are placed, which has the downside that there cannot be multiple series in the same directory.

What do you think, @franzpoeschel ? :)

franzpoeschel commented 6 months ago

This recently came up also in PIConGPU where it's annoying in post-processing scripts to pass the used extension, CC @PrometheusPi. Implementation-wise I'd say this is doable, but can become finnicky in the details. Would this also work?

auto s = openPMD::Series("samples/git-sample/data%T.%E", openPMD::Access::READ_ONLY);

%E for extension is probably a bit clearer, no?