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
refactor xb.get_keepbits
with xarray
#100
Conversation
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
for more information, see https://pre-commit.ci
I currently get an error when trying import xbitinfo as xb
import xarray as xr
ds = xr.tutorial.load_dataset("eraint_uvz")
info_per_bit = xb.get_bitinformation(ds, dim="longitude")
keepbits = xb.get_keepbits(info_per_bit, [0.999, 1.]) Seems like |
I think refactoring this function would be great. I probably would prefer to split this function into smaller functions to have a better overview. |
9c1ef62
to
9da0b70
Compare
434c574
to
d706083
Compare
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great now! Thanks for also adding the tests! LGTM.
I thought this PR would be more readable and faster because of more
xarray
operations and less looping, but I was so wrong on speed and also readability didnt improve that much:The only thing it does is saving us a few lines of code... @observingClouds do you think it is useful. I'm ready to close this PR without merge also.
New:
get_keepbits
now works on multi-dim inputs