xbitinfo.bitround.xr_bitround

Contents

xbitinfo.bitround.xr_bitround#

xbitinfo.bitround.xr_bitround(da, keepbits)[source]#

Apply bitrounding based on keepbits from xbitinfo.xbitinfo.get_keepbits() for xarray.Dataset or xarray.DataArray wrapping numcodecs.bitround

Parameters:
Returns:

da_bitrounded (xarray.DataArray or xarray.Dataset)

Example

>>> ds = xr.tutorial.load_dataset("air_temperature")
>>> info_per_bit = xb.get_bitinformation(ds, dim="lon")
>>> keepbits = xb.get_keepbits(info_per_bit, 0.99)
>>> ds_bitrounded = xb.xr_bitround(ds, keepbits)