Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

different dtypes for xb.get_bitinformation(ds) fail #99

Closed
aaronspring opened this issue May 9, 2022 · 1 comment · Fixed by #101
Closed

different dtypes for xb.get_bitinformation(ds) fail #99

aaronspring opened this issue May 9, 2022 · 1 comment · Fixed by #101
Labels
bug Something isn't working

Comments

@aaronspring
Copy link
Collaborator

aaronspring commented May 9, 2022

  • xbitinfo version: 0.0.1

Description

  • different dtypes for xb.get_bitinformation(ds) fail
  • I thought we'd already covered this in
    def _get_bitinformation_kwargs_handler(da, kwargs):
    """Helper function to preprocess kwargs args of :py:func:`xbitinfo.xbitinfo.get_bitinformation`."""
    if "masked_value" not in kwargs:
    kwargs["masked_value"] = f"convert({str(da.dtype).capitalize()},NaN)"
    elif kwargs["masked_value"] is None:
    kwargs["masked_value"] = "nothing"
  • str(ds.z.dtype).capitalize() # Float32
  • str(ds.z64.dtype).capitalize() # Float64

What I Did

ds = xr.tutorial.load_dataset("eraint_uvz")
ds['z64']=ds.z.astype("float64") # add float64 var to existing float32

info_per_bit = xb.get_bitinformation(ds, dim="longitude") # fails
info_per_bit = xb.get_bitinformation(ds[["z"]], dim="longitude", masked_value="convert(Float32,NaN)") # works
info_per_bit = xb.get_bitinformation(ds[["z64"]], dim="longitude", masked_value="convert(Float64,NaN)") # works
@aaronspring aaronspring added the bug Something isn't working label May 9, 2022
@aaronspring
Copy link
Collaborator Author

the problem is kwargs is used for all vars...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant