to_patch

method of dascore.core.patch_meta.PatchMeta source

to_patch(
    self ,
    data ,
)-> ‘dc.Patch’

Return the patch this describes, holding data.

The inverse of drop_data: one takes a patch’s data away and keeps what described them, this gives that description its data back. The patch is of the class the metadata was dropped from, so a Patch subclass round-trips.

Parameters

Parameter Description
data The array this metadata describes. Its shape is checked against
the coords, as any patch’s is; its dtype and backend are not. A
patch’s are its data’s, so a description they contradict is
merely out of date – real() derives complex metadata from a
complex patch and computes a float array through here.

Examples

import dascore as dc
patch = dc.get_example_patch()
meta = patch.drop_data()
assert meta.to_patch(patch.data).equals(patch)