decode_attrs#
- eoio.serialisation.attrs.decode_attrs(obj: T, *, sniff: bool = True, inplace: bool = False) T[source]#
Restore attributes previously encoded for serialisation.
Where an
eoio:attr_encodingmarker is present its codecs are used, giving an exact round trip. Attributes with no marker entry are sniffed instead, recognising only JSON objects/arrays and ISO-8601 datetimes.- Parameters:
obj – Dataset, DataArray or DataTree whose attributes should be decoded.
sniff – Whether to attempt best-effort decoding of unmarked attributes. Set
Falseto decode only what the marker describes.inplace – Whether to modify
objrather than a copy.
- Returns:
The object with decoded attributes, and the marker attribute removed.