itacart.serialization.data_tree_blob.read_data_cell

itacart.serialization.data_tree_blob.read_data_cell(blob, cell)[source]

The values of a cell, read in place.

A cell the blob holds answers with its own values. A cell inside a block – beneath a leaf above the observation resolution – answers with the block’s: the same value, or for a sum its even share. Any other cell answers with each variable’s absence.

Parameters:
Return type:

dict[str, Union[int, float, None]] | list[dict[str, Union[int, float, None]]]

Returns:

{name: value} with every pyramid variable and the level variables that have values at the cell’s resolution. A list of them, aligned with the cells, when more than one was given.

Raises:

Example

>>> n = DataVariable("n", "u32", op="sum", absent="zero", leaf_max=1)
>>> blob = encode_data_tree({"NE(0625/0451(3))": {"n": 1}}, [n])
>>> read_data_cell(blob, "NE(0625/0451(4))")
{'n': 0}