@@ -103,14 +103,23 @@ library::
103
103
Data type encoding
104
104
~~~~~~~~~~~~~~~~~~
105
105
106
- Simple data types are encoded within the array metadata resource as a string,
106
+ Simple data types are encoded within the array metadata as a string,
107
107
following the `NumPy array protocol type string (typestr) format
108
108
<http://docs.scipy.org/doc/numpy/reference/arrays.interface.html> `_. The format
109
- consists of 3 parts: a character describing the byteorder of the data (``< ``:
110
- little-endian, ``> ``: big-endian, ``| ``: not-relevant), a character code giving
111
- the basic type of the array, and an integer providing the number of bytes the
112
- type uses. The byte order MUST be specified. E.g., ``"<f8" ``, ``">i4" ``,
113
- ``"|b1" `` and ``"|S12" `` are valid data types.
109
+ consists of 3 parts:
110
+
111
+ * One character describing the byteorder of the data (``"<" ``: little-endian;
112
+ ``">" ``: big-endian; ``"|" ``: not-relevant)
113
+ * One character code giving the basic type of the array (``"b" ``: Boolean (integer
114
+ type where all values are only True or False); ``"i" ``: integer; ``"u" ``: unsigned
115
+ integer; ``"f" ``: floating point; ``"c" ``: complex floating point; ``"m" ``: timedelta;
116
+ ``"M" ``: datetime; ``"S" ``: string (fixed-length sequence of char); ``"U" ``: unicode
117
+ (fixed-length sequence of Py_UNICODE); ``"V" ``: other (void * – each item is a
118
+ fixed-size chunk of memory))
119
+ * An integer specifying the number of bytes the type uses.
120
+
121
+ The byte order MUST be specified. E.g., ``"<f8" ``, ``">i4" ``, ``"|b1" `` and
122
+ ``"|S12" `` are valid data type encodings.
114
123
115
124
Structured data types (i.e., with multiple named fields) are encoded as a list
116
125
of two-element lists, following `NumPy array protocol type descriptions (descr)
@@ -122,11 +131,17 @@ data type composed of three single-byte unsigned integers labelled "r", "g" and
122
131
Fill value encoding
123
132
~~~~~~~~~~~~~~~~~~~
124
133
125
- Not a Number (NaN) MUST be encoded as the JSON string "NaN" if used as the
126
- value of the "fill_value" field.
134
+ For simple floating point data types, the following table MUST be used to
135
+ encode values of the "fill_value" field:
136
+
137
+ ================= ===============
138
+ Value JSON encoding
139
+ ================= ===============
140
+ Not a Number ``"NaN" ``
141
+ Positive Infinity ``"Infinity" ``
142
+ Negative Infinity ``"-Infinity" ``
143
+ ================= ===============
127
144
128
- When decoding the "fill_value" field, the JSON string "NaN" MUST be decoded
129
- as Not a Number (NaN) if the dtype basic type is floating point ("f").
130
145
131
146
Chunks
132
147
~~~~~~
0 commit comments