Create a variable in the model component.
name (str) – Variable name.
data (np.ndarray) – Data array with a shape matching the
np.ndarray
dimensions (variable) –
dims (tuple[str]) – Tuple of strings specifying the dimension names.
Example
>>> c = Component() >>> arr = np.arange(5) >>> c.create_variable('foo', data=arr, dims=('index',)) >>> c['foo'] array([0, 1, 2, 3, 4])