strong_data_id

function of dascore.utils.identity source

strong_data_id(
    patch ,
)-> ‘str’

Return the id of the content a patch holds.

A hash of what the patch holds: the data (and mask), the dims, every coordinate’s id and the dims it rides, and every attribute but the ids and history. It costs a read of every byte.

Parameters

Parameter Description
patch The patch to hash. Metadata, and object, record and
extended-precision data are refused: none has bytes which are
exactly its content.
Note

Nothing is written to the patch; pin_id does that. Called on its own this tells a caller that the weak id a patch carries now names the same array as this strong one.

Examples

import dascore as dc
from dascore.utils.identity import strong_data_id

patch = dc.get_example_patch()
# The content, and only the content: an id is not part of its own hash.
renamed = patch.update_attrs(data_id="abc")
assert strong_data_id(patch) == strong_data_id(renamed)