Skip to content

Commit

Permalink
Merge pull request #15 from asfadmin/rew/fix-h5-returns
Browse files Browse the repository at this point in the history
Fix h5 type returns
  • Loading branch information
reweeden authored Aug 28, 2023
2 parents 86083c7 + 66e4d92 commit 4f0c1aa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions mandible/h5_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,12 @@ def read_file(self, file: str) -> None:


def normalize(node_val):
if isinstance(node_val, np.bool_):
return bool(node_val)
if isinstance(node_val, np.integer):
return int(node_val)
if isinstance(node_val, np.floating):
return float(node_val)
if isinstance(node_val, np.ndarray):
value = node_val.tolist()
if isinstance(value[0], bytes):
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mandible"
version = "0.3.1"
version = "0.3.2"
description = "A generic framework for writing satellite data ingest systems"
authors = ["Rohan Weeden <[email protected]>", "Matt Perry <[email protected]>"]
license = "APACHE-2"
Expand Down
4 changes: 4 additions & 0 deletions tests/test_h5_parser.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import json

import pytest

try:
Expand Down Expand Up @@ -78,3 +80,5 @@ def test_h5_parser_types(h5_test_file):
data.read_file(h5_test_file)

assert data == expected
# Check that types are JSON serializable
assert json.loads(json.dumps(data)) == expected

0 comments on commit 4f0c1aa

Please sign in to comment.