zcollection.collection.Collection.add_variable#
- Collection.add_variable(variable)[source]#
Add a variable to the collection.
- Parameters:
- Raises:
ValueError – if the variable is already part of the collection, it doesn’t use the partitioning dimension or use a dimension that is not part of the dataset.
- Return type:
None
Example
>>> import zcollection >>> collection = zcollection.open_collection( ... "my_collection", mode="w") >>> new_variable = meta.Variable( ... name="my_variable", ... dtype=numpy.dtype("int16"), ... dimensions=("num_lines", "num_pixels"), ... fill_value=32267, ... attrs=(dataset.Attribute(name="my_attr", value=0), ), ... ) >>> collection.add_variable(new_variable)