Impressive!  I really like it.

Of course, it's extremely difficult to read, which is a drawback.  And it still doesn't handle the MPIIO case, so you need more code for that.  In the end, I don't think it will be less code.  I don't think it's likely that PETSc will add another output format any time soon.