Skip to content

Commit

Permalink
convert dtype to str for saving to json
Browse files Browse the repository at this point in the history
  • Loading branch information
observingClouds committed Jun 24, 2023
1 parent 1a454bd commit 6597166
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xbitinfo/xbitinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def dict_to_dataset(info_per_bit):
"""Convert keepbits dictionary to :py:class:`xarray.Dataset`."""
dsb = xr.Dataset()
for v in info_per_bit.keys():
dtype = info_per_bit[v]["dtype"]
dtype = np.dtype(info_per_bit[v]["dtype"])
dim = info_per_bit[v]["dim"]
dim_name = f"bit{dtype}"
dsb[v] = xr.DataArray(
Expand Down Expand Up @@ -284,7 +284,7 @@ def _jl_get_bitinformation(ds, var, axis, dim, kwargs={}):
)
info_per_bit["dim"] = dim
info_per_bit["axis"] = axis_jl - 1
info_per_bit["dtype"] = ds[var].dtype
info_per_bit["dtype"] = str(ds[var].dtype)
return info_per_bit


Expand Down Expand Up @@ -320,7 +320,7 @@ def _py_get_bitinformation(ds, var, axis, dim, kwargs={}):
info_per_bit["bitinfo"] = pb.bitinformation(X, axis=axis).compute()
info_per_bit["dim"] = dim
info_per_bit["axis"] = axis
info_per_bit["dtype"] = ds[var].dtype
info_per_bit["dtype"] = str(ds[var].dtype)
return info_per_bit


Expand Down

0 comments on commit 6597166

Please sign in to comment.