Skip to content

Commit

Permalink
fix json encoding (#178)
Browse files Browse the repository at this point in the history
  • Loading branch information
b8raoult authored Jan 21, 2025
1 parent a336b17 commit 376fdc4
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/anemoi/datasets/create/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,10 @@ def json_tidy(o):
)
return o.isoformat()

raise TypeError(repr(o) + " is not JSON serializable")
if isinstance(o, (np.float32, np.float64)):
return float(o)

raise TypeError(f"{repr(o)} is not JSON serializable {type(o)}")


def build_statistics_dates(dates, start, end):
Expand Down

0 comments on commit 376fdc4

Please sign in to comment.