Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSON/TOML arguments for all Series constructor arguments #1685

Open
franzpoeschel opened this issue Oct 14, 2024 · 1 comment
Open

JSON/TOML arguments for all Series constructor arguments #1685

franzpoeschel opened this issue Oct 14, 2024 · 1 comment
Labels
api: new additions to the API feature request

Comments

@franzpoeschel
Copy link
Contributor

Is your feature request related to a problem? If so, please describe.
#1584 introduced wildcards for filenames. This comes in handy, since it allows writing the main code independent from the backend which is then specified via JSON/TOML:

// main.cpp
int main() 
{
    // ...
    Series output("simData.%E", Access::CREATE, "@config.toml");
    // ...
}
# config.toml
backend = "adios2"
iteration_encoding = "variable_based"
# --> a file named simData.bp5 will be written

Or alternatively:

# config.toml
backend = "hdf5"
iteration_encoding = "group_based"

This makes it very easy to write openPMD-based output routines that can be configured at runtime by the user, without needing to write a parser for command line arguments or similar.

Problem: This falls short when trying to use file-based iteration encoding since JSON/TOML exposes no way to specify the %T expansion pattern. The logical consequence imo is to allow specifying everything in JSON/TOML that could be specified in the constructor.

Describe the solution you'd like

Series(
    std::string const& filepath, // default, can be overridden from JSON/TOML
    Access at, // default, can be overridden from JSON/TOML
    std::string const &json_toml);
file_base_name = "simData"
file_infix = "%T"
# --> will be put together as "simData_%T.%E"
# "infix" is optional, will default as %06T in file-based encoding, as empty otherwise
file_base_name = "simData"
file_extension = "bp"
iteration_encoding = "file_based"
# --> will be put together as "simData_%06T.bp"
@franzpoeschel franzpoeschel added api: new additions to the API feature request labels Oct 14, 2024
@franzpoeschel
Copy link
Contributor Author

Alternative easier fix: In group/variable-based encoding, erase _%06T and similar patterns from the specified filename. Add a JSON/TOML config option to suppress this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: new additions to the API feature request
Projects
None yet
Development

No branches or pull requests

1 participant