scipp.transform_coords¶
- scipp.transform_coords(x, coords, graph, *, rename_dims=True, include_aliases=True, keep_intermediate=True, keep_inputs=True)¶
Compute new coords based on transformation of input coords.
- Parameters
x (Union[scipp._scipp.core.DataArray, scipp._scipp.core.Dataset]) – Input object with coords.
coords (Union[str, List[str]]) – Name or list of names of desired output coords.
graph (Dict[Union[str, Tuple[str, ...]], Union[str, Callable]]) –
A graph defining how new coords can be computed from existing coords. This may be done in multiple steps. The graph is given by a dict where:
Dict keys are str or tuple of str, defining the names of outputs generated by a dict value.
Dict values are str or a callable (function). If str, this is a synonym for renaming a coord. If a callable, it must either return a single variable or a dict of variables.
rename_dims – Rename dimensions if products of dimension coord are fully consumed and consumer consumes exectly one dimension coordinate. Default is True.
include_aliases – If True, aliases for coords defined in graph are included in the output. Default is False.
keep_intermediate – Keep attributes created as intermediate results. Default is True.
keep_inputs – Keep consumed input coordinates or attributes. Default is True.
- Returns
New object with desired coords. Existing data and meta-data is shallow-copied.
- Return type
Union[scipp._scipp.core.DataArray, scipp._scipp.core.Dataset]