Skip to content

Commit

Permalink
Add byte string array and float128 max value to sample HDF5 file
Browse files Browse the repository at this point in the history
  • Loading branch information
axelboc committed Feb 1, 2024
1 parent ad84ba3 commit 3bfc2ce
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 19 deletions.
11 changes: 10 additions & 1 deletion create_h5_sample.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,11 @@ def print_h5t_class(dataset):
)

add_scalar(h5, "float128", np.float128(np.finfo(np.float128).smallest_normal))
add_array(h5, "float128", np.array([[0, 1, 2], [3, 4, 5]], np.float128))
add_array(
h5,
"float128",
np.array([[0, 1, 2], [3, 4, np.finfo(np.float128).max]], np.float128),
)

# === H5T_TIME ===

Expand All @@ -113,6 +117,11 @@ def print_h5t_class(dataset):
# === H5T_OPAQUE ===

add_scalar(h5, "byte_string", np.void(b"\x00\x11\x22"))
add_array(
h5,
"byte_string",
np.array([np.void(b"\x00"), np.void(b"\x11"), np.void(b"\x22")]),
)
add_scalar(h5, "datetime64", np.void(np.datetime64("2019-09-22T17:38:30")))
add_scalar(h5, "datetime64_not-a-time", np.void(np.datetime64("NaT")))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -676,7 +676,7 @@ exports[`test file matches snapshot 1`] = `
2,
3,
4,
5,
null,
],
},
{
Expand Down Expand Up @@ -798,6 +798,27 @@ exports[`test file matches snapshot 1`] = `
},
"value": """,
},
{
"name": "byte_string_1D",
"rawType": {
"class": 5,
"dtype": "|V1",
"size": 1,
"tag": "",
},
"shape": [
3,
],
"type": {
"class": "Opaque",
"tag": "",
},
"value": [
"",
"",
""",
],
},
{
"name": "datetime64_scalar",
"rawType": {
Expand Down
58 changes: 41 additions & 17 deletions packages/h5wasm/src/__snapshots__/h5wasm-api.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -885,6 +885,30 @@ exports[`test file matches snapshot 1`] = `
34,
],
},
{
"name": "byte_string_1D",
"rawType": {
"cset": -1,
"littleEndian": false,
"signed": false,
"size": 1,
"total_size": 3,
"type": 5,
"vlen": false,
},
"shape": [
3,
],
"type": {
"class": "Opaque",
"tag": "",
},
"value": Uint8Array [
0,
17,
34,
],
},
{
"name": "datetime64_scalar",
"rawType": {
Expand Down Expand Up @@ -1745,8 +1769,8 @@ exports[`test file matches snapshot 1`] = `
0,
0,
0,
80,
191,
72,
203,
18,
0,
],
Expand All @@ -1761,8 +1785,8 @@ exports[`test file matches snapshot 1`] = `
0,
0,
0,
160,
213,
152,
225,
18,
0,
],
Expand All @@ -1777,8 +1801,8 @@ exports[`test file matches snapshot 1`] = `
0,
0,
0,
184,
213,
176,
225,
18,
0,
],
Expand All @@ -1801,8 +1825,8 @@ exports[`test file matches snapshot 1`] = `
"class": "Reference",
},
"value": Uint8Array [
214,
91,
226,
92,
0,
0,
0,
Expand Down Expand Up @@ -2044,8 +2068,8 @@ exports[`test file matches snapshot 1`] = `
0,
0,
0,
72,
160,
40,
156,
18,
0,
],
Expand Down Expand Up @@ -2075,24 +2099,24 @@ exports[`test file matches snapshot 1`] = `
0,
0,
0,
184,
185,
176,
197,
18,
0,
2,
0,
0,
0,
176,
207,
14,
160,
65,
17,
0,
3,
0,
0,
0,
208,
224,
248,
227,
18,
0,
],
Expand Down

0 comments on commit 3bfc2ce

Please sign in to comment.