Insert a new data array into the field in place, preserving internal consistency.
Note that the field’s pre-existing Units attribute and _FillValue property will be overwritten with those attached to the new data array.
Parameters : |
|
---|---|
Returns : | None |
Examples
>>> f.dimension_sizes
{'dim0': 1, 'dim1': 3}
>>> f.insert_data(cf.Data([[0, 1, 2]]))
>>> f.dimension_sizes
{'dim0': 1, 'dim1': 3}
>>> f.insert_data(cf.Data([[0, 1, 2]]), dimensions['dim0', 'dim1'])
>>> f.dimension_sizes
{}
>>> f.insert_data(cf.Data([[0, 1], [2, 3, 4]]))
>>> f.dimension_sizes
{'dim0': 2, 'dim1': 3}
>>> f.insert_data(cf.Data(4))
>>> f.insert_data(cf.Data(4), dimensions=[])
>>> f.dimension_sizes
{'dim0': 3, 'dim1': 2}
>>> data = cf.Data([[0, 1], [2, 3, 4]])
>>> f.insert_data(data, dimensions=['dim1', 'dim0'], copy=False)
>>> f.insert_data(cf.Data([0, 1, 2]))
>>> f.insert_data(cf.Data([3, 4, 5]), replace=False)
ValueError: Can't initialize data: Data already exists
>>> f.insert_data(cf.Data([3, 4, 5]))