openPMD / openPMD-standard

:notebook: Open Standard for Particle-Mesh Data
http://www.openPMD.org
Creative Commons Attribution 4.0 International
78 stars 27 forks source link

No standard-conforming way to define a Series that only has meshes (resp. particles) in some iterations #253

Open franzpoeschel opened 3 years ago

franzpoeschel commented 3 years ago

Issue first noticed while working on this PR for the openPMD API. Quoting the technical files on meshesPath and particlesPath:

  • note: if this attribute is missing, the file is interpreted as if it contains no mesh records! If the attribute is set, the group behind it must exist! […]
  • note: if this attribute is missing, the file is interpreted as if it contains no particle records! If the attribute is set, the group behind it must exist!

Since both these attributes live at the root level of the hierarchy and cannot be defined specifically per iteration, this makes it impossible to have a Series where only some, but not all iterations contain meshes/particles. If I'm not mistaken, this holds true for file-based as well as group-based iteration layout. So, I suggest replacing

the group behind it must exist

with

the group behind it may or may not exist

Reading software would then need to check for group existence.

ax3l commented 3 years ago

Thank you for raising this. We introduced the clarification in openPMD 1.1 to ease readers, but the choice should indeed be considered a defect.

It's easier to check for existence at read time than the problem it introduces at write time. I am still thinking if we should also mak the attribute optional, which is clearer for purely mesh- or particle-containing series. This then means we need at read time two checks: attribute exists (y/n) - no means no meshes/particles in the series - and then value points to something existing (y/n).

franzpoeschel commented 3 years ago

This then means we need at read time two checks: attribute exists (y/n) - no means no meshes/particles in the series - and then value points to something existing (y/n).

So, a one-sided implication? Current rule: mesh group exists <-> meshesPath is set Your suggestion: mesh group exists -> meshesPath is set

If yes, sounds good with me.