xbitinfo.xbitinfo.get_bitinformation#
- xbitinfo.xbitinfo.get_bitinformation(ds, dim=None, axis=None, label=None, overwrite=False, implementation='julia', **kwargs)[source]#
Wrap BitInformation.jl.bitinformation().
- Parameters:
ds (
xarray.Dataset
) – Input dataset to analysedim (
str
) – Dimension over which to apply mean. Only one of thedim
andaxis
arguments can be supplied. If nodim
oraxis
is given (default), the bitinformation is retrieved along all dimensions.axis (
int
) – Axis over which to apply mean. Only one of thedim
andaxis
arguments can be supplied. If nodim
oraxis
is given (default), the bitinformation is retrieved along all dimensions.label (
str
) – Label of the json to serialize bitinfo. When string, serialize results to disk into file{{label}}.json
to be reused later. Defaults toNone
.overwrite (
bool
) – IfFalse
, try using serialized bitinfo based on label; if true or label does not exist, run bitinformationimplementation (
str
) –- Bitinformation algorithm implementation. Valid options are
julia, the original implementation of julia in julia by Milan Kloewer
python, a copy of the core functionality of julia in python
kwargs –
to be passed to bitinformation:
masked_value: defaults to
NaN
(different tojulia
defaulting to"nothing"
), setNone
disable maskingmask: use
masked_value
insteadset_zero_insignificant (
bool
): defaults toTrue
(julia implementation) orFalse
(python implementation)confidence (
float
): defaults to0.99
- Returns:
info_per_bit (
xarray.Dataset
) – Information content perbit
andvariable
(anddim
)
Example
>>> ds = xr.tutorial.load_dataset("air_temperature") >>> xb.get_bitinformation(ds, dim="lon") <xarray.Dataset> Size: 1kB Dimensions: (bitfloat64: 64) Coordinates: * bitfloat64 (bitfloat64) <U3 768B '±' 'e1' 'e2' 'e3' ... 'm50' 'm51' 'm52' dim <U3 12B 'lon' Data variables: air (bitfloat64) float64 512B 0.0 0.0 0.0 ... 0.002848 0.0 0.0005048 Attributes: xbitinfo_description: bitinformation calculated by xbitinfo.get_bit... python_repository: https://github.com/observingClouds/xbitinfo julia_repository: https://github.com/milankl/BitInformation.jl reference_paper: http://www.nature.com/articles/s43588-021-001... xbitinfo_version: ... BitInformation.jl_version: ... >>> xb.get_bitinformation(ds) <xarray.Dataset> Size: 2kB Dimensions: (bitfloat64: 64, dim: 3) Coordinates: * bitfloat64 (bitfloat64) <U3 768B '±' 'e1' 'e2' 'e3' ... 'm50' 'm51' 'm52' * dim (dim) <U4 48B 'lat' 'lon' 'time' Data variables: air (dim, bitfloat64) float64 2kB 0.0 0.0 0.0 ... 0.0 0.0004506 Attributes: xbitinfo_description: bitinformation calculated by xbitinfo.get_bit... python_repository: https://github.com/observingClouds/xbitinfo julia_repository: https://github.com/milankl/BitInformation.jl reference_paper: http://www.nature.com/articles/s43588-021-001... xbitinfo_version: ... BitInformation.jl_version: ...