import dascore as dc
patch = dc.get_example_patch()
meta = patch.drop_data()
assert meta.shape == patch.shape
assert meta.dtype == patch.dtype
# Data make it a patch again.
assert isinstance(meta.to_patch(patch.data), dc.Patch)PatchMeta
PatchMeta(
coords: CoordManager = None,
dims: tuple[str, …] = None,
attrs: PatchAttrs = None,
dtype: Any = None,
backend: str = numpy,
source = None,
)
Everything a patch is apart from its data.
A PatchMeta states the coordinates, attributes, dtype and array backend of data it does not hold, so an operation can work out what a result would look like before anything is read or computed. to_patch gives it data, making the Patch it describes; new and update change the description and hand back another PatchMeta.
Parameters
| Parameter | Description |
|---|---|
| coords |
The coordinates, or dimensional labels, of the described data. Takes the same input as Patch.
|
| dims |
A sequence of dimension strings, in array order. Read from coordswhen it is a CoordManager.
|
| attrs |
Optional attributes (non-coordinate metadata) passed as a dict or PatchAttrs. |
| dtype | The dtype of the described data. |
| backend |
The array backend the data are in, asbackend_name spells it.Kept so an operation can resolve its kernel without the data. |
| source | Internal source metadata supplied by the I/O framework. |
Examples
Methods
| Name | Description |
|---|---|
| check_patch_attrs | Check for expected attributes. |
| check_patch_coords | Check that a patch has the required coordinates, else raise. |
| coords_from_df | Update non-dimensional coordinate of a patch using a dataframe. |
| drop_coords | Drop one or more non-dimensional coordinates. |
| equals | Whether another object describes the same data. |
| flat_dump | Return a flat summary dict for dataframe-oriented helpers. |
| get_axis | Get the axis corresponding to a Patch dimension. Raise error if not found. |
| get_coord | Get a managed coordinate from the patch. |
| get_patch_name | Return the name of the patch. |
| get_patch_names | Generates the default name of patch data. |
| update | Return a copy of the Patch with updated data, coords, dims, or attrs. |
| pipe | Pipe the patch to a function. |
| rename_coords | Rename coordinate of Patch. |
| set_dims | Set dimension to non-dimensional coordinate. |
| to_patch |
Return the patch this describes, holding data.
|
| update_attrs | Update patch attrs and return a new Patch. |
| update_coords | Update the coordinates of a patch. |