Skip to content

Commit 9eec3dd

Browse files
authored
Support _ArrayLabel_ to attach names to dimension and columns, like Xarray
1 parent 0b54719 commit 9eec3dd

1 file changed

Lines changed: 20 additions & 1 deletion

File tree

JData_specification.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ JData: A general-purpose data annotation and interchange format
22
============================================================
33

44
- **Status of this document**: This document is currently under development.
5-
- **Copyright**: (C) Qianqian Fang (2011, 2015-2024) <q.fang at neu.edu>
5+
- **Copyright**: (C) Qianqian Fang (2011, 2015-2025) <q.fang at neu.edu>
66
- **License**: Apache License, Version 2.0
77
- **Format Version**: 1 (Draft 3.preview)
88
- **Abstract**:
@@ -631,6 +631,14 @@ Here, the array annotation keywords are defined below:
631631
order (as in MATLAB/FORTRAN); if missing, JData assumes the **row-major** order as default.
632632
* **`"_ArrayData_"`**: (required) a 1-D row vector (or a rectangular array, see below) storing the serialized
633633
array values, assuming the **row-major** element order if `"_ArrayOrder_"` is not specified.
634+
* **`"_ArrayLabel_"`**: (optional) must be a 1-D array with elements equal or less than the dimensions
635+
of the array, which is the length of `"_ArraySize"`. The first element defines the name or label, in
636+
the form of a string, for the 1st dimension, the 2nd element defines the name for the 2nd dimension,
637+
and so on. If the label of a dimension is an empty string `""`, it is undefined. If any of the element
638+
is an array, it further defines the names/labels for the array indices along this dimension. This array
639+
must be in the form `[["label1", column_start1, column_width1], ["label2", column_start2, ...]]`,
640+
where optional intergers `column_start_i` and `column_width_i` define the start and width, respectively,
641+
of the array indices that are associated with this label.
634642

635643
To facilitate the pre-allocation of the buffer for storage of the array in the parser, when
636644
an ordered object or map is used to store an array, it is recommended that the `"_ArrayType_"`,
@@ -667,6 +675,17 @@ In addition, the below two data types can be used as aliases to the `uint8` type
667675
If the above two aliases are used, a parser may optionally convert the enclosed
668676
`uint8` data to character or logical arrays (1-byte).
669677

678+
The following `"_ArrayLabel_"` example defines a 4D array with the first dimension with a name of `"x"` and length of 5;
679+
the 2nd dimension is named as `"y"` of length 5, the 3rd dimension as `"z"` of length 6, and the 1st column of the 4th
680+
dimension is `"t"`, and the 2nd column of the 4th dimension is `"v"`.
681+
```
682+
{
683+
"_ArrayType_": "double",
684+
"_ArraySize_": [5, 5, 6, 2],
685+
"_ArrayLabel_": ["x", "y", "z", [["t", 1], ["v", 2]]]
686+
"_ArrayData_": [...]
687+
}
688+
```
670689

671690
##### Complex-valued arrays
672691

0 commit comments

Comments
 (0)