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:
InvalidIndexError – If a cell is malformed.
NonExistentCellError – If a cell names no cell.
ResolutionError – If a cell is finer than the observation resolution.
MalformedBlobError – If the frame is malformed.
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}