[WIP] Use JSON/TOML template for defining openPMD metadata in a config file#1277
Closed
franzpoeschel wants to merge 8 commits intoopenPMD:devfrom
Closed
[WIP] Use JSON/TOML template for defining openPMD metadata in a config file#1277franzpoeschel wants to merge 8 commits intoopenPMD:devfrom
franzpoeschel wants to merge 8 commits intoopenPMD:devfrom
Conversation
f10fc90 to
c63c06a
Compare
Contributor
Author
|
An openPMD dataset in TOML: [platform_byte_widths]
USHORT = 2
ULONG = 8
BOOL = 1
CLONG_DOUBLE = 32
LONGLONG = 8
CFLOAT = 8
CHAR = 1
DOUBLE = 8
CDOUBLE = 16
SHORT = 2
UCHAR = 1
FLOAT = 4
INT = 4
ULONGLONG = 8
UINT = 4
LONG = 8
LONG_DOUBLE = 16
[data]
[data.0]
[data.0.meshes]
[data.0.meshes.E]
[data.0.meshes.E.x]
datatype = "FLOAT"
data = [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0]
[data.0.meshes.E.x.attributes]
[data.0.meshes.E.x.attributes.unitSI]
value = 1.0
datatype = "DOUBLE"
[data.0.meshes.E.x.attributes.position]
value = [0.0]
datatype = "VEC_DOUBLE"
[data.0.meshes.E.attributes]
[data.0.meshes.E.attributes.timeOffset]
value = 0.0
datatype = "FLOAT"
[data.0.meshes.E.attributes.gridUnitSI]
value = 1.0
datatype = "DOUBLE"
[data.0.meshes.E.attributes.gridSpacing]
value = [1.0]
datatype = "VEC_DOUBLE"
[data.0.meshes.E.attributes.gridGlobalOffset]
value = [0.0]
datatype = "VEC_DOUBLE"
[data.0.meshes.E.attributes.unitDimension]
value = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
datatype = "ARR_DBL_7"
[data.0.meshes.E.attributes.geometry]
value = "cartesian"
datatype = "STRING"
[data.0.meshes.E.attributes.dataOrder]
value = "C"
datatype = "STRING"
[data.0.meshes.E.attributes.axisLabels]
value = ["x"]
datatype = "VEC_STRING"
[data.0.attributes]
[data.0.attributes.timeUnitSI]
value = 1.0
datatype = "DOUBLE"
[data.0.attributes.time]
value = 0.0
datatype = "DOUBLE"
[data.0.attributes.dt]
value = 1.0
datatype = "DOUBLE"
[attributes]
[attributes.softwareVersion]
value = "0.15.0-dev"
datatype = "STRING"
[attributes.software]
value = "openPMD-api"
datatype = "STRING"
[attributes.openPMDextension]
value = 0
datatype = "UINT"
[attributes.meshesPath]
value = "meshes/"
datatype = "STRING"
[attributes.iterationFormat]
value = "many_iterations_%T"
datatype = "STRING"
[attributes.iterationEncoding]
value = "fileBased"
datatype = "STRING"
[attributes.openPMD]
value = "1.1.0"
datatype = "STRING"
[attributes.date]
value = "2022-05-18 12:20:23 +0000"
datatype = "STRING"
[attributes.basePath]
value = "/data/%T/"
datatype = "STRING" |
0d475a5 to
1a23a03
Compare
Contributor
Author
|
This is now a simplified TOML openPMD template, created by [data]
[data.meshes]
[data.meshes.temperature]
extent = [5, 5]
datatype = "FLOAT"
[data.meshes.temperature.attributes]
timeOffset = 0.0
# Explicit datatype can still be used if needed
unitSI = {"value" = 1.0, "datatype" = "FLOAT"}
position = [0.0]
gridUnitSI = 1.0
gridSpacing = [1.0]
gridGlobalOffset = [0.0]
unitDimension = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
geometry = "cartesian"
dataOrder = "C"
axisLabels = ["x"]
[data.attributes]
timeUnitSI = 1.0
snapshot = 0
time = 0.0
dt = 1.0
[attributes]
softwareVersion = "0.15.0-dev"
software = "openPMD-api"
openPMDextension = 0
meshesPath = "meshes/"
iterationFormat = "/data"
iterationEncoding = "variableBased"
openPMD = "1.1.0"
date = "2022-05-19 11:55:07 +0000"
basePath = "/data"Differences to regular JSON/TOML openPMD datasets:
Template mode is also available in json: {
"attributes": {
"basePath": "/data",
"date": "2022-05-19 12:00:09 +0000",
"iterationEncoding": "variableBased",
"iterationFormat": "/data",
"meshesPath": "meshes/",
"openPMD": "1.1.0",
"openPMDextension": 0,
"software": "openPMD-api",
"softwareVersion": "0.15.0-dev"
},
"data": {
"attributes": {
"dt": 1,
"snapshot": 0,
"time": 0,
"timeUnitSI": 1
},
"meshes": {
"temperature": {
"attributes": {
"axisLabels": [
"x"
],
"dataOrder": "C",
"geometry": "cartesian",
"gridGlobalOffset": [
0
],
"gridSpacing": [
1
],
"gridUnitSI": 1,
"position": [
0
],
"timeOffset": 0,
"unitDimension": [
0,
0,
0,
0,
0,
0,
0
],
"unitSI": 1
},
"datatype": "FLOAT",
"extent": [
5,
5
]
}
}
}
}
|
1a23a03 to
656e740
Compare
Contributor
Author
|
Longer example: [data]
[data.particles]
[data.particles.e]
[data.particles.e.positionOffset]
[data.particles.e.positionOffset.z]
[data.particles.e.positionOffset.z.attributes]
value = 3.14
unitSI = 1.0
shape = [5, 5]
[data.particles.e.positionOffset.y]
[data.particles.e.positionOffset.y.attributes]
value = 3.14
unitSI = 1.0
shape = [5, 5]
[data.particles.e.positionOffset.x]
[data.particles.e.positionOffset.x.attributes]
value = 3.14
unitSI = 1.0
shape = [5, 5]
[data.particles.e.positionOffset.attributes]
unitDimension = [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
timeOffset = 0.0
[data.particles.e.position]
[data.particles.e.position.z]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.position.z.attributes]
unitSI = 1.0
[data.particles.e.position.y]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.position.y.attributes]
unitSI = 1.0
[data.particles.e.position.x]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.position.x.attributes]
unitSI = 1.0
[data.particles.e.position.attributes]
unitDimension = [1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
timeOffset = 0.0
[data.particles.e.particlePatches]
[data.particles.e.particlePatches.numParticlesOffset]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.particlePatches.numParticlesOffset.attributes]
unitSI = 1.0
[data.particles.e.particlePatches.numParticles]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.particlePatches.numParticles.attributes]
unitSI = 1.0
[data.particles.e.particlePatches.offset]
[data.particles.e.particlePatches.offset.z]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.particlePatches.offset.z.attributes]
unitSI = 1.0
[data.particles.e.particlePatches.offset.y]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.particlePatches.offset.y.attributes]
unitSI = 1.0
[data.particles.e.particlePatches.offset.x]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.particlePatches.offset.x.attributes]
unitSI = 1.0
[data.particles.e.particlePatches.offset.attributes]
unitDimension = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
[data.particles.e.particlePatches.extent]
[data.particles.e.particlePatches.extent.z]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.particlePatches.extent.z.attributes]
unitSI = 1.0
[data.particles.e.particlePatches.extent.y]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.particlePatches.extent.y.attributes]
unitSI = 1.0
[data.particles.e.particlePatches.extent.x]
extent = [5, 5]
datatype = "FLOAT"
[data.particles.e.particlePatches.extent.x.attributes]
unitSI = 1.0
[data.particles.e.particlePatches.extent.attributes]
unitDimension = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
[data.meshes]
[data.meshes.temperature]
extent = [5, 5]
datatype = "FLOAT"
[data.meshes.temperature.attributes]
timeOffset = 0.0
unitSI = 1.0
position = [0.0]
gridUnitSI = 1.0
gridSpacing = [1.0]
gridGlobalOffset = [0.0]
unitDimension = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
geometry = "cartesian"
dataOrder = "C"
axisLabels = ["x"]
[data.meshes.E]
[data.meshes.E.z]
extent = [5, 5]
datatype = "FLOAT"
[data.meshes.E.z.attributes]
unitSI = 1.0
position = [0.0]
[data.meshes.E.y]
extent = [5, 5]
datatype = "FLOAT"
[data.meshes.E.y.attributes]
unitSI = 1.0
position = [0.0]
[data.meshes.E.x]
extent = [5, 5]
datatype = "FLOAT"
[data.meshes.E.x.attributes]
unitSI = 1.0
position = [0.0]
[data.meshes.E.attributes]
timeOffset = 0.0
gridUnitSI = 1.0
gridSpacing = [1.0]
gridGlobalOffset = [0.0]
unitDimension = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
geometry = "cartesian"
dataOrder = "C"
axisLabels = ["x"]
[data.attributes]
timeUnitSI = 1.0
snapshot = 0
time = 0.0
dt = 1.0
[attributes]
softwareVersion = "0.15.0-dev"
particlesPath = "particles/"
software = "openPMD-api"
openPMDextension = 0
meshesPath = "meshes/"
iterationFormat = "/data"
iterationEncoding = "variableBased"
openPMD = "1.1.0"
date = "2022-05-19 15:26:37 +0000"
basePath = "/data" |
475be7b to
ee8bdf1
Compare
d32fff3 to
376bc2a
Compare
3ee509d to
a662865
Compare
Contributor
Author
|
Notes for myself on the recent reodering of commits: |
1db63f6 to
55b72f8
Compare
b07a2a8 to
a41c2c6
Compare
franzpoeschel
commented
Sep 15, 2022
src/RecordComponent.cpp
Outdated
| // throw error::WrongAPIUsage( | ||
| // "[RecordComponent] Must set specific datatype (Use " | ||
| // "resetDataset call)."); | ||
| // } |
Contributor
Author
There was a problem hiding this comment.
Note that this check was inactive up to now, since RecordComponentData::RecordComponentData initialized that field with Datatype::CHAR. Using an optional would make these things more obvious and avoid such pitfalls.
To be done in a different PR though
6 tasks
a41c2c6 to
c6a369c
Compare
0b26e4f to
cf5c134
Compare
cf5c134 to
7518036
Compare
7518036 to
d4fe5c3
Compare
d4fe5c3 to
94f2797
Compare
2db2d3a to
3133351
Compare
2b2bbb6 to
367798c
Compare
367798c to
c497fef
Compare
fb75b46 to
f0e2e21
Compare
8ed49ca to
57a5fb2
Compare
57a5fb2 to
771a644
Compare
1307f10 to
b5eecbb
Compare
b5eecbb to
2f6b7d1
Compare
Has the same implementation as JSON anyway, and it makes tests run into timeouts otherwise.
Contributor
Author
|
The relevant parts of this have been merged separately. The remainder can be closed as not planned. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Not relevant for next release
Idea: We already have a JSON backend, use an openPMD-conforming JSON dataset to define only metadata. With this, the configuration file will be just another openPMD dataset.
Then, add some functionality to initialize an empty Series from such a metadata file.
TODO:
templatemode to the JSON backend that (1) does not pre-fill datasets, (2) does not allow writing to datasetsintitializeFromTemplate()functionalitydatatypefield optionaldtypeandextentare requiredhttps://github.com/franzpoeschel/openPMD-api/compare/topic-json-short-modes..topic-json-template