fields.mixins.components.FieldComponentCoreMixin.empty#
- classmethod FieldComponentCoreMixin.empty(grid: GridBase, axes: Sequence[str], *args, element_shape: Sequence[int] | None = None, buffer_class: Type[_SupFCCore] | None = None, buffer_registry: BufferRegistry | None = None, **kwargs) _SupFCCore [source]#
Create a component with an empty buffer.
This is a convenience constructor that builds a ones-initialized
FieldComponent
.- Parameters:
grid (
GridBase
) – The structured grid over which the field is defined.axes (
list
ofstr
) – The spatial axes of the underlying coordinate system over which the field is defined. This must be some subset of the axes available in the coordinate system of grid.*args – Additional positional arguments forwarded to the buffer constructor. The specific available args will depend on
buffer_class
andbuffer_registry
.element_shape (
tuple
ofint
, optional) – Shape of the element-wise data structure (e.g., vector or tensor dimensions). This does not include the spatial shape, which is fixed by the grid. The resulting buffer will have an overall shape of(*spatial_shape, *element_shape)
.buffer_class (
str
orBufferBase
, optional) –The buffer class to use for holding the data. This may be specified as a string, in which case the
buffer_registry
is queried for a matching class or it may be a specific buffer class.The relevant
*args
and**kwargs
arguments will be passed underlying buffer class’s.ones()
method.buffer_registry (
BufferRegistry
, optional) – Custom registry to use for resolving buffer class strings. By default, the standard registry is used.**kwargs – Additional keyword arguments forwarded to the buffer constructor (e.g., dtype, units).
- Returns:
A new field component with an empty buffer and defined over the specified grid and axes.
- Return type: