Skip to content

Commit

Permalink
Proper dataset definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
franzpoeschel committed May 30, 2023
1 parent 3e4c506 commit 9413821
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 30 deletions.
67 changes: 67 additions & 0 deletions share/openPMD/json_schema/dataset_defs.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
["$defs"]

######################################
# n-dimensional datasets of any type #
######################################

[["$defs".any_type_recursive_array.anyOf]]
type = "array"
items.type = "number"

[["$defs".any_type_recursive_array.anyOf]]
type = "array"
items."$ref" = "#/$defs/any_type_recursive_array"

["$defs".any_type_dataset.properties]

datatype.enum = [
"CHAR",
"UCHAR",
"SCHAR",
"SHORT",
"INT",
"LONG",
"LONGLONG",
"USHORT",
"UINT",
"ULONG",
"ULONGLONG",
"FLOAT",
"DOUBLE",
"LONG_DOUBLE",
"CFLOAT",
"CDOUBLE",
"CLONG_DOUBLE",
"BOOL",
]
data."$ref" = "#/$defs/any_type_recursive_array"

######################################
# n-dimensional datasets of int type #
######################################

[["$defs".int_type_recursive_array.intOf]]
type = "array"
items.type = "integer"

[["$defs".int_type_recursive_array.intOf]]
type = "array"
items."$ref" = "#/$defs/int_type_recursive_array"

["$defs".int_type_dataset.properties]

datatype.enum = [
"CHAR",
"UCHAR",
"SCHAR",
"SHORT",
"INT",
"LONG",
"LONGLONG",
"USHORT",
"UINT",
"ULONG",
"ULONGLONG",
"BOOL",
]
data."$ref" = "#/$defs/int_type_recursive_array"
14 changes: 8 additions & 6 deletions share/openPMD/json_schema/particle_patches.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,19 @@ description = "Custom attributes allowed, no required attributes defined."
[properties.numParticles]
title = "numParticles"
description = "number of particles in this patch"

# todo: INT type dataset
"$ref" = "record_component.json"
allOf = [
{ "$ref" = "record_component.json" },
{ "$ref" = "dataset_defs.json#/$defs/int_type_dataset" },
]


[properties.numParticlesOffset]
title = "numParticles"
description = "offset within the one-dimensional records of the particle species where the first particle in this patch is stored"

# todo: INT type dataset
"$ref" = "record_component.json"
allOf = [
{ "$ref" = "record_component.json" },
{ "$ref" = "dataset_defs.json#/$defs/int_type_dataset" },
]


[properties.offset]
Expand Down
25 changes: 1 addition & 24 deletions share/openPMD/json_schema/record_component.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,30 +47,7 @@ required = ["data", "datatype"]
description = "An n-dimensional dataset containing the payload."
title = "Array dataset"

[allOf.oneOf.properties]

datatype.enum = [
"CHAR",
"UCHAR",
"SCHAR",
"SHORT",
"INT",
"LONG",
"LONGLONG",
"USHORT",
"UINT",
"ULONG",
"ULONGLONG",
"FLOAT",
"DOUBLE",
"LONG_DOUBLE",
"CFLOAT",
"CDOUBLE",
"CLONG_DOUBLE",
"BOOL",
]
# TODO: properly define this
data.type = "array"
"$ref" = "dataset_defs.json#/$defs/any_type_dataset"

########################
# Option 2.2: Constant #
Expand Down

0 comments on commit 9413821

Please sign in to comment.