xbitinfo.bitround.xr_bitround#
- xbitinfo.bitround.xr_bitround(da, keepbits)[source]#
Apply bitrounding based on keepbits from
xbitinfo.xbitinfo.get_keepbits()
forxarray.Dataset
orxarray.DataArray
wrappingnumcodecs.bitround
- Parameters:
da (
xarray.DataArray
orxarray.Dataset
) – Input data to bitroundkeepbits (
int
,dict
of{str: int}
,xarray.DataArray
orxarray.Dataset
) – How many bits to keep as int. Fails if dict orxarray.Dataset
and key or variable not present.
- Returns:
da_bitrounded (
xarray.DataArray
orxarray.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)