zcollection.dataset.Dataset.add_variable#

Dataset.add_variable(var, /, data=None)[source]#

Add a variable to the dataset.

Parameters:
  • var (meta.Variable) – The variable to add

  • data (ArrayLike[Any] | None) – The data to add to the variable. If not provided, the variable will be created with the default fill value.

Raises:

ValueError – If the variable added has dimensions that conflict with existing dimensions, or if the variable has dimensions not defined in the dataset.

Return type:

None